Class CustomerContextAccessTokenEnhancer
java.lang.Object
com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
com.broadleafcommerce.auth.user.session.token.enhancer.CustomerContextAccessTokenEnhancer
- All Implemented Interfaces:
JwtAccessTokenEnhancer,org.springframework.core.Ordered
Enhances tokens with the "customer_context_ids" claim. These are the customer context IDs that
the user is eligible to read from.
This mainly comes into play for UserType.ADMIN and UserType.CUSTOMER users. This
allows us to validate that an Admin is able to read a particular customer or customers, and that
a customer can only read data within their specific customer context.
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionCustomerContextAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility, ApplicationService<Application> applicationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCustomerContextIds(JwtTokenEnhancerContext context, Collection<String> customerContextIds) voidenhance(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.protected ApplicationService<Application>protected booleanisAssignedToApplication(User user) protected voidsetCustomerContextIds(Collection<String> customerContextIds, JwtTokenEnhancerContext context) Methods inherited from class com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
getSessionToken, getTokenEnhancerUtility, getUser, getUserService, isAnonymousCsrImpersonation, isClientOnly, 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
-
CustomerContextAccessTokenEnhancer
public CustomerContextAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility, ApplicationService<Application> applicationService)
-
-
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.
-
isAssignedToApplication
-
setCustomerContextIds
protected void setCustomerContextIds(Collection<String> customerContextIds, JwtTokenEnhancerContext context) -
addCustomerContextIds
protected void addCustomerContextIds(JwtTokenEnhancerContext context, Collection<String> customerContextIds) -
getApplicationService
-