CustomAccessTokenConverter.java 612 B

12345678910111213141516171819
  1. package com.diagbot.config;
  2. import org.springframework.security.oauth2.provider.OAuth2Authentication;
  3. import org.springframework.security.oauth2.provider.token.DefaultAccessTokenConverter;
  4. import org.springframework.stereotype.Component;
  5. import java.util.Map;
  6. @Component
  7. public class CustomAccessTokenConverter extends DefaultAccessTokenConverter {
  8. @Override
  9. public OAuth2Authentication extractAuthentication(Map<String, ?> claims) {
  10. OAuth2Authentication authentication = super.extractAuthentication(claims);
  11. authentication.setDetails(claims);
  12. return authentication;
  13. }
  14. }