Class NuxeoOAuth2ServiceProvider
java.lang.Object
org.nuxeo.ecm.platform.oauth2.providers.NuxeoOAuth2ServiceProvider
- All Implemented Interfaces:
OAuth2ServiceProvider
- Direct Known Subclasses:
AbstractOAuth2UserEmailProvider
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected String
static final String
protected static final com.google.api.client.http.HttpTransport
Global instance of the HTTP transport.protected Long
protected static final com.google.api.client.json.JsonFactory
Global instance of the JSON factory.static final String
protected String
protected OAuth2ServiceUserStore
protected OAuth2TokenStore
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getAuthorizationCode
(javax.servlet.http.HttpServletRequest request) com.google.api.client.auth.oauth2.AuthorizationCodeFlow
getAuthorizationUrl
(String serverURL) Returns the authorization URLgetAuthorizationUrl
(javax.servlet.http.HttpServletRequest request) Returns the authorization URLprotected String
getCallbackUrl
(String serverURL) protected String
getCallbackUrl
(javax.servlet.http.HttpServletRequest request) protected String
getError
(javax.servlet.http.HttpServletRequest request) getId()
protected String
getOrCreateServiceUser
(javax.servlet.http.HttpServletRequest request, String accessToken) Retrieves or creates a service user.protected String
getServiceUserId
(String key) Returns the userId to use for token entries.protected OAuth2ServiceUserStore
com.google.api.client.auth.oauth2.Credential
handleAuthorizationCallback
(javax.servlet.http.HttpServletRequest request) Handles the authorization response and stores the token(s)boolean
boolean
com.google.api.client.auth.oauth2.Credential
loadCredential
(String user) Load a credential from the token store with the userId returned by getServiceUser() as key.void
setAuthorizationServerURL
(String authorizationServerURL) void
setClientId
(String clientId) void
setClientSecret
(String clientSecret) void
setDescription
(String description) void
setEnabled
(Boolean enabled) void
void
void
setServiceName
(String serviceName) void
setTokenServerURL
(String tokenServerURL) void
setUserAuthorizationURL
(String userAuthorizationURL)
-
Field Details
-
SCHEMA
- See Also:
-
HTTP_TRANSPORT
protected static final com.google.api.client.http.HttpTransport HTTP_TRANSPORTGlobal instance of the HTTP transport. -
JSON_FACTORY
protected static final com.google.api.client.json.JsonFactory JSON_FACTORYGlobal instance of the JSON factory. -
CODE_URL_PARAMETER
- See Also:
-
ERROR_URL_PARAMETER
- See Also:
-
serviceName
-
id
-
description
-
userAuthorizationURL
-
serviceUserStore
-
tokenStore
-
-
Constructor Details
-
NuxeoOAuth2ServiceProvider
public NuxeoOAuth2ServiceProvider()
-
-
Method Details
-
getAuthorizationUrl
Description copied from interface:OAuth2ServiceProvider
Returns the authorization URL- Specified by:
getAuthorizationUrl
in interfaceOAuth2ServiceProvider
-
getAuthorizationUrl
Description copied from interface:OAuth2ServiceProvider
Returns the authorization URL- Specified by:
getAuthorizationUrl
in interfaceOAuth2ServiceProvider
-
getCallbackUrl
-
getCallbackUrl
-
handleAuthorizationCallback
public com.google.api.client.auth.oauth2.Credential handleAuthorizationCallback(javax.servlet.http.HttpServletRequest request) Description copied from interface:OAuth2ServiceProvider
Handles the authorization response and stores the token(s)- Specified by:
handleAuthorizationCallback
in interfaceOAuth2ServiceProvider
-
loadCredential
Load a credential from the token store with the userId returned by getServiceUser() as key.- Specified by:
loadCredential
in interfaceOAuth2ServiceProvider
-
getServiceUserId
Returns the userId to use for token entries. Should be overriden by subclasses wanting to rely on a different field as key. -
getOrCreateServiceUser
protected String getOrCreateServiceUser(javax.servlet.http.HttpServletRequest request, String accessToken) throws IOException Retrieves or creates a service user. Should be overriden by subclasses wanting to rely on a different field as key.- Throws:
IOException
-
getAuthorizationCodeFlow
public com.google.api.client.auth.oauth2.AuthorizationCodeFlow getAuthorizationCodeFlow() -
getServiceUserStore
-
getCredentialDataStore
-
getError
-
getAuthorizationCode
-
getServiceName
- Specified by:
getServiceName
in interfaceOAuth2ServiceProvider
-
getId
- Specified by:
getId
in interfaceOAuth2ServiceProvider
-
getDescription
- Specified by:
getDescription
in interfaceOAuth2ServiceProvider
-
getTokenServerURL
- Specified by:
getTokenServerURL
in interfaceOAuth2ServiceProvider
-
getUserAuthorizationURL
- Specified by:
getUserAuthorizationURL
in interfaceOAuth2ServiceProvider
-
getClientId
- Specified by:
getClientId
in interfaceOAuth2ServiceProvider
-
getClientSecret
- Specified by:
getClientSecret
in interfaceOAuth2ServiceProvider
-
getScopes
- Specified by:
getScopes
in interfaceOAuth2ServiceProvider
-
getAuthorizationServerURL
- Specified by:
getAuthorizationServerURL
in interfaceOAuth2ServiceProvider
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceOAuth2ServiceProvider
-
setEnabled
- Specified by:
setEnabled
in interfaceOAuth2ServiceProvider
-
isProviderAvailable
public boolean isProviderAvailable()- Specified by:
isProviderAvailable
in interfaceOAuth2ServiceProvider
-
setServiceName
- Specified by:
setServiceName
in interfaceOAuth2ServiceProvider
-
setId
- Specified by:
setId
in interfaceOAuth2ServiceProvider
-
setDescription
- Specified by:
setDescription
in interfaceOAuth2ServiceProvider
-
setTokenServerURL
- Specified by:
setTokenServerURL
in interfaceOAuth2ServiceProvider
-
setUserAuthorizationURL
- Specified by:
setUserAuthorizationURL
in interfaceOAuth2ServiceProvider
-
setAuthorizationServerURL
- Specified by:
setAuthorizationServerURL
in interfaceOAuth2ServiceProvider
-
setClientId
- Specified by:
setClientId
in interfaceOAuth2ServiceProvider
-
setClientSecret
- Specified by:
setClientSecret
in interfaceOAuth2ServiceProvider
-
setScopes
- Specified by:
setScopes
in interfaceOAuth2ServiceProvider
-