0

我想将刷新令牌值放入访问令牌中。我尝试如下:

public class JwtTokenEnhancer implements TokenEnhancer {
  @Override
  public OAuth2AccessToken enhance(
      OAuth2AccessToken accessToken, OAuth2Authentication authentication) {
    OAuth2RefreshToken refreshToken = accessToken.getRefreshToken();
    Map<String, Object> info = new HashMap<>();
    info.put("my_refresh_token", refreshToken.getValue());
    ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(info);
    return accessToken;
  }
}

accessToken.getRefreshToken() only get refresh token jti like '860df329-4f44-4d38-9bc7-817b1cda47a2' but not the token encoded value like 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJteV9yZWZyZXNoX3Rva2VuIjoiODYwZGYzMjktNGY0NC00ZDM4LTliYzctODE3YjFjZGE0N2EyIiwidXNlcl9uYW1lIjoicmFuZHkiLCJzY29wZSI6WyJhbGwiXSwiZXhwIjoxNjE1MzQxMjY0LCJhdXRob3JpdGllcyI6WyIxMTAiLCIxMDAiLCIxMTEiLCJST0xFX3N1cGVyQWRtaW4iXSwianRpIjoiOTM0ZjA1MGYtZDU1Yi00NDg3LTkyNDgtNmViM2QzMjIxNTg4IiwiY2xpZW50X2lkIjoid2ViIiwiZW5oYW5jZSI6ImVuaGFuY2UgaW5mbyJ9.gJ_VJx8COMXTMr5usR9uBrZDPvpoocGOTtDB8sWvEy8'

任何人都知道如何获得刷新令牌编码值?

4

0 回答 0