aboutsummaryrefslogtreecommitdiff
path: root/weed/security/jwt.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2016-06-18 18:57:33 -0700
committerChris Lu <chris.lu@gmail.com>2016-06-18 18:57:33 -0700
commit356b8048c57c7b6e676148892f5ff5031b2178b0 (patch)
tree526f284afceb844d7218b0d2fca8f124ed7f284a /weed/security/jwt.go
parent18cf59c375902ce47fe3d1bb02f00760880802e5 (diff)
downloadseaweedfs-356b8048c57c7b6e676148892f5ff5031b2178b0.tar.xz
seaweedfs-356b8048c57c7b6e676148892f5ff5031b2178b0.zip
fix compilation problem due to API changes
Diffstat (limited to 'weed/security/jwt.go')
-rw-r--r--weed/security/jwt.go8
1 files 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
}