org.alfresco.cmis.client.authentication
Class OAuthCMISAuthenticationProvider

java.lang.Object
  extended by org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
      extended by org.alfresco.cmis.client.authentication.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= org.apache.chemistry.opencmis.binding.compression=true

Author:
steveglover
See Also:
Serialized Form

Nested Class Summary
static class OAuthCMISAuthenticationProvider.AccessToken
           
 
Field Summary
static String ALFRESCO_ACCESS_TOKEN_URL
           
static String ALFRESCO_REFRESH_TOKEN_URL
           
static String PARAM_ACCESS_TOKEN
           
 
Constructor Summary
OAuthCMISAuthenticationProvider()
           
OAuthCMISAuthenticationProvider(String accessToken)
          Authenticates with the Alfresco CMIS Public Api with a previously-generated access token (no refresh token support).
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.
 
Method Summary
static OAuthCMISAuthenticationProvider alfrescoOAuthProvider(String accessToken)
           
static OAuthCMISAuthenticationProvider alfrescoOAuthProvider(String clientId, String clientSecret, String redirectUrl, String authCode)
           
protected  List<String> createBasicAuthHeaderValue(String username, String password)
          Creates a basic authentication header value from a username and a password.
 OAuthCMISAuthenticationProvider.AccessToken getAccessTokenData()
           
protected  Map<String,List<String>> getFixedHeaders()
          Returns the HTTP headers that are sent with all requests.
 Map<String,List<String>> getHTTPHeaders(String url)
           
 Element getSOAPHeaders(Object portObject)
           
protected  boolean isTrue(String parameterName)
          Returns true if the given parameter exists in the session and is set to true, false otherwise.
 void putResponseHeaders(String url, int statusCode, Map<String,List<String>> headers)
           
 void setSession(org.apache.chemistry.opencmis.client.bindings.spi.BindingSession session)
           
 
Methods inherited from class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
getHandlerResolver, getHostnameVerifier, getPassword, getProxyPassword, getProxyUser, getSession, getSSLSocketFactory, getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALFRESCO_ACCESS_TOKEN_URL

public static final String ALFRESCO_ACCESS_TOKEN_URL
See Also:
Constant Field Values

ALFRESCO_REFRESH_TOKEN_URL

public static final String ALFRESCO_REFRESH_TOKEN_URL
See Also:
Constant Field Values

PARAM_ACCESS_TOKEN

public static final String PARAM_ACCESS_TOKEN
See Also:
Constant Field Values
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 -

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:
accessToken -
Method Detail

alfrescoOAuthProvider

public static OAuthCMISAuthenticationProvider alfrescoOAuthProvider(String accessToken)

alfrescoOAuthProvider

public static OAuthCMISAuthenticationProvider alfrescoOAuthProvider(String clientId,
                                                                    String clientSecret,
                                                                    String redirectUrl,
                                                                    String authCode)

getAccessTokenData

public OAuthCMISAuthenticationProvider.AccessToken getAccessTokenData()

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!


createBasicAuthHeaderValue

protected List<String> createBasicAuthHeaderValue(String username,
                                                  String password)
Creates a basic authentication header value from a username and a password.


isTrue

protected boolean isTrue(String parameterName)
Returns true if the given parameter exists in the session and is set to true, false otherwise.



Copyright © 2011–2014 Alfresco. All rights reserved.