TokenEnhancerChainFilter.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:session-cloud 作者:
/**
 * Loop over the {@link #setTokenEnhancers(List) delegates} passing the result into the next member of the chain.
 *
 * @see org.springframework.security.oauth2.provider.token.TokenEnhancer#enhance(org.springframework.security.oauth2.common.OAuth2AccessToken,
 * org.springframework.security.oauth2.provider.OAuth2Authentication)
 */
public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
    DefaultOAuth2AccessToken tempResult = (DefaultOAuth2AccessToken) accessToken;


    final Map<String, Object> additionalInformation = new HashMap<String, Object>();

    Map<String, String> details = Maps.newHashMap();
    Object userDetails = authentication.getUserAuthentication().getDetails();
    if (userDetails != null) {
        details = (Map<String, String>) userDetails;
    }


    //you can do extra functions from authentication details

    OAuth2AccessToken result = tempResult;
    for (TokenEnhancer enhancer : delegates) {
        result = enhancer.enhance(result, authentication);
    }
    return result;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号