diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-02-15 00:09:19 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-02-15 00:09:19 -0800 |
| commit | 74fb237727267aa482ee07851f454ca03fbd1fdf (patch) | |
| tree | ca1a25621f932c46618da103f1cb6d7b95801168 /weed/security/jwt.go | |
| parent | a3b0e39b06dcc284ff255d9c2a3c1f55c05ad19c (diff) | |
| download | seaweedfs-74fb237727267aa482ee07851f454ca03fbd1fdf.tar.xz seaweedfs-74fb237727267aa482ee07851f454ca03fbd1fdf.zip | |
benchmark can work in secure mode
Diffstat (limited to 'weed/security/jwt.go')
| -rw-r--r-- | weed/security/jwt.go | 5 |
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 }) } |
