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
ConstructorDescriptionCustomerContextAccessTokenEnhancer
(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility, ApplicationService<Application> applicationService) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCustomerContextIds
(JwtTokenEnhancerContext context, Collection<String> customerContextIds) void
enhance
(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.protected ApplicationService<Application>
protected boolean
isAssignedToApplication
(User user) protected void
setCustomerContextIds
(Collection<String> customerContextIds, JwtTokenEnhancerContext context) 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
-
CustomerContextAccessTokenEnhancer
public CustomerContextAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility, ApplicationService<Application> applicationService)
-
-
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.
-
isAssignedToApplication
-
setCustomerContextIds
protected void setCustomerContextIds(Collection<String> customerContextIds, JwtTokenEnhancerContext context) -
addCustomerContextIds
protected void addCustomerContextIds(JwtTokenEnhancerContext context, Collection<String> customerContextIds) -
getApplicationService
-