Class CMISConnector

  • All Implemented Interfaces:
    org.exoplatform.container.component.ComponentPlugin

    public class CMISConnector
    extends org.exoplatform.services.cms.clouddrives.CloudDriveConnector
    CMIS 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 class  CMISConnector.API
      Internal API builder (logic based on OAuth2 flow used in Google Drive and Box connectors).
      • Nested classes/interfaces inherited from class org.exoplatform.services.cms.clouddrives.CloudDriveConnector

        org.exoplatform.services.cms.clouddrives.CloudDriveConnector.PredefinedServices
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static String CONFIG_PREDEFINED
      The 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
      • Fields inherited from class org.exoplatform.container.component.BaseComponentPlugin

        desc, name
    • 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.
    • Field Detail

    • 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.ConfigurationException
        Instantiates a new CMIS connector.
        Parameters:
        jcrService - the jcr service
        sessionProviders - the session providers
        finder - the finder
        mimeTypes - the mime types
        params - the params
        codeAuth - the code auth
        Throws:
        org.exoplatform.services.cms.clouddrives.ConfigurationException - the configuration exception
    • Method Detail

      • getProvider

        protected CMISProvider getProvider()
        Overrides:
        getProvider in class org.exoplatform.services.cms.clouddrives.CloudDriveConnector
      • createProvider

        protected org.exoplatform.services.cms.clouddrives.CloudProvider createProvider()
                                                                                 throws org.exoplatform.services.cms.clouddrives.ConfigurationException
        Specified by:
        createProvider in class org.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 return CMISUser instance. 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 and CMISUser instance 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 with CloudDriveException.
        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:
        authenticate in class org.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:
        createDrive in class org.exoplatform.services.cms.clouddrives.CloudDriveConnector
        Throws:
        org.exoplatform.services.cms.clouddrives.CloudDriveException
        javax.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:
        loadDrive in class org.exoplatform.services.cms.clouddrives.CloudDriveConnector
        Throws:
        org.exoplatform.services.cms.clouddrives.DriveRemovedException
        org.exoplatform.services.cms.clouddrives.CloudDriveException
        javax.jcr.RepositoryException
      • exoURL

        protected String exoURL()
        Exo URL.
        Returns:
        the string
      • 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