public abstract class AbstractSyncOAuth2TokenStorage extends java.lang.Object implements OAuth2TokenStorage
OAuth2TokenStorage
which can be used in case the token storage can be implemented synchronously. As
this is the case most of the time, application developers are recommended to use this class as a base instead of trying to implement OAuth2TokenStorage
directly.
All the methods of the OAuth2TokenStorage
interface have their synchronous counterparts in the form of protected methods starting with the
prefix do*
. Consult the documentation of these methods for the details.
Constructor and Description |
---|
AbstractSyncOAuth2TokenStorage() |
Modifier and Type | Method and Description |
---|---|
protected abstract OAuth2TokenWrapper |
doGetTokenForKey(java.lang.String tokenStorageKey)
Performs the same operation as
tokensForKey(String) but does it synchronously. |
protected abstract boolean |
doRemoveAllTokens()
Performs the same operation as
removeAllTokens() but does it synchronously. |
protected abstract boolean |
doSaveTokens(java.lang.String tokenStorageKey,
OAuth2TokenWrapper tokens)
Performs the same operation as
saveTokens(String, OAuth2TokenWrapper) but does it synchronously. |
java.util.concurrent.Future<java.lang.Boolean> |
removeAllTokens()
Deletes all the tokens in this storage.
|
java.util.concurrent.Future<java.lang.Boolean> |
saveTokens(java.lang.String tokenStorageKey,
OAuth2TokenWrapper tokens)
Saves the tokens carried by the specified wrapper for the given opaque token storage key.
|
java.util.concurrent.Future<OAuth2TokenWrapper> |
tokensForKey(java.lang.String tokenStorageKey)
Returns the token wrapper object for the specified opaque token storage key.
|
public java.util.concurrent.Future<OAuth2TokenWrapper> tokensForKey(java.lang.String tokenStorageKey)
OAuth2TokenStorage
tokensForKey
in interface OAuth2TokenStorage
tokenStorageKey
- the opaque token storage key to return the tokens for, must be non-nullpublic java.util.concurrent.Future<java.lang.Boolean> saveTokens(java.lang.String tokenStorageKey, OAuth2TokenWrapper tokens)
OAuth2TokenStorage
tokens
argument is null then the
tokens are deleted for the given key.saveTokens
in interface OAuth2TokenStorage
tokenStorageKey
- the opaque token storage key to save the tokens for, must be non-nulltokens
- the token wrapper whose contents are to be saved, can be nullpublic java.util.concurrent.Future<java.lang.Boolean> removeAllTokens()
OAuth2TokenStorage
removeAllTokens
in interface OAuth2TokenStorage
protected abstract OAuth2TokenWrapper doGetTokenForKey(java.lang.String tokenStorageKey)
tokensForKey(String)
but does it synchronously. This method is called exclusively by tokensForKey(String)
.tokenStorageKey
- the token storage key, must be non-nullprotected abstract boolean doSaveTokens(java.lang.String tokenStorageKey, OAuth2TokenWrapper tokens)
saveTokens(String, OAuth2TokenWrapper)
but does it synchronously. This method is called exclusively by
saveTokens(String, OAuth2TokenWrapper)
.tokenStorageKey
- the token storage key, must be non-nulltokens
- the token object to save or null to remove the tokens for the given keyprotected abstract boolean doRemoveAllTokens()
removeAllTokens()
but does it synchronously. This method is called exclusively by removeAllTokens()
.