From 2d89883173feb716c5b68f8c7d438171f011f991 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Fri, 1 Dec 2023 13:34:24 +0000 Subject: [PATCH] Bearer token does not contain a colon --- lambda/shared/jwt.go | 2 +- lambda/shared/jwt_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lambda/shared/jwt.go b/lambda/shared/jwt.go index c309f39b..f201512c 100644 --- a/lambda/shared/jwt.go +++ b/lambda/shared/jwt.go @@ -107,7 +107,7 @@ func (v JWTVerifier) VerifyToken(tokenStr string) error { return nil } -var bearerRegexp = regexp.MustCompile("^Bearer:[ ]+") +var bearerRegexp = regexp.MustCompile("^Bearer[ ]+") // verify JWT from event header // returns true if verified, false otherwise diff --git a/lambda/shared/jwt_test.go b/lambda/shared/jwt_test.go index fb90997f..b92e3122 100644 --- a/lambda/shared/jwt_test.go +++ b/lambda/shared/jwt_test.go @@ -158,7 +158,7 @@ func TestVerifyHeader(t *testing.T) { event := events.APIGatewayProxyRequest{ MultiValueHeaders: map[string][]string{ "X-Jwt-Authorization": []string{ - fmt.Sprintf("Bearer: %s", token), + fmt.Sprintf("Bearer %s", token), }, }, }