Interface TokenStorage
public interface TokenStorage
Stores a user's or client's access token, refresh token, and the list of sources authorized to
query.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintStores a user's or client's access token.intRemoves tokens associated with the given IDintRemoves tokens associated with the given ID for the specified sourcebooleanisAvailable(String id, String sourceId) Checks if tokens are availableReads tokens associated with the given IDReads tokens associated with the given ID for the specified source
-
Field Details
-
ACCESS_TOKEN
- See Also:
-
REFRESH_TOKEN
- See Also:
-
DISCOVERY_URL
- See Also:
-
EXPIRES_AT
- See Also:
-
CLIENT_ID
- See Also:
-
SECRET
- See Also:
-
SOURCE_ID
- See Also:
-
STATE
- See Also:
-
-
Method Details
-
getStateMap
- Returns:
- a map containing state UUIDs with their corresponding ID, source ID, discovery URL, client ID, and secret information.
-
create
int create(String id, String sourceId, String accessToken, String refreshToken, String discoveryUrl) Stores a user's or client's access token. If it's a new user or client, creates a new entry. Otherwise, updates the existing data.- Parameters:
id- the ID used to store the tokenssourceId- the ID of the source the tokens are going to be used againstaccessToken- the access tokenrefreshToken- the refresh tokendiscoveryUrl- the metadata url of the OAuth provider protecting the source- Returns:
- an HTTP status code
-
read
Reads tokens associated with the given ID- Parameters:
id- the ID used to retrieve tokens- Returns:
- a
TokenInformationfilled with tokens
-
read
Reads tokens associated with the given ID for the specified source- Parameters:
id- the ID used to retrieve tokenssourceId- the source ID the tokens correspond to- Returns:
- a
TokenInformation.TokenEntryfilled with tokens
-
isAvailable
Checks if tokens are available- Parameters:
id- the ID used to check if tokens are availablesourceId- the source ID the tokens correspond to- Returns:
- true if the tokens for the given ID and source are available and false if they are not
-
delete
Removes tokens associated with the given ID- Parameters:
id- the ID associated with the tokens- Returns:
- an HTTP status code
-
delete
Removes tokens associated with the given ID for the specified source- Parameters:
id- the ID associated with the tokenssourceId- the ID for the source the tokens are going to be used against- Returns:
- an HTTP status code
-