Class OAuthTokenStoreImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.DefaultComponent
-
- org.nuxeo.ecm.platform.oauth.tokens.OAuthTokenStoreImpl
-
- All Implemented Interfaces:
OAuthTokenStore,Adaptable,Component,Extensible,TimestampedService
public class OAuthTokenStoreImpl extends DefaultComponent implements OAuthTokenStore
Service implementation forOAuthTokenStore.This service is responsible for managing storage of the
OAuthToken. A simple SQL Directory is used for ACCESS Token whereas a simple in memory storage is used for REQUEST Tokens.- Author:
- tiry
-
-
Field Summary
Fields Modifier and Type Field Description static StringDIRECTORY_NAMEprotected static Loglogprotected Map<String,OAuthToken>requestTokenStore-
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
-
Constructor Summary
Constructors Constructor Description OAuthTokenStoreImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuthTokenaddVerifierToRequestToken(String token, Long duration)Generates a verification code and attache it to the REQUEST Token.OAuthTokencreateAccessTokenFromRequestToken(OAuthToken requestToken)Exchanges the REQUEST Token witha Real ACCESS Token (persistent) Token/TocketSecret Strings are regerated during the exchange.OAuthTokencreateRequestToken(String consumerKey, String callBack)Creates a new REQUEST Token (transient)OAuthTokengetAccessToken(String token)Retrieves an ACCESS from the store.NuxeoOAuthTokengetClientAccessToken(String appId, String owner)Get a Access token for the Shindig Client.OAuthTokengetRequestToken(String token)Retrieves a REQUEST Token given a Token string (extracted from the Request).protected NuxeoOAuthTokengetTokenFromDirectory(String token)protected NuxeoOAuthTokengetTokenFromDirectoryEntry(DocumentModel entry)List<OAuthToken>listAccessTokenForConsumer(String consumerKey)Lists ACCESS Token associated to a Consumer application.List<OAuthToken>listAccessTokenForUser(String login)Lists ACCESS Token associated to a User.voidremoveAccessToken(String token)Deletes an ACCESS Token from the storage.voidremoveClientAccessToken(String appId, String owner)Deletes a Client side Access Token.voidremoveRequestToken(String token)Deletes a REQUEST Token.protected NuxeoOAuthTokenstoreAccessTokenAsDirectoryEntry(NuxeoOAuthToken aToken)voidstoreClientAccessToken(String consumerKey, String callBack, String token, String tokenSecret, String appId, String owner)Stores a Access token generated fro Shindig client.-
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtension
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.runtime.model.Component
applicationStarted, getApplicationStartedOrder
-
-
-
-
Field Detail
-
DIRECTORY_NAME
public static final String DIRECTORY_NAME
- See Also:
- Constant Field Values
-
requestTokenStore
protected Map<String,OAuthToken> requestTokenStore
-
-
Constructor Detail
-
OAuthTokenStoreImpl
public OAuthTokenStoreImpl()
-
-
Method Detail
-
addVerifierToRequestToken
public OAuthToken addVerifierToRequestToken(String token, Long duration)
Description copied from interface:OAuthTokenStoreGenerates a verification code and attache it to the REQUEST Token.- Specified by:
addVerifierToRequestTokenin interfaceOAuthTokenStore
-
createAccessTokenFromRequestToken
public OAuthToken createAccessTokenFromRequestToken(OAuthToken requestToken)
Description copied from interface:OAuthTokenStoreExchanges the REQUEST Token witha Real ACCESS Token (persistent) Token/TocketSecret Strings are regerated during the exchange.- Specified by:
createAccessTokenFromRequestTokenin interfaceOAuthTokenStore
-
getClientAccessToken
public NuxeoOAuthToken getClientAccessToken(String appId, String owner)
Description copied from interface:OAuthTokenStoreGet a Access token for the Shindig Client.- Specified by:
getClientAccessTokenin interfaceOAuthTokenStore
-
removeClientAccessToken
public void removeClientAccessToken(String appId, String owner)
Description copied from interface:OAuthTokenStoreDeletes a Client side Access Token.- Specified by:
removeClientAccessTokenin interfaceOAuthTokenStore
-
storeClientAccessToken
public void storeClientAccessToken(String consumerKey, String callBack, String token, String tokenSecret, String appId, String owner)
Description copied from interface:OAuthTokenStoreStores a Access token generated fro Shindig client.- Specified by:
storeClientAccessTokenin interfaceOAuthTokenStore
-
getTokenFromDirectory
protected NuxeoOAuthToken getTokenFromDirectory(String token)
-
getTokenFromDirectoryEntry
protected NuxeoOAuthToken getTokenFromDirectoryEntry(DocumentModel entry)
-
storeAccessTokenAsDirectoryEntry
protected NuxeoOAuthToken storeAccessTokenAsDirectoryEntry(NuxeoOAuthToken aToken)
-
createRequestToken
public OAuthToken createRequestToken(String consumerKey, String callBack)
Description copied from interface:OAuthTokenStoreCreates a new REQUEST Token (transient)- Specified by:
createRequestTokenin interfaceOAuthTokenStore
-
getAccessToken
public OAuthToken getAccessToken(String token)
Description copied from interface:OAuthTokenStoreRetrieves an ACCESS from the store.- Specified by:
getAccessTokenin interfaceOAuthTokenStore
-
getRequestToken
public OAuthToken getRequestToken(String token)
Description copied from interface:OAuthTokenStoreRetrieves a REQUEST Token given a Token string (extracted from the Request).- Specified by:
getRequestTokenin interfaceOAuthTokenStore
-
listAccessTokenForConsumer
public List<OAuthToken> listAccessTokenForConsumer(String consumerKey)
Description copied from interface:OAuthTokenStoreLists ACCESS Token associated to a Consumer application.- Specified by:
listAccessTokenForConsumerin interfaceOAuthTokenStore
-
listAccessTokenForUser
public List<OAuthToken> listAccessTokenForUser(String login)
Description copied from interface:OAuthTokenStoreLists ACCESS Token associated to a User.- Specified by:
listAccessTokenForUserin interfaceOAuthTokenStore
-
removeAccessToken
public void removeAccessToken(String token)
Description copied from interface:OAuthTokenStoreDeletes an ACCESS Token from the storage.- Specified by:
removeAccessTokenin interfaceOAuthTokenStore
-
removeRequestToken
public void removeRequestToken(String token)
Description copied from interface:OAuthTokenStoreDeletes a REQUEST Token.- Specified by:
removeRequestTokenin interfaceOAuthTokenStore
-
-