Class DefaultJwtTokenCustomizer
java.lang.Object
com.broadleafcommerce.auth.user.session.token.enhancer.DefaultJwtTokenCustomizer
- All Implemented Interfaces:
org.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer<org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext>
public class DefaultJwtTokenCustomizer
extends Object
implements org.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer<org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext>
An
OAuth2TokenCustomizer for JwtEncodingContext that delegates to a list of
JwtAccessTokenEnhancers.
This is used by JwtGenerator.
- Author:
- Cade Rea (cade-rea)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJwtTokenCustomizer(List<JwtAccessTokenEnhancer> accessTokenEnhancers) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidapplyAccessTokenEnhancers(org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext context) voidcustomize(org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext context) protected List<JwtAccessTokenEnhancer>protected booleanshouldApplyAccessTokenEnhancers(org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext context) JwtGeneratorindiscriminately invokes this customizer component for all the token types it supports, which includesOidcParameterNames.ID_TOKEN.
-
Constructor Details
-
DefaultJwtTokenCustomizer
-
-
Method Details
-
customize
public void customize(org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext context) - Specified by:
customizein interfaceorg.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer<org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext>
-
shouldApplyAccessTokenEnhancers
protected boolean shouldApplyAccessTokenEnhancers(org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext context) JwtGeneratorindiscriminately invokes this customizer component for all the token types it supports, which includesOidcParameterNames.ID_TOKEN.Thus, to ensure the
JwtAccessTokenEnhancersare only invoked for access tokens, we perform this check.- Parameters:
context- theJwtEncodingContextprovided byJwtGenerator- Returns:
- true if the access token enhancers should be applied, false otherwise
-
applyAccessTokenEnhancers
protected void applyAccessTokenEnhancers(org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext context) -
getAccessTokenEnhancers
-