@Service @Transactional(readOnly=true) public class OAuthServiceImpl extends Object implements OAuthClientDetailsService, OAuthTokenStoreService
| Constructor and Description |
|---|
OAuthServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
OAuthClient |
addClient(OAuthClient client)
Register a new OAuth client.
|
OAuthClient |
addClient(String title,
String description,
String redirectUris,
Integer accessTokenValidity,
Integer refreshTokenValidity)
Adds the client.
|
List<OAuthClient> |
autocompleteClients(String title)
Autocomplete OAuth clients by title.
|
protected org.springframework.security.oauth2.common.OAuth2AccessToken |
deserializeAccessToken(byte[] token)
Deserialize access token.
|
protected org.springframework.security.oauth2.provider.OAuth2Authentication |
deserializeAuthentication(byte[] authentication)
Deserialize authentication.
|
protected org.springframework.security.oauth2.common.OAuth2RefreshToken |
deserializeRefreshToken(byte[] token)
Deserialize refresh token.
|
protected String |
extractTokenKey(String value)
Extract token key.
|
List<AccessToken> |
findAccessTokensByClientId(String clientId)
Find access tokens by client id.
|
List<RefreshToken> |
findRefreshTokensByClientId(String clientId)
Find refresh tokens by client id.
|
Collection<org.springframework.security.oauth2.common.OAuth2AccessToken> |
findTokensByClientId(String clientId) |
Collection<org.springframework.security.oauth2.common.OAuth2AccessToken> |
findTokensByClientIdAndUserName(String clientId,
String username) |
List<AccessToken> |
findTokensByUserUuid(String uuid)
Find tokens by user uuid.
|
org.springframework.security.oauth2.common.OAuth2AccessToken |
getAccessToken(org.springframework.security.oauth2.provider.OAuth2Authentication authentication) |
OAuthClient |
getClient(String clientId)
Gets the client.
|
List<OAuthClient> |
listClientDetails()
List client details.
|
org.springframework.security.oauth2.provider.ClientDetails |
loadClientByClientId(String clientId) |
org.springframework.security.oauth2.common.OAuth2AccessToken |
readAccessToken(String tokenValue) |
org.springframework.security.oauth2.provider.OAuth2Authentication |
readAuthentication(org.springframework.security.oauth2.common.OAuth2AccessToken token) |
org.springframework.security.oauth2.provider.OAuth2Authentication |
readAuthentication(String tokenValue) |
org.springframework.security.oauth2.provider.OAuth2Authentication |
readAuthenticationForRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken token) |
org.springframework.security.oauth2.provider.OAuth2Authentication |
readAuthenticationForRefreshToken(String token)
Read authentication for refresh token.
|
org.springframework.security.oauth2.common.OAuth2RefreshToken |
readRefreshToken(String token) |
void |
removeAccessToken(org.springframework.security.oauth2.common.OAuth2AccessToken token) |
void |
removeAccessToken(String tokenValue)
Removes the access token.
|
void |
removeAccessTokenUsingRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken refreshToken) |
void |
removeAccessTokenUsingRefreshToken(String refreshToken)
Removes the access token using refresh token.
|
OAuthClient |
removeClient(OAuthClient client)
Removes the client.
|
void |
removeRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken token) |
void |
removeRefreshToken(String token)
Removes the refresh token.
|
protected byte[] |
serializeAccessToken(org.springframework.security.oauth2.common.OAuth2AccessToken token)
Serialize access token.
|
protected byte[] |
serializeAuthentication(org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
Serialize authentication.
|
protected byte[] |
serializeRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken token)
Serialize refresh token.
|
void |
setAuthenticationKeyGenerator(org.springframework.security.oauth2.provider.token.AuthenticationKeyGenerator authenticationKeyGenerator)
Sets the authentication key generator.
|
void |
storeAccessToken(org.springframework.security.oauth2.common.OAuth2AccessToken token,
org.springframework.security.oauth2.provider.OAuth2Authentication authentication) |
void |
storeRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken refreshToken,
org.springframework.security.oauth2.provider.OAuth2Authentication authentication) |
OAuthClient |
updateClient(long id,
int version,
OAuthClient updates)
Update client.
|
public void setAuthenticationKeyGenerator(org.springframework.security.oauth2.provider.token.AuthenticationKeyGenerator authenticationKeyGenerator)
authenticationKeyGenerator - the new authentication key generator@Cacheable(cacheNames="oauthclient",
key="#clientId",
unless="#result == null")
public org.springframework.security.oauth2.provider.ClientDetails loadClientByClientId(String clientId)
throws org.springframework.security.oauth2.provider.ClientRegistrationException
loadClientByClientId in interface org.springframework.security.oauth2.provider.ClientDetailsServiceorg.springframework.security.oauth2.provider.ClientRegistrationException@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void storeAccessToken(org.springframework.security.oauth2.common.OAuth2AccessToken token,
org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
storeAccessToken in interface org.springframework.security.oauth2.provider.token.TokenStore@Cacheable(cacheNames="oauthaccesstoken",
key="#tokenValue",
unless="#result == null")
public org.springframework.security.oauth2.common.OAuth2AccessToken readAccessToken(String tokenValue)
readAccessToken in interface org.springframework.security.oauth2.provider.token.TokenStore@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void removeAccessToken(org.springframework.security.oauth2.common.OAuth2AccessToken token)
removeAccessToken in interface org.springframework.security.oauth2.provider.token.TokenStore@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void removeAccessToken(String tokenValue)
OAuthTokenStoreServiceremoveAccessToken in interface OAuthTokenStoreServicetokenValue - the token id@Cacheable(cacheNames="oauthaccesstokenauth",
key="#token.value",
unless="#result == null")
public org.springframework.security.oauth2.provider.OAuth2Authentication readAuthentication(org.springframework.security.oauth2.common.OAuth2AccessToken token)
readAuthentication in interface org.springframework.security.oauth2.provider.token.TokenStore@Cacheable(cacheNames="oauthaccesstokenauth",
key="#tokenValue",
unless="#result == null")
public org.springframework.security.oauth2.provider.OAuth2Authentication readAuthentication(String tokenValue)
readAuthentication in interface org.springframework.security.oauth2.provider.token.TokenStore@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void storeRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken refreshToken,
org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
storeRefreshToken in interface org.springframework.security.oauth2.provider.token.TokenStorepublic org.springframework.security.oauth2.common.OAuth2RefreshToken readRefreshToken(String token)
readRefreshToken in interface org.springframework.security.oauth2.provider.token.TokenStore@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void removeRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken token)
removeRefreshToken in interface org.springframework.security.oauth2.provider.token.TokenStore@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void removeRefreshToken(String token)
OAuthTokenStoreServiceremoveRefreshToken in interface OAuthTokenStoreServicetoken - the token idpublic org.springframework.security.oauth2.provider.OAuth2Authentication readAuthenticationForRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken token)
readAuthenticationForRefreshToken in interface org.springframework.security.oauth2.provider.token.TokenStorepublic org.springframework.security.oauth2.provider.OAuth2Authentication readAuthenticationForRefreshToken(String token)
token - the token@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void removeAccessTokenUsingRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken refreshToken)
removeAccessTokenUsingRefreshToken in interface org.springframework.security.oauth2.provider.token.TokenStore@Transactional
@CacheEvict(cacheNames={"oauthaccesstoken","oauthaccesstokenauth"},
allEntries=true)
public void removeAccessTokenUsingRefreshToken(String refreshToken)
refreshToken - the refresh tokenpublic org.springframework.security.oauth2.common.OAuth2AccessToken getAccessToken(org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
getAccessToken in interface org.springframework.security.oauth2.provider.token.TokenStorepublic Collection<org.springframework.security.oauth2.common.OAuth2AccessToken> findTokensByClientIdAndUserName(String clientId, String username)
findTokensByClientIdAndUserName in interface org.springframework.security.oauth2.provider.token.TokenStorepublic Collection<org.springframework.security.oauth2.common.OAuth2AccessToken> findTokensByClientId(String clientId)
findTokensByClientId in interface org.springframework.security.oauth2.provider.token.TokenStoreprotected String extractTokenKey(String value)
value - the valueprotected byte[] serializeAccessToken(org.springframework.security.oauth2.common.OAuth2AccessToken token)
token - the tokenprotected byte[] serializeRefreshToken(org.springframework.security.oauth2.common.OAuth2RefreshToken token)
token - the tokenprotected byte[] serializeAuthentication(org.springframework.security.oauth2.provider.OAuth2Authentication authentication)
authentication - the authenticationprotected org.springframework.security.oauth2.common.OAuth2AccessToken deserializeAccessToken(byte[] token)
token - the tokenprotected org.springframework.security.oauth2.common.OAuth2RefreshToken deserializeRefreshToken(byte[] token)
token - the tokenprotected org.springframework.security.oauth2.provider.OAuth2Authentication deserializeAuthentication(byte[] authentication)
authentication - the authenticationpublic List<OAuthClient> listClientDetails()
OAuthClientDetailsServicelistClientDetails in interface OAuthClientDetailsServicepublic List<AccessToken> findAccessTokensByClientId(String clientId)
OAuthTokenStoreServicefindAccessTokensByClientId in interface OAuthTokenStoreServiceclientId - the client idpublic List<RefreshToken> findRefreshTokensByClientId(String clientId)
OAuthTokenStoreServicefindRefreshTokensByClientId in interface OAuthTokenStoreServiceclientId - the client idpublic List<AccessToken> findTokensByUserUuid(String uuid)
OAuthTokenStoreServicefindTokensByUserUuid in interface OAuthTokenStoreServiceuuid - the uuidpublic OAuthClient getClient(String clientId)
OAuthClientDetailsServicegetClient in interface OAuthClientDetailsServiceclientId - the client id@Transactional public OAuthClient removeClient(OAuthClient client)
OAuthClientDetailsServiceremoveClient in interface OAuthClientDetailsServiceclient - the oauth client@Transactional public OAuthClient addClient(String title, String description, String redirectUris, Integer accessTokenValidity, Integer refreshTokenValidity)
OAuthClientDetailsServiceaddClient in interface OAuthClientDetailsServicetitle - the titledescription - the descriptionredirectUris - the redirect urisaccessTokenValidity - the access token validity secondsrefreshTokenValidity - the refresh token validity seconds@Transactional public OAuthClient addClient(OAuthClient client)
OAuthClientDetailsServiceaddClient in interface OAuthClientDetailsServiceclient - the client@Transactional public OAuthClient updateClient(long id, int version, OAuthClient updates)
OAuthClientDetailsServiceupdateClient in interface OAuthClientDetailsServiceid - the idversion - the versionupdates - the updatespublic List<OAuthClient> autocompleteClients(String title)
OAuthClientDetailsServiceautocompleteClients in interface OAuthClientDetailsServicetitle - the titleCopyright © 2018 Global Crop Diversity Trust. All rights reserved.