Class AccountIdAccessTokenEnhancer
java.lang.Object
com.broadleafcommerce.auth.user.session.token.enhancer.AbstractUserAccessTokenEnhancer
com.broadleafcommerce.auth.user.session.token.enhancer.AccountIdAccessTokenEnhancer
- All Implemented Interfaces:
JwtAccessTokenEnhancer,org.springframework.core.Ordered
Responsible for validating and adding the "acct_id" claim to the token. A user is defined as a
member of an account if they have at least one role for that account.
-
Field Summary
FieldsFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsConstructorDescriptionAccountIdAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility, AccountAncestorService accountAncestorService) -
Method Summary
Modifier and TypeMethodDescriptionvoidenhance(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.protected AccountAncestorServiceLooks for an account ID on the request.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
-
Field Details
-
ACCOUNT_ID_CLAIM
- See Also:
-
PARENT_ACCOUNTS_CLAIM
- See Also:
-
PERSONAL
- See Also:
-
-
Constructor Details
-
AccountIdAccessTokenEnhancer
public AccountIdAccessTokenEnhancer(UserService<User> userService, TokenEnhancerUtility tokenEnhancerUtility, AccountAncestorService accountAncestorService)
-
-
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.
-
getRequestAccountId
Looks for an account ID on the request. If it exists, it is returned. Otherwise, if the user has adefault account ID, that is returned.- Parameters:
context- TheJwtTokenEnhancerContextobject passed toJwtAccessTokenEnhancer.enhance(JwtTokenEnhancerContext).- Returns:
- The accountId requested or
Optional.empty().
-
getAccountAncestorService
-