mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-11 06:18:27 +01:00
Add a way to use a JWT in an HTTP only cookie
If a JWT is not included in the Authorization header or a query string, attempt to get a JWT from an HTTP only cookie.
This commit is contained in:
1 parent
4aeca48b6d
commit
d5d9fbb8aa
1 file changed
+8
@@ -83,6 +83,14 @@ func GetJwt(r *http.Request) EncodedJwt {
|
||||
}
|
||||
}
|
||||
|
||||
// Get token from http only cookie
|
||||
if tokenStr == "" {
|
||||
token, err := r.Cookie("AT")
|
||||
if err == nil {
|
||||
tokenStr = token.Value
|
||||
}
|
||||
}
|
||||
|
||||
return EncodedJwt(tokenStr)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user