public class JwtAccessTokenConverter extends Object implements TokenEnhancer, AccessTokenConverter, org.springframework.beans.factory.InitializingBean
TokenEnhancer when tokens are granted.TokenEnhancer,
AccessTokenConverter| Modifier and Type | Field and Description |
|---|---|
static String |
TOKEN_ID
Field name for token id.
|
| Constructor and Description |
|---|
JwtAccessTokenConverter() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
Map<String,?> |
convertAccessToken(OAuth2AccessToken token,
OAuth2Authentication authentication) |
protected Map<String,Object> |
decode(String token) |
protected String |
encode(OAuth2AccessToken accessToken,
OAuth2Authentication authentication) |
OAuth2AccessToken |
enhance(OAuth2AccessToken accessToken,
OAuth2Authentication authentication)
Provides an opportunity for customization of an access token (e.g.
|
OAuth2AccessToken |
extractAccessToken(String value,
Map<String,?> map)
Recover an access token from the converted value.
|
OAuth2Authentication |
extractAuthentication(Map<String,?> map)
Recover an
OAuth2Authentication from the converted access token. |
AccessTokenConverter |
getAccessTokenConverter() |
Map<String,String> |
getKey()
Get the verification key for the token signatures.
|
boolean |
isPublic() |
void |
setAccessTokenConverter(AccessTokenConverter tokenConverter) |
void |
setSigningKey(String key)
Sets the JWT signing key.
|
void |
setVerifierKey(String key)
The key used for verifying signatures produced by this class.
|
public static final String TOKEN_ID
public void setAccessTokenConverter(AccessTokenConverter tokenConverter)
tokenConverter - the tokenConverter to setpublic AccessTokenConverter getAccessTokenConverter()
public Map<String,?> convertAccessToken(OAuth2AccessToken token, OAuth2Authentication authentication)
convertAccessToken in interface AccessTokenConvertertoken - an access tokenauthentication - the current OAuth authenticationpublic OAuth2AccessToken extractAccessToken(String value, Map<String,?> map)
AccessTokenConverterAccessTokenConverter.convertAccessToken(OAuth2AccessToken, OAuth2Authentication).extractAccessToken in interface AccessTokenConvertervalue - the token valuemap - information decoded from an access tokenpublic OAuth2Authentication extractAuthentication(Map<String,?> map)
AccessTokenConverterOAuth2Authentication from the converted access token. Half the inverse of
AccessTokenConverter.convertAccessToken(OAuth2AccessToken, OAuth2Authentication).extractAuthentication in interface AccessTokenConvertermap - information decoded from an access tokenpublic Map<String,String> getKey()
public void setSigningKey(String key)
key - the key to be used for signing JWTs.public boolean isPublic()
public void setVerifierKey(String key)
key - the signature verification key (typically an RSA public key)public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication)
TokenEnhancerenhance in interface TokenEnhanceraccessToken - the current access token with its expiration and refresh tokenauthentication - the current authentication including client and user detailsprotected String encode(OAuth2AccessToken accessToken, OAuth2Authentication authentication)
Copyright © 2014. All rights reserved.