From 356b8048c57c7b6e676148892f5ff5031b2178b0 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 18 Jun 2016 18:57:33 -0700 Subject: [PATCH] fix compilation problem due to API changes --- weed/security/jwt.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/weed/security/jwt.go b/weed/security/jwt.go index a2472ca6e..46b7efaaf 100644 --- a/weed/security/jwt.go +++ b/weed/security/jwt.go @@ -19,8 +19,10 @@ func GenJwt(secret Secret, fileId string) EncodedJwt { } t := jwt.New(jwt.GetSigningMethod("HS256")) - t.Claims["exp"] = time.Now().Unix() + 10 - t.Claims["sub"] = fileId + t.Claims = &jwt.StandardClaims{ + ExpiresAt: time.Now().Add(time.Second * 10).Unix(), + Subject: fileId, + } encoded, e := t.SignedString(secret) if e != nil { glog.V(0).Infof("Failed to sign claims: %v", t.Claims) @@ -53,7 +55,7 @@ func GetJwt(r *http.Request) EncodedJwt { return EncodedJwt(tokenStr) } -func EncodeJwt(secret Secret, claims map[string]interface{}) (EncodedJwt, error) { +func EncodeJwt(secret Secret, claims *jwt.StandardClaims) (EncodedJwt, error) { if secret == "" { return "", nil }