Interface OAuthTokenService
- All Known Implementing Classes:
DefaultOAuthTokenService
public interface OAuthTokenService
Service for managing OAuth access and refresh tokens
- Spring Bean ID:
- oauthTokenService
-
Method Summary
Modifier and TypeMethodDescriptiongetAccessToken(String id) Returns access token for given identifier (key)getAccessTokenForAuthentication(String authenticationId) Returns access token for given authenticationgetAccessTokenListForRefreshToken(String refreshTokenId) Returns list of access tokens for refresh tokengetAccessTokensForClient(String clientId) Returns access tokens for clientgetAccessTokensForClientAndUser(String clientId, String userName) Returns access tokens based on user and clientgetAccessTokensForUser(String userName) Returns access tokens for user with given user nameReturns refresh token for given identifier (key)voidRemove access tokenvoidremoveAccessTokenForAuthentication(String authenticationId) Removes access tokens related to authenticationvoidremoveAccessTokenUsingRefreshToken(String refreshTokenId) Removes access tokens related to refresh tokenvoidRemove refresh token with given identifiervoidsaveAccessToken(OAuthAccessTokenModel accessTokenModel) Save access tokensaveAccessToken(String accessTokenId, Object accessToken, String authenticationId, Object authentication, String userName, String clientId, OAuthRefreshTokenModel refreshTokenModel) Saves access token attributes in access token model.
If access token model with given id doesn't exist, new access token model is created.voidsaveRefreshToken(OAuthRefreshTokenModel refreshTokenModel) Save refresh token modelsaveRefreshToken(String refreshTokenId, Object refreshToken, Object authentication) Saves refresh token attributes in refresh token model.
If refresh token model for given id doesn't exist, new refresh token model is created.
-
Method Details
-
getAccessToken
Returns access token for given identifier (key)- Parameters:
id- token identifier- Returns:
- access token with given id
- Throws:
IllegalArgumentException- when 'id' parameter is nullUnknownIdentifierException- when access token with given id doesn't exist
-
saveAccessToken
Save access token- Parameters:
accessTokenModel- Access token model to save
-
saveAccessToken
OAuthAccessTokenModel saveAccessToken(String accessTokenId, Object accessToken, String authenticationId, Object authentication, String userName, String clientId, OAuthRefreshTokenModel refreshTokenModel) Saves access token attributes in access token model.
If access token model with given id doesn't exist, new access token model is created.- Parameters:
accessTokenId- Access token identifieraccessToken- Access token objectauthenticationId- Authentication identifierauthentication- Authentication objectuserName- User nameclientId- Client identifierrefreshTokenModel- Refresh token model belong- Returns:
- Saved access token model
-
removeAccessToken
Remove access token- Parameters:
id- Access token identifier
-
getRefreshToken
Returns refresh token for given identifier (key)- Parameters:
id- refresh token identifier- Returns:
- refresh token with given id
- Throws:
IllegalArgumentException- when 'id' parameter is nullUnknownIdentifierException- when refresh token with given id doesn't exist
-
saveRefreshToken
Save refresh token model- Parameters:
refreshTokenModel- Model to save
-
saveRefreshToken
OAuthRefreshTokenModel saveRefreshToken(String refreshTokenId, Object refreshToken, Object authentication) Saves refresh token attributes in refresh token model.
If refresh token model for given id doesn't exist, new refresh token model is created.- Parameters:
refreshTokenId- Refresh token identifierrefreshToken- Refresh token objectauthentication- Authentication object- Returns:
- Saved refresh token model
-
removeRefreshToken
Remove refresh token with given identifier- Parameters:
id- - refresh token identifier (key)
-
removeAccessTokenUsingRefreshToken
Removes access tokens related to refresh token- Parameters:
refreshTokenId- Refresh token identifier
-
getAccessTokenListForRefreshToken
Returns list of access tokens for refresh token- Parameters:
refreshTokenId- Refresh token identifier- Returns:
- List of access tokens for refresh token or empty list
-
getAccessTokensForClient
Returns access tokens for client- Parameters:
clientId- Client identifier- Returns:
- List of access tokens for client or empty list
-
getAccessTokensForUser
Returns access tokens for user with given user name- Parameters:
userName- User name- Returns:
- List of access tokens for user or empty list
-
getAccessTokenForAuthentication
Returns access token for given authentication- Parameters:
authenticationId- authentication identifier- Returns:
- access token
- Throws:
IllegalArgumentException- when authenticationId is nullUnknownIdentifierException- when there is no access token related to given authenticationAmbiguousIdentifierException- when there is multiple access token related to given authentication
-
removeAccessTokenForAuthentication
Removes access tokens related to authentication- Parameters:
authenticationId- authentication identifier- Throws:
IllegalArgumentException- when authenticationId is null
-
getAccessTokensForClientAndUser
Returns access tokens based on user and client- Parameters:
clientId- Client identifieruserName- User name- Returns:
- List of access tokens or empty list
-