Skip to content

Commit

Permalink
bugfix: fix auth check return error msg
Browse files Browse the repository at this point in the history
when your browse can not use cookie and you send a request with wrong token format in header,
in old code will return msg with cookie token is empty
in new code will return msg with auth header is invalid
it just is a small bug, and almost impossible to show up
  • Loading branch information
ChenHaoHu authored Feb 15, 2021
1 parent 1ee16f3 commit 6849a91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/jwtauth/jwtauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ func (mw *GinJWTMiddleware) jwtFromHeader(c *gin.Context, key string) (string, e

parts := strings.SplitN(authHeader, " ", 2)
if !(len(parts) == 2 && parts[0] == mw.TokenHeadName) {
return "", ErrInvalidAuthHeader
return "-", ErrInvalidAuthHeader
}

return parts[1], nil
Expand Down

0 comments on commit 6849a91

Please sign in to comment.