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 String
DIRECTORY_NAME
protected static Log
log
protected 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 OAuthToken
addVerifierToRequestToken(String token, Long duration)
Generates a verification code and attache it to the REQUEST Token.OAuthToken
createAccessTokenFromRequestToken(OAuthToken requestToken)
Exchanges the REQUEST Token witha Real ACCESS Token (persistent) Token/TocketSecret Strings are regerated during the exchange.OAuthToken
createRequestToken(String consumerKey, String callBack)
Creates a new REQUEST Token (transient)OAuthToken
getAccessToken(String token)
Retrieves an ACCESS from the store.NuxeoOAuthToken
getClientAccessToken(String appId, String owner)
Get a Access token for the Shindig Client.OAuthToken
getRequestToken(String token)
Retrieves a REQUEST Token given a Token string (extracted from the Request).protected NuxeoOAuthToken
getTokenFromDirectory(String token)
protected NuxeoOAuthToken
getTokenFromDirectoryEntry(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.void
removeAccessToken(String token)
Deletes an ACCESS Token from the storage.void
removeClientAccessToken(String appId, String owner)
Deletes a Client side Access Token.void
removeRequestToken(String token)
Deletes a REQUEST Token.protected NuxeoOAuthToken
storeAccessTokenAsDirectoryEntry(NuxeoOAuthToken aToken)
void
storeClientAccessToken(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:OAuthTokenStore
Generates a verification code and attache it to the REQUEST Token.- Specified by:
addVerifierToRequestToken
in interfaceOAuthTokenStore
-
createAccessTokenFromRequestToken
public OAuthToken createAccessTokenFromRequestToken(OAuthToken requestToken)
Description copied from interface:OAuthTokenStore
Exchanges the REQUEST Token witha Real ACCESS Token (persistent) Token/TocketSecret Strings are regerated during the exchange.- Specified by:
createAccessTokenFromRequestToken
in interfaceOAuthTokenStore
-
getClientAccessToken
public NuxeoOAuthToken getClientAccessToken(String appId, String owner)
Description copied from interface:OAuthTokenStore
Get a Access token for the Shindig Client.- Specified by:
getClientAccessToken
in interfaceOAuthTokenStore
-
removeClientAccessToken
public void removeClientAccessToken(String appId, String owner)
Description copied from interface:OAuthTokenStore
Deletes a Client side Access Token.- Specified by:
removeClientAccessToken
in interfaceOAuthTokenStore
-
storeClientAccessToken
public void storeClientAccessToken(String consumerKey, String callBack, String token, String tokenSecret, String appId, String owner)
Description copied from interface:OAuthTokenStore
Stores a Access token generated fro Shindig client.- Specified by:
storeClientAccessToken
in 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:OAuthTokenStore
Creates a new REQUEST Token (transient)- Specified by:
createRequestToken
in interfaceOAuthTokenStore
-
getAccessToken
public OAuthToken getAccessToken(String token)
Description copied from interface:OAuthTokenStore
Retrieves an ACCESS from the store.- Specified by:
getAccessToken
in interfaceOAuthTokenStore
-
getRequestToken
public OAuthToken getRequestToken(String token)
Description copied from interface:OAuthTokenStore
Retrieves a REQUEST Token given a Token string (extracted from the Request).- Specified by:
getRequestToken
in interfaceOAuthTokenStore
-
listAccessTokenForConsumer
public List<OAuthToken> listAccessTokenForConsumer(String consumerKey)
Description copied from interface:OAuthTokenStore
Lists ACCESS Token associated to a Consumer application.- Specified by:
listAccessTokenForConsumer
in interfaceOAuthTokenStore
-
listAccessTokenForUser
public List<OAuthToken> listAccessTokenForUser(String login)
Description copied from interface:OAuthTokenStore
Lists ACCESS Token associated to a User.- Specified by:
listAccessTokenForUser
in interfaceOAuthTokenStore
-
removeAccessToken
public void removeAccessToken(String token)
Description copied from interface:OAuthTokenStore
Deletes an ACCESS Token from the storage.- Specified by:
removeAccessToken
in interfaceOAuthTokenStore
-
removeRequestToken
public void removeRequestToken(String token)
Description copied from interface:OAuthTokenStore
Deletes a REQUEST Token.- Specified by:
removeRequestToken
in interfaceOAuthTokenStore
-
-