mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00: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:
parent
4aeca48b6d
commit
d5d9fbb8aa
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue