Class OAuthCMISAuthenticationProvider

  • All Implemented Interfaces:
    Serializable, org.apache.chemistry.opencmis.client.bindings.spi.SessionAwareAuthenticationProvider, org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider

    public class OAuthCMISAuthenticationProvider
    extends org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
    An OpenCMIS OAuth authentication provider. Example connection parameters: org.apache.chemistry.opencmis.binding.spi.type=atompub org.apache.chemistry.opencmis.binding.atompub.url=https://api.alfresco.com/cmis/versions/1.0/atom org.apache.chemistry.opencmis.binding.auth.classname=org.alfresco.cmis.client.authentication.OAuthCMISAuthenticationProvider org.apache.chemistry.opencmis.binding.auth.http.basic=false org.apache.chemistry.opencmis.binding.auth.oauth.accessToken=<access token> org.apache.chemistry.opencmis.binding.compression=true
    Author:
    steveglover
    See Also:
    Serialized Form
    • Constructor Detail

      • OAuthCMISAuthenticationProvider

        public OAuthCMISAuthenticationProvider()
      • OAuthCMISAuthenticationProvider

        public OAuthCMISAuthenticationProvider​(String accessToken)
        Authenticates with the Alfresco CMIS Public Api with a previously-generated access token (no refresh token support).
        Parameters:
        accessToken - The access token
      • OAuthCMISAuthenticationProvider

        public OAuthCMISAuthenticationProvider​(String clientId,
                                               String clientSecret,
                                               String redirectUrl,
                                               String accessTokenUrl,
                                               String refreshTokenUrl,
                                               String authCode)
        Authenticates with the Alfresco CMIS Public Api by generating an access token to communicate with the public api. Refresh support is provided.
        Parameters:
        clientId - Client ID
        clientSecret - secret
        redirectUrl - redirect URL
        accessTokenUrl - access token URL
        refreshTokenUrl - refresh token URL
        authCode - Authcode
    • Method Detail

      • setSession

        public void setSession​(org.apache.chemistry.opencmis.client.bindings.spi.BindingSession session)
        Specified by:
        setSession in interface org.apache.chemistry.opencmis.client.bindings.spi.SessionAwareAuthenticationProvider
        Overrides:
        setSession in class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
      • getHTTPHeaders

        public Map<String,​List<String>> getHTTPHeaders​(String url)
        Specified by:
        getHTTPHeaders in interface org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider
        Overrides:
        getHTTPHeaders in class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
      • putResponseHeaders

        public void putResponseHeaders​(String url,
                                       int statusCode,
                                       Map<String,​List<String>> headers)
        Specified by:
        putResponseHeaders in interface org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider
        Overrides:
        putResponseHeaders in class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
      • getSOAPHeaders

        public Element getSOAPHeaders​(Object portObject)
        Specified by:
        getSOAPHeaders in interface org.apache.chemistry.opencmis.commons.spi.AuthenticationProvider
        Overrides:
        getSOAPHeaders in class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
      • getFixedHeaders

        protected Map<String,​List<String>> getFixedHeaders()
        Returns the HTTP headers that are sent with all requests. The returned map is mutable but not synchronized!
        Returns:
        fixedHeaders
      • createBasicAuthHeaderValue

        protected List<String> createBasicAuthHeaderValue​(String username,
                                                          String password)
        Creates a basic authentication header value from a username and a password.
        Parameters:
        username - username
        password - password
        Returns:
        List<String>
      • isTrue

        protected boolean isTrue​(String parameterName)
        Returns true if the given parameter exists in the session and is set to true, false otherwise.
        Parameters:
        parameterName - Parameter name
        Returns:
        True/False