From 52ebfd69392fe21652d491dd9ab982f72a85abc8 Mon Sep 17 00:00:00 2001 From: Supan Adit Pratama Date: Sat, 11 Jul 2020 07:55:06 +0700 Subject: [PATCH] Authorization must provide JWT word for defining type auth --- web_framework.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web_framework.go b/web_framework.go index 3350056..b471143 100644 --- a/web_framework.go +++ b/web_framework.go @@ -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") }