Class OAuthCMISAuthenticationProvider
java.lang.Object
org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
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=<access token>
org.apache.chemistry.opencmis.binding.compression=true
- Author:
- steveglover
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOAuthCMISAuthenticationProvider(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
Modifier and TypeMethodDescriptionalfrescoOAuthProvider(String accessToken) alfrescoOAuthProvider(String clientId, String clientSecret, String redirectUrl, String authCode) createBasicAuthHeaderValue(String username, String password) Creates a basic authentication header value from a username and a password.Returns the HTTP headers that are sent with all requests.getHTTPHeaders(String url) getSOAPHeaders(Object portObject) protected booleanReturnstrueif the given parameter exists in the session and is set to true,falseotherwise.voidvoidsetSession(org.apache.chemistry.opencmis.client.bindings.spi.BindingSession session) Methods inherited from class org.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
getBearerToken, getCsrfHeader, getHandlerResolver, getHostnameVerifier, getPassword, getProxyPassword, getProxyUser, getSession, getSSLSocketFactory, getTrustManager, getUser
-
Field Details
-
ALFRESCO_ACCESS_TOKEN_URL
- See Also:
-
ALFRESCO_REFRESH_TOKEN_URL
- See Also:
-
PARAM_ACCESS_TOKEN
- See Also:
-
-
Constructor Details
-
OAuthCMISAuthenticationProvider
public OAuthCMISAuthenticationProvider() -
OAuthCMISAuthenticationProvider
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 IDclientSecret- secretredirectUrl- redirect URLaccessTokenUrl- access token URLrefreshTokenUrl- refresh token URLauthCode- Authcode
-
-
Method Details
-
alfrescoOAuthProvider
-
alfrescoOAuthProvider
public static OAuthCMISAuthenticationProvider alfrescoOAuthProvider(String clientId, String clientSecret, String redirectUrl, String authCode) -
getAccessTokenData
-
setSession
public void setSession(org.apache.chemistry.opencmis.client.bindings.spi.BindingSession session) - Specified by:
setSessionin interfaceorg.apache.chemistry.opencmis.client.bindings.spi.SessionAwareAuthenticationProvider- Overrides:
setSessionin classorg.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
-
getHTTPHeaders
- Specified by:
getHTTPHeadersin interfaceorg.apache.chemistry.opencmis.commons.spi.AuthenticationProvider- Overrides:
getHTTPHeadersin classorg.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
-
putResponseHeaders
- Specified by:
putResponseHeadersin interfaceorg.apache.chemistry.opencmis.commons.spi.AuthenticationProvider- Overrides:
putResponseHeadersin classorg.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
-
getSOAPHeaders
- Specified by:
getSOAPHeadersin interfaceorg.apache.chemistry.opencmis.commons.spi.AuthenticationProvider- Overrides:
getSOAPHeadersin classorg.apache.chemistry.opencmis.client.bindings.spi.AbstractAuthenticationProvider
-
getFixedHeaders
Returns the HTTP headers that are sent with all requests. The returned map is mutable but not synchronized!- Returns:
- fixedHeaders
-
createBasicAuthHeaderValue
Creates a basic authentication header value from a username and a password.- Parameters:
username- usernamepassword- password- Returns:
- List<String>
-
isTrue
Returnstrueif the given parameter exists in the session and is set to true,falseotherwise.- Parameters:
parameterName- Parameter name- Returns:
- True/False
-