Java Code Examples for org.springframework.security.oauth2.common.DefaultOAuth2AccessToken#getValue()

The following examples show how to use org.springframework.security.oauth2.common.DefaultOAuth2AccessToken#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JweTokenEnhancer.java    From OAuth-2.0-Cookbook with MIT License 5 votes vote down vote up
@Override
public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
    DefaultOAuth2AccessToken result = new DefaultOAuth2AccessToken(accessToken);
    Map<String, Object> info = new LinkedHashMap<>(accessToken.getAdditionalInformation());
    String tokenId = result.getValue();
    if (!info.containsKey(TOKEN_ID)) {
        info.put(TOKEN_ID, tokenId);
    }
    result.setAdditionalInformation(info);
    result.setValue(encode(result, authentication));

    return result;
}
 
Example 2
Source File: JweTokenEnhancer.java    From OAuth-2.0-Cookbook with MIT License 5 votes vote down vote up
@Override
public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
    DefaultOAuth2AccessToken result = new DefaultOAuth2AccessToken(accessToken);
    Map<String, Object> info = new LinkedHashMap<>(accessToken.getAdditionalInformation());
    String tokenId = result.getValue();
    if (!info.containsKey(TOKEN_ID)) {
        info.put(TOKEN_ID, tokenId);
    }
    result.setAdditionalInformation(info);
    result.setValue(encode(result, authentication));

    return result;
}