Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.ufc.mandacaru5.config.security;
- import java.util.HashMap;
- import java.util.Map;
- import java.util.Random;
- import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken;
- import org.springframework.security.oauth2.common.OAuth2AccessToken;
- import org.springframework.security.oauth2.provider.OAuth2Authentication;
- import org.springframework.security.oauth2.provider.token.TokenEnhancer;
- public class CustomTokenEnhancer implements TokenEnhancer {
- @Override
- public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
- Map<String, Object> additionalInfo = new HashMap<>();
- additionalInfo.put("user_id", new Random().nextInt());
- ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo);
- return accessToken;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement