public interface OAuth2Store
OAuth2Token may be store in memory or pesisted out to a file system or
database.
OAuth2Store implementors are responsible for handling the gadgeturi, serviceName, user, scope
mappings in the manor most effective for their environment.
OAuth2Accessor storage should be cluster safe so it can be referenced by
OAuth2CallbackServlet| Modifier and Type | Method and Description |
|---|---|
void |
clearAccessorCache()
Clears all currently cached
OAuth2Accessors. |
boolean |
clearCache()
Clears any in-memory caching of OAuth2Accessors or Tokens.
|
void |
clearClientCache()
Clears all currently cache
OAuth2Clients. |
void |
clearTokenCache()
Clears all currently cached
OAuth2Tokens. |
OAuth2Token |
createToken()
Creates, but does not store, an
OAuth2Token. |
OAuth2Accessor |
getOAuth2Accessor(OAuth2CallbackState state)
Given an OAuth2CallbackState, see
OAuth2Store.getOAuth2CallbackState, the store will
return the OAuth2Accessor if it exists in storage but will not create a new one. |
OAuth2Accessor |
getOAuth2Accessor(String gadgetUri,
String serviceName,
String user,
String scope)
Will look for an accessor with the supplied mapping and return it.
|
BlobCrypter |
getStateCrypter()
Gets the OAuth2 state encrypter/decrypter
|
OAuth2Token |
getToken(String gadgetUri,
String serviceName,
String user,
String scope,
OAuth2Token.Type type)
Gets a token, if it exists, from the store.
|
boolean |
init()
Cues the store to clear it's current state and reload from persistence.
|
OAuth2Client |
invalidateClient(OAuth2Client client)
Invalidate a cached client and force it to be reloaded from persistence.
|
OAuth2Token |
invalidateToken(OAuth2Token token)
Invalidate a cached token and force it to be reloaded from persistence.
|
OAuth2Accessor |
removeOAuth2Accessor(OAuth2Accessor accessor)
Removes an
OAuth2Accessor from the store. |
OAuth2Token |
removeToken(OAuth2Token token)
Removes an
OAuth2Token from the store. |
void |
setToken(OAuth2Token token)
Either inserts updates an
OAuth2Token in the store. |
void |
storeOAuth2Accessor(OAuth2Accessor accessor)
Either inserts updates an
OAuth2Accessor in the store. |
boolean clearCache()
throws GadgetException
true if the clear succeededGadgetException - if the clear could not happenOAuth2Token createToken()
OAuth2Token. The token can then be initialized and
stored.OAuth2TokenOAuth2Accessor getOAuth2Accessor(OAuth2CallbackState state)
OAuth2Store.getOAuth2CallbackState, the store will
return the OAuth2Accessor if it exists in storage but will not create a new one.state - OAuth2CallbackState index of the accessor to getOAuth2Accessor or null if it cannot be locatedOAuth2Accessor getOAuth2Accessor(String gadgetUri, String serviceName, String user, String scope) throws GadgetException
gadgetUri - String URI of the gadget issuing the requestserviceName - String name of the OAuth2 service from the gadget specuser - user userid of the page viewerscope - String optional scope of the request. Supplied by the request or the gadget
specOAuth2Accessor , never nullGadgetException - if a lookup or creation error occursBlobCrypter getStateCrypter()
OAuth2Token getToken(String gadgetUri, String serviceName, String user, String scope, OAuth2Token.Type type) throws GadgetException
gadgetUri - String URI of the gadget issuing the requestserviceName - String name of the OAuth2 service from the gadget specuser - user userid of the page viewerscope - String optional scope of the request. Supplied by the request or the gadget
spectype - Type if the token, ACCESS or REFRESHOAuth2Token for the supplied mapping, null if it isn't storedGadgetException - if something goes wrongboolean init()
throws GadgetException
GadgetExceptionOAuth2Accessor removeOAuth2Accessor(OAuth2Accessor accessor)
OAuth2Accessor from the store.accessor - to removenull if the accessor was already removedOAuth2Token removeToken(OAuth2Token token) throws GadgetException
OAuth2Token from the store.token - to removenull if the token was already removed\GadgetException - if something goes wrongvoid setToken(OAuth2Token token) throws GadgetException
OAuth2Token in the store.token - to storeGadgetException - if something goes wrongvoid storeOAuth2Accessor(OAuth2Accessor accessor)
OAuth2Accessor in the store.accessor - to storeOAuth2Client invalidateClient(OAuth2Client client)
client - to be invalidatednull> if client could not be foundOAuth2Token invalidateToken(OAuth2Token token)
token - to be invalidatednull if token could not be foundvoid clearAccessorCache()
throws GadgetException
OAuth2Accessors.GadgetExceptionvoid clearTokenCache()
throws GadgetException
OAuth2Tokens. Does not remove them from persistence.GadgetExceptionvoid clearClientCache()
throws GadgetException
OAuth2Clients. Does not remove the from persistence.GadgetExceptionCopyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.