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 TypeMethodDescriptionprotected void
addLegacyClaims
(Map<String, Object> userData, User user) Add legacy claims, primarily for backwards compatibility.void
enhance
(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.getAdditionalAttributeClaims
(@NonNull User user) If the user type is known, then this will checkUserMappingPropertiesService
for any additional attributes that have been mapped onto theUser
that should be included as a claim.protected UserMappingProperties
Deprecated.protected UserMappingPropertiesService
protected void
putServiceIdClaim
(Map<String, Object> userData, User user) void
setUserMappingProperties
(UserMappingProperties userMappingProperties) Deprecated.void
setUserMappingPropertiesService
(UserMappingPropertiesService userMappingPropertiesService) Methods inherited from class com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
getSessionToken, getTokenEnhancerUtility, getUser, getUserService, isAnonymousCsrImpersonation, isClientOnly, 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
-
addLegacyClaims
Add legacy claims, primarily for backwards compatibility.- Parameters:
userData
- the claims map to updateuser
- the user from which to source information
-
getAdditionalAttributeClaims
If the user type is known, then this will checkUserMappingPropertiesService
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
Deprecated. -
setUserMappingProperties
@Deprecated @Autowired public void setUserMappingProperties(UserMappingProperties userMappingProperties) Deprecated. -
getUserMappingPropertiesService
-
setUserMappingPropertiesService
@Autowired public void setUserMappingPropertiesService(UserMappingPropertiesService userMappingPropertiesService)
-