Package org.exoplatform.clouddrive.cmis
Class CMISConnector
- java.lang.Object
-
- org.exoplatform.container.component.BaseComponentPlugin
-
- org.exoplatform.services.cms.clouddrives.CloudDriveConnector
-
- org.exoplatform.clouddrive.cmis.CMISConnector
-
- All Implemented Interfaces:
org.exoplatform.container.component.ComponentPlugin
public class CMISConnector extends org.exoplatform.services.cms.clouddrives.CloudDriveConnectorCMIS Connector.
Created by The eXo Platform SAS- Version:
- $Id: CMISConnector.java 00000 Aug 30, 2013 pnedonosko $
- Author:
- Peter Nedonosko
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classCMISConnector.APIInternal API builder (logic based on OAuth2 flow used in Google Drive and Box connectors).
-
Field Summary
Fields Modifier and Type Field Description protected static StringCONFIG_PREDEFINEDThe Constant CONFIG_PREDEFINED.-
Fields inherited from class org.exoplatform.services.cms.clouddrives.CloudDriveConnector
config, CONFIG_CONNECTOR_HOST, CONFIG_CONNECTOR_SCHEMA, CONFIG_DISABLE, CONFIG_LOGIN_SSO, CONFIG_PREDEFINED_SERVICES, CONFIG_PROVIDER_CLIENT_ID, CONFIG_PROVIDER_CLIENT_SECRET, CONFIG_PROVIDER_ID, CONFIG_PROVIDER_NAME, connectorHost, connectorSchema, jcrFinder, jcrService, LOG, loginSSO, mimeTypes, OAUTH2_CODE, OAUTH2_ERROR, OAUTH2_ERROR_DESCRIPTION, OAUTH2_SERVER_URL, OAUTH2_STATE, predefinedServices, provider, PROVIDER_REQUEST_ATTEMPT_TIMEOUT, PROVIDER_REQUEST_ATTEMPTS, sessionProviders
-
-
Constructor Summary
Constructors Constructor Description CMISConnector(org.exoplatform.services.jcr.RepositoryService jcrService, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.cms.clouddrives.jcr.NodeFinder finder, org.exoplatform.services.cms.clouddrives.utils.ExtendedMimeTypeResolver mimeTypes, org.exoplatform.container.xml.InitParams params, CodeAuthentication codeAuth)Instantiates a new CMIS connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CMISUserauthenticate(Map<String,String> params)Authenticate an user by OAuth2 code (from params) and returnCMISUserinstance.protected CMISAPIcreateAPI(CodeAuthentication.Identity userId)CreateCMISAPIinstance.protected org.exoplatform.services.cms.clouddrives.CloudDrivecreateDrive(org.exoplatform.services.cms.clouddrives.CloudUser user, javax.jcr.Node driveNode)protected org.exoplatform.services.cms.clouddrives.CloudProvidercreateProvider()protected CMISUsercreateUser(CodeAuthentication.Identity userId)protected StringexoURL()Exo URL.protected StringgetAuthProviderId()Provider id that should be used in authentication URL of the provider.protected CMISProvidergetProvider()protected org.exoplatform.services.cms.clouddrives.CloudDriveloadDrive(javax.jcr.Node driveNode)-
Methods inherited from class org.exoplatform.services.cms.clouddrives.CloudDriveConnector
currentUser, getClientId, getClientSecret, getConnectorHost, getConnectorSchema, getProviderId, getProviderName, isDisabled, redirectLink, sessionProvider
-
-
-
-
Field Detail
-
CONFIG_PREDEFINED
protected static final String CONFIG_PREDEFINED
The Constant CONFIG_PREDEFINED.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CMISConnector
public CMISConnector(org.exoplatform.services.jcr.RepositoryService jcrService, org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviders, org.exoplatform.services.cms.clouddrives.jcr.NodeFinder finder, org.exoplatform.services.cms.clouddrives.utils.ExtendedMimeTypeResolver mimeTypes, org.exoplatform.container.xml.InitParams params, CodeAuthentication codeAuth) throws org.exoplatform.services.cms.clouddrives.ConfigurationExceptionInstantiates a new CMIS connector.- Parameters:
jcrService- the jcr servicesessionProviders- the session providersfinder- the findermimeTypes- the mime typesparams- the paramscodeAuth- the code auth- Throws:
org.exoplatform.services.cms.clouddrives.ConfigurationException- the configuration exception
-
-
Method Detail
-
getProvider
protected CMISProvider getProvider()
- Overrides:
getProviderin classorg.exoplatform.services.cms.clouddrives.CloudDriveConnector
-
createProvider
protected org.exoplatform.services.cms.clouddrives.CloudProvider createProvider() throws org.exoplatform.services.cms.clouddrives.ConfigurationException- Specified by:
createProviderin classorg.exoplatform.services.cms.clouddrives.CloudDriveConnector- Throws:
org.exoplatform.services.cms.clouddrives.ConfigurationException
-
authenticate
protected CMISUser authenticate(Map<String,String> params) throws org.exoplatform.services.cms.clouddrives.CloudDriveException
Authenticate an user by OAuth2 code (from params) and returnCMISUserinstance. CMIS connector requires custom two step authentication instead of OAuth2 flow. This two-step flow is similar to OAuth2 where user does authentication to the service and then authorizes via OAuth2 protocol. This is done to support other parts of Cloud Drive add-on.
On first call of this method (first step), given code will be exchanged on user identity andCMISUserinstance will be created. This user instance will be stored in the connector mapped by the code. At the same time the user identity should be late initialized with a context (CMIS repository to connect by the user). If the identity will not be initialized before a second call (second step), this method will fail withCloudDriveException.
CMIS connector doesn't manage the user identity initialization or any other extra steps. This should be done outside this connector (e.g. via dedicated authenticator).
CMIS connector will detect if dedicated connector available for given service and then will return user instance initialized by that connector.- Specified by:
authenticatein classorg.exoplatform.services.cms.clouddrives.CloudDriveConnector- Parameters:
params- the params- Returns:
CMISUser- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
createDrive
protected org.exoplatform.services.cms.clouddrives.CloudDrive createDrive(org.exoplatform.services.cms.clouddrives.CloudUser user, javax.jcr.Node driveNode) throws org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException- Specified by:
createDrivein classorg.exoplatform.services.cms.clouddrives.CloudDriveConnector- Throws:
org.exoplatform.services.cms.clouddrives.CloudDriveExceptionjavax.jcr.RepositoryException
-
loadDrive
protected org.exoplatform.services.cms.clouddrives.CloudDrive loadDrive(javax.jcr.Node driveNode) throws org.exoplatform.services.cms.clouddrives.DriveRemovedException, org.exoplatform.services.cms.clouddrives.CloudDriveException, javax.jcr.RepositoryException- Specified by:
loadDrivein classorg.exoplatform.services.cms.clouddrives.CloudDriveConnector- Throws:
org.exoplatform.services.cms.clouddrives.DriveRemovedExceptionorg.exoplatform.services.cms.clouddrives.CloudDriveExceptionjavax.jcr.RepositoryException
-
exoURL
protected String exoURL()
Exo URL.- Returns:
- the string
-
createAPI
protected CMISAPI createAPI(CodeAuthentication.Identity userId) throws CMISException, org.exoplatform.services.cms.clouddrives.CloudDriveException
CreateCMISAPIinstance.- Parameters:
userId-CodeAuthentication.Identity- Returns:
CMISAPIinstance- Throws:
CMISException- the CMIS exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
createUser
protected CMISUser createUser(CodeAuthentication.Identity userId) throws CMISException, org.exoplatform.services.cms.clouddrives.CloudDriveException
- Parameters:
userId-CodeAuthentication.Identity- Returns:
CMISUser- Throws:
CMISException- the CMIS exceptionorg.exoplatform.services.cms.clouddrives.CloudDriveException- the cloud drive exception
-
getAuthProviderId
protected String getAuthProviderId() throws org.exoplatform.services.cms.clouddrives.ConfigurationException
Provider id that should be used in authentication URL of the provider. In case of dedicated connector based on CMIS this method may return 'cmis' id to use default authentication flow for CMIS services.- Returns:
String- Throws:
org.exoplatform.services.cms.clouddrives.ConfigurationException- if provider id cannot be determined for this connector authentication flow
-
-