Skip to content

Commit

Permalink
fix: enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-elliott committed Dec 8, 2024
1 parent d697229 commit 7060abd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions handler/oauth2/strategy_jwt_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ func (s *JWTProfileCoreStrategy) GenerateAccessToken(ctx context.Context, reques
)

if s.Config.GetEnforceJWTProfileAccessTokens(ctx) {
return s.GenerateJWT(ctx, oauth2.AccessToken, requester, nil)
}
enforce := s.Config.GetEnforceJWTProfileAccessTokens(ctx)

if client, ok = requester.GetClient().(oauth2.JWTProfileClient); ok && client.GetEnableJWTProfileOAuthAccessTokens() {
if client, ok = requester.GetClient().(oauth2.JWTProfileClient); ok && (enforce || client.GetEnableJWTProfileOAuthAccessTokens()) {
return s.GenerateJWT(ctx, oauth2.AccessToken, requester, client)
} else if enforce {
return s.GenerateJWT(ctx, oauth2.AccessToken, requester, nil)
}

return s.HMACCoreStrategy.GenerateAccessToken(ctx, requester)
Expand Down

0 comments on commit 7060abd

Please sign in to comment.