Interface RemoteAPITokenService
-
- All Known Implementing Classes:
RemoteAPITokenServiceImpl
public interface RemoteAPITokenService
Service for saving and reading tokens for Remote APIs
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RemoteAPIToken
create(RemoteAPIToken token)
Add a token to the store for a given serviceRemoteAPIToken
createTokenFromAuthCode(java.lang.String authcode, RemoteAPI remoteAPI, java.lang.String tokenRedirect)
Create a newRemoteAPIToken
from a given auth codevoid
delete(RemoteAPI remoteAPI)
Delete a token for the logged in user and a givenRemoteAPI
RemoteAPIToken
getToken(RemoteAPI remoteAPI)
Get a token for a given serviceRemoteAPIToken
updateTokenFromRefreshToken(RemoteAPI api)
Update a givenRemoteAPI
's OAuth token by refresh token if available
-
-
-
Method Detail
-
create
RemoteAPIToken create(RemoteAPIToken token)
Add a token to the store for a given service- Parameters:
token
- The token to create- Returns:
- the created token
-
getToken
RemoteAPIToken getToken(RemoteAPI remoteAPI) throws EntityNotFoundException
Get a token for a given service- Parameters:
remoteAPI
- TheRemoteAPI
of the service root- Returns:
- A String OAuth2 token
- Throws:
EntityNotFoundException
- if the token could not be found
-
delete
void delete(RemoteAPI remoteAPI) throws EntityNotFoundException
Delete a token for the logged in user and a givenRemoteAPI
- Parameters:
remoteAPI
- theRemoteAPI
to delete a token for- Throws:
EntityNotFoundException
- if the token could not be found
-
createTokenFromAuthCode
RemoteAPIToken createTokenFromAuthCode(java.lang.String authcode, RemoteAPI remoteAPI, java.lang.String tokenRedirect) throws org.apache.oltu.oauth2.common.exception.OAuthSystemException, org.apache.oltu.oauth2.common.exception.OAuthProblemException
Create a newRemoteAPIToken
from a given auth code- Parameters:
authcode
- the auth code to create a token forremoteAPI
- the remote api to get a token fortokenRedirect
- a redirect url to get the token from- Returns:
- the newly created token
- Throws:
org.apache.oltu.oauth2.common.exception.OAuthSystemException
- If ther's a problem building the token requestorg.apache.oltu.oauth2.common.exception.OAuthProblemException
- If there's a problem with the token request
-
updateTokenFromRefreshToken
RemoteAPIToken updateTokenFromRefreshToken(RemoteAPI api)
Update a givenRemoteAPI
's OAuth token by refresh token if available- Parameters:
api
- the API to update- Returns:
- the most recent token if available
-
-