Class UserAccessTokenEnhancer
java.lang.Object
com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
com.broadleafcommerce.auth.user.session.token.enhancer.UserAccessTokenEnhancer
- All Implemented Interfaces:
JwtAccessTokenEnhancer,org.springframework.core.Ordered
Token enhancer that puts various relevant user data into the token's claims.
- Author:
- Samarth Dhruva (samarthd), Nick Crum (ncrum)
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionUserAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility) -
Method Summary
Modifier and TypeMethodDescriptionvoidenhance(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.getAdditionalAttributeClaims(@NonNull User user) If the user type is known, then this will checkUserMappingPropertiesfor any additional attributes that have been mapped onto theUserthat should be included as a claim.protected UserMappingPropertiesprotected voidputServiceIdClaim(Map<String, Object> userData, User user) voidsetUserMappingProperties(UserMappingProperties userMappingProperties) Methods inherited from class com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
getSessionToken, getTokenEnhancerUtility, getUser, getUserContext, getUserIdFromSession, getUserService, isAnonymousCsrImpersonation, isClientOnly, setUserContext, shouldEnhanceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.broadleafcommerce.auth.user.session.token.enhancer.JwtAccessTokenEnhancer
getOrder
-
Constructor Details
-
UserAccessTokenEnhancer
public UserAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility)
-
-
Method Details
-
enhance
Description copied from interface:JwtAccessTokenEnhancerEvaluate the authentication and add claims as necessary. AJwtTokenEnhancerContextcontains User and client authentication tokens, authorization tokens, and access token claims.- Parameters:
context- TheJwtTokenEnhancerContextto evaluate.
-
getUserTokenClaims
-
putServiceIdClaim
-
getAdditionalAttributeClaims
If the user type is known, then this will checkUserMappingPropertiesfor any additional attributes that have been mapped onto theUserthat should be included as a claim.By default, this will only check customer-user-sourced attributes.
- Parameters:
user- The authenticated user.- Returns:
- The additional attributes that should be included as claims.
-
getUserMappingProperties
-
setUserMappingProperties
-