Skip to content

Commit

Permalink
Authorization must provide JWT word for defining type auth
Browse files Browse the repository at this point in the history
  • Loading branch information
supanadit committed Jul 11, 2020
1 parent a282239 commit 52ebfd6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web_framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ func GetJWTFromHeader(header string) (token string, err error) {
if header != "" {
splitAuthorization := strings.Split(header, " ")
if len(splitAuthorization) != 0 && len(splitAuthorization) == 2 {
token = splitAuthorization[1]
if splitAuthorization[0] != "JWT" {
err = errors.New("unknown authorization type")
} else {
token = splitAuthorization[1]
}
} else {
err = errors.New("invalid authorization header")
}
Expand Down

0 comments on commit 52ebfd6

Please sign in to comment.