Class CurrentUserCacheAccessTokenEnhancer

java.lang.Object
com.broadleafcommerce.auth.user.session.token.enhancer.CurrentUserCacheAccessTokenEnhancer
All Implemented Interfaces:
JwtAccessTokenEnhancer, org.springframework.core.Ordered

public class CurrentUserCacheAccessTokenEnhancer extends Object implements JwtAccessTokenEnhancer

Many access token enhancers need to obtain information from the currently authenticated User.

To avoid having each of those enhancers read from the database multiple times, this early-ordered component pre-fetches the User once and caches it in JwtTokenEnhancerContext.getAdditionalContext(). Subsequent enhancers (typically extensions of AbstractUserAccessTokenEnhancer) can then obtain the pre-fetched user from there to get any information they need.

This component does not actually add any claims to the access token.