refactor: auth bearer check
This commit is contained in:
parent
54c7440769
commit
708320d71f
1 changed files with 2 additions and 3 deletions
|
|
@ -58,9 +58,8 @@ func updatePasswordHandler(auth auth.Auth) http.HandlerFunc {
|
|||
func jwtFromRequest(r *http.Request) string {
|
||||
// read from header
|
||||
authHeader := r.Header.Get("Authorization")
|
||||
splitToken := strings.Split(authHeader, "Bearer ")
|
||||
if len(splitToken) == 2 {
|
||||
return splitToken[1]
|
||||
if token, ok := strings.CutPrefix(authHeader, "Bearer "); ok {
|
||||
return token
|
||||
}
|
||||
|
||||
// read from cookie
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue