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
ConstructorDescriptionUserAccessTokenEnhancer
(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility) -
Method Summary
Modifier and TypeMethodDescriptionvoid
enhance
(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.getAdditionalAttributeClaims
(@NonNull User user) If the user type is known, then this will checkUserMappingProperties
for any additional attributes that have been mapped onto theUser
that should be included as a claim.protected UserMappingProperties
protected void
putServiceIdClaim
(Map<String, Object> userData, User user) void
setUserMappingProperties
(UserMappingProperties userMappingProperties) Methods inherited from class com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
getSessionToken, getTokenEnhancerUtility, getUser, getUserContext, getUserIdFromSession, getUserService, isAnonymousCsrImpersonation, isClientOnly, setUserContext, shouldEnhance
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:JwtAccessTokenEnhancer
Evaluate the authentication and add claims as necessary. AJwtTokenEnhancerContext
contains User and client authentication tokens, authorization tokens, and access token claims.- Parameters:
context
- TheJwtTokenEnhancerContext
to evaluate.
-
getUserTokenClaims
-
putServiceIdClaim
-
getAdditionalAttributeClaims
If the user type is known, then this will checkUserMappingProperties
for any additional attributes that have been mapped onto theUser
that 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
-