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 TypeMethodDescriptionvoid
enhance
(JwtTokenEnhancerContext context) Evaluate the authentication and add claims as necessary.protected AccountAncestorService
Looks for an account ID on the request.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
-
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: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.
-
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
- TheJwtTokenEnhancerContext
object passed toJwtAccessTokenEnhancer.enhance(JwtTokenEnhancerContext)
.- Returns:
- The accountId requested or
Optional.empty()
.
-
getAccountAncestorService
-