From bee80a998171efa7ad0b073ad818cc71406fb1a6 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 20 Mar 2024 13:55:35 -0400 Subject: [PATCH] Revert "refactor: if the token doesn't match our purpose only error if EmptyAllowed is off" This reverts commit b1fcc7f7ae1795d609a1b8f18e8ebfdd23342557. --- api/middleware/middleware.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/api/middleware/middleware.go b/api/middleware/middleware.go index b481326..df87d90 100644 --- a/api/middleware/middleware.go +++ b/api/middleware/middleware.go @@ -129,9 +129,7 @@ func AuthMiddleware(options AuthMiddlewareOptions) func(http.Handler) http.Handl aud, _ := claim.GetAudience() if options.Purpose != account.JWTPurposeNone && slices.Contains[jwt.ClaimStrings, string](aud, string(options.Purpose)) == false { - if !options.EmptyAllowed { - return account.ErrJWTInvalid - } + return account.ErrJWTInvalid } return nil