aboutsummaryrefslogtreecommitdiff
path: root/weed/security
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-02-15 00:09:19 -0800
committerChris Lu <chris.lu@gmail.com>2019-02-15 00:09:19 -0800
commit74fb237727267aa482ee07851f454ca03fbd1fdf (patch)
treeca1a25621f932c46618da103f1cb6d7b95801168 /weed/security
parenta3b0e39b06dcc284ff255d9c2a3c1f55c05ad19c (diff)
downloadseaweedfs-74fb237727267aa482ee07851f454ca03fbd1fdf.tar.xz
seaweedfs-74fb237727267aa482ee07851f454ca03fbd1fdf.zip
benchmark can work in secure mode
Diffstat (limited to 'weed/security')
-rw-r--r--weed/security/jwt.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/weed/security/jwt.go b/weed/security/jwt.go
index ba394c3bf..45a77f093 100644
--- a/weed/security/jwt.go
+++ b/weed/security/jwt.go
@@ -4,7 +4,6 @@ import (
"fmt"
"net/http"
"strings"
-
"time"
"github.com/chrislusf/seaweedfs/weed/glog"
@@ -57,10 +56,10 @@ func GetJwt(r *http.Request) EncodedJwt {
func DecodeJwt(signingKey SigningKey, tokenString EncodedJwt) (token *jwt.Token, err error) {
// check exp, nbf
- return jwt.Parse(string(tokenString), func(token *jwt.Token) (interface{}, error) {
+ return jwt.ParseWithClaims(string(tokenString), &SeaweedFileIdClaims{}, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("unknown token method")
}
- return signingKey, nil
+ return []byte(signingKey), nil
})
}