fix compilation problem due to API changes

This commit is contained in:
Chris Lu 2016-06-18 18:57:33 -07:00
parent 18cf59c375
commit 356b8048c5

View File

@ -19,8 +19,10 @@ func GenJwt(secret Secret, fileId string) EncodedJwt {
} }
t := jwt.New(jwt.GetSigningMethod("HS256")) t := jwt.New(jwt.GetSigningMethod("HS256"))
t.Claims["exp"] = time.Now().Unix() + 10 t.Claims = &jwt.StandardClaims{
t.Claims["sub"] = fileId ExpiresAt: time.Now().Add(time.Second * 10).Unix(),
Subject: fileId,
}
encoded, e := t.SignedString(secret) encoded, e := t.SignedString(secret)
if e != nil { if e != nil {
glog.V(0).Infof("Failed to sign claims: %v", t.Claims) glog.V(0).Infof("Failed to sign claims: %v", t.Claims)
@ -53,7 +55,7 @@ func GetJwt(r *http.Request) EncodedJwt {
return EncodedJwt(tokenStr) return EncodedJwt(tokenStr)
} }
func EncodeJwt(secret Secret, claims map[string]interface{}) (EncodedJwt, error) { func EncodeJwt(secret Secret, claims *jwt.StandardClaims) (EncodedJwt, error) {
if secret == "" { if secret == "" {
return "", nil return "", nil
} }