mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-06-03 09:10:10 +02: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)
|
return EncodedJwt(tokenStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue