Revert "refactor: if the token doesn't match our purpose only error if EmptyAllowed is off"

This reverts commit b1fcc7f7ae.
This commit is contained in:
Derrick Hammer 2024-03-20 13:55:35 -04:00
parent b1fcc7f7ae
commit bee80a9981
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 3 deletions

View File

@ -129,10 +129,8 @@ 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 nil
})