aboutsummaryrefslogtreecommitdiff
path: root/weed/security/jwt.go
diff options
context:
space:
mode:
authorSebastian Kurfuerst <sebastian.kurfuerst@sandstorm.de>2021-12-29 12:40:41 +0100
committerSebastian Kurfuerst <sebastian.kurfuerst@sandstorm.de>2021-12-29 12:40:41 +0100
commitfcc09cef6fa9f7baa87675b1513425c233dbfffe (patch)
treebb14136248af827c8d5739c75360cca322826799 /weed/security/jwt.go
parentd156d410efb8166ded4a0c6b206fd7b071b61c8b (diff)
downloadseaweedfs-fcc09cef6fa9f7baa87675b1513425c233dbfffe.tar.xz
seaweedfs-fcc09cef6fa9f7baa87675b1513425c233dbfffe.zip
Refactor: pass in claim type into security.DecodeJwt
Diffstat (limited to 'weed/security/jwt.go')
-rw-r--r--weed/security/jwt.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/weed/security/jwt.go b/weed/security/jwt.go
index f025af519..1976c8ffe 100644
--- a/weed/security/jwt.go
+++ b/weed/security/jwt.go
@@ -57,9 +57,9 @@ func GetJwt(r *http.Request) EncodedJwt {
return EncodedJwt(tokenStr)
}
-func DecodeJwt(signingKey SigningKey, tokenString EncodedJwt) (token *jwt.Token, err error) {
+func DecodeJwt(signingKey SigningKey, tokenString EncodedJwt, claims jwt.Claims) (token *jwt.Token, err error) {
// check exp, nbf
- return jwt.ParseWithClaims(string(tokenString), &SeaweedFileIdClaims{}, func(token *jwt.Token) (interface{}, error) {
+ return jwt.ParseWithClaims(string(tokenString), claims, func(token *jwt.Token) (interface{}, error) {
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("unknown token method")
}