Browse Source

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.
pull/5081/head
jerebear12 1 year ago
committed by Chris Lu
parent
commit
d5d9fbb8aa
  1. 8
      weed/security/jwt.go

8
weed/security/jwt.go

@ -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…
Cancel
Save