This commit is contained in:
cui 2026-06-18 19:48:18 +00:00 committed by GitHub
commit 60f45d6da4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -47,7 +47,7 @@ func (handler *jwtHandler) ServeHTTP(out http.ResponseWriter, r *http.Request) {
strToken string strToken string
claims jwt.RegisteredClaims claims jwt.RegisteredClaims
) )
if auth := r.Header.Get("Authorization"); strings.HasPrefix(auth, "Bearer ") { if auth := r.Header.Get("Authorization"); len(auth) >= 7 && strings.EqualFold(auth[:7], "bearer ") {
strToken = strings.TrimPrefix(auth, "Bearer ") strToken = strings.TrimPrefix(auth, "Bearer ")
} }
if len(strToken) == 0 { if len(strToken) == 0 {