Interface ITokenService
- All Known Implementing Classes:
TokenService
public interface ITokenService
The ITokenService interface defines the functionality provided by a Token Service
implementation, which manages the OAuth2 tokens for an application.
- Author:
- Marcus Portmann
-
Method Summary
Modifier and TypeMethodDescriptionissueOAuth2AccessToken(String username, Set<String> scopes) Issue an OAuth2 access token for the specified user.issueOAuth2RefreshToken(String username, Set<String> scopes) Issue an OAuth2 refresh token for the specified user.refreshOAuth2Tokens(String encodedOAuth2RefreshToken) Refresh an OAuth2 access token and if required the OAuth2 refresh token.
-
Method Details
-
issueOAuth2AccessToken
OAuth2AccessToken issueOAuth2AccessToken(String username, Set<String> scopes) throws ServiceUnavailableException Issue an OAuth2 access token for the specified user.- Parameters:
username- the username for the userscopes- the optional scope(s) for the access token- Returns:
- the OAuth2 access token
- Throws:
ServiceUnavailableException- if the OAuth2 access token could not be issued for the user
-
issueOAuth2RefreshToken
OAuth2RefreshToken issueOAuth2RefreshToken(String username, Set<String> scopes) throws ServiceUnavailableException Issue an OAuth2 refresh token for the specified user.- Parameters:
username- the username for the userscopes- the optional scope(s) for the refresh token- Returns:
- the OAuth2 refresh token
- Throws:
ServiceUnavailableException- if the OAuth2 refresh token could not be issued for the user
-
refreshOAuth2Tokens
RefreshedOAuth2Tokens refreshOAuth2Tokens(String encodedOAuth2RefreshToken) throws InvalidOAuth2RefreshTokenException, ServiceUnavailableException Refresh an OAuth2 access token and if required the OAuth2 refresh token.- Parameters:
encodedOAuth2RefreshToken- the encoded OAuth2 refresh token- Returns:
- the refreshed tokens
- Throws:
InvalidOAuth2RefreshTokenException- if the OAuth2 refresh token is invalidServiceUnavailableException- if the OAuth2 access token and refresh token could not be refreshed
-