Class OAuth2Object
java.lang.Object
org.nuxeo.ecm.webengine.model.impl.AbstractResource<ResourceTypeImpl>
org.nuxeo.ecm.restapi.server.jaxrs.OAuth2Object
Endpoint to retrieve OAuth2 authentication data
- Since:
- 8.4
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionjavax.ws.rs.core.Response
addProvider
(javax.servlet.http.HttpServletRequest request, NuxeoOAuth2ServiceProvider provider) Creates a new OAuth2 service provider.protected javax.ws.rs.core.Response
buildResponse
(javax.ws.rs.core.Response.StatusType status, Object obj) protected void
protected void
protected void
checkPermission
(String nxuser) javax.ws.rs.core.Response
createClient
(OAuth2Client client) Creates a new oauth2 client.javax.ws.rs.core.Response
deleteClient
(String clientId) Deletes the oauth2 client.javax.ws.rs.core.Response
deleteClientToken
(String clientId, String nxuser, javax.servlet.http.HttpServletRequest request) Deletes a oauth2 client token.javax.ws.rs.core.Response
deleteProvider
(String providerId, javax.servlet.http.HttpServletRequest request) Deletes an OAuth2 service provider.javax.ws.rs.core.Response
deleteProviderToken
(String providerId, String nxuser, javax.servlet.http.HttpServletRequest request) Deletes an OAuth2 provider token.javax.ws.rs.core.Response
deleteToken
(String providerId, String nxuser, javax.servlet.http.HttpServletRequest request) Deprecated.since 10.2 UsedeleteProviderToken(String, String, HttpServletRequest)
instead.protected void
deleteToken
(DocumentModel token) protected OAuth2Client
javax.ws.rs.core.Response
Retrieves a oauth2 client.getClients
(javax.servlet.http.HttpServletRequest request) Retrieves oauth2 clients.javax.ws.rs.core.Response
getClientToken
(String clientId, String nxuser, javax.servlet.http.HttpServletRequest request) Retrieves a oauth2 client token.getClientUserTokens
(javax.servlet.http.HttpServletRequest request) Retrieves all oauth2 client tokens for the current user.protected com.google.api.client.auth.oauth2.Credential
getCredential
(NuxeoOAuth2ServiceProvider provider, NuxeoOAuth2Token token) protected NuxeoPrincipal
protected NuxeoOAuth2ServiceProvider
getProvider
(String providerId) javax.ws.rs.core.Response
getProvider
(String providerId, javax.servlet.http.HttpServletRequest request) Retrieves oauth2 data for a given provider.protected List<NuxeoOAuth2ServiceProvider>
getProviders
(javax.servlet.http.HttpServletRequest request) Lists all oauth2 service providers.javax.ws.rs.core.Response
getProviderToken
(String providerId, String nxuser, javax.servlet.http.HttpServletRequest request) Retrieves an OAuth2 provider token.getProviderUserTokens
(javax.servlet.http.HttpServletRequest request) Retrieves all oauth2 provider tokens for the current user.javax.ws.rs.core.Response
Deprecated.since 10.2 UsegetProviderToken(String, String, HttpServletRequest)
instead.javax.ws.rs.core.Response
Retrieves a valid access token for a given provider and the current user.protected NuxeoOAuth2Token
getToken
(OAuth2Client client, String nxuser) protected NuxeoOAuth2Token
getToken
(NuxeoOAuth2ServiceProvider provider, String nxuser) protected DocumentModel
getTokenDoc
(OAuth2Client client, String nxuser) protected DocumentModel
getTokenDoc
(NuxeoOAuth2ServiceProvider provider, String nxuser) protected List<NuxeoOAuth2Token>
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1.protected List<NuxeoOAuth2Token>
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1.getTokens
(javax.servlet.http.HttpServletRequest request) Retrieves all OAuth2 tokens.Retrieves all oAuth2 tokens byNuxeoOAuth2TokenType
.searchTokens
(String query) Search all oAuth2 tokens that match the query.javax.ws.rs.core.Response
updateClient
(String clientId, OAuth2Client client) Updates the oauth2 client.javax.ws.rs.core.Response
updateClientToken
(String clientId, String nxuser, javax.servlet.http.HttpServletRequest request, NuxeoOAuth2Token token) Updates an OAuth2 client token.javax.ws.rs.core.Response
updateProvider
(String providerId, javax.servlet.http.HttpServletRequest request, NuxeoOAuth2ServiceProvider provider) Updates an OAuth2 service provider.javax.ws.rs.core.Response
updateProviderToken
(String providerId, String nxuser, javax.servlet.http.HttpServletRequest request, NuxeoOAuth2Token token) Updates an OAuth2 provider token.javax.ws.rs.core.Response
updateToken
(String providerId, String nxuser, javax.servlet.http.HttpServletRequest request, NuxeoOAuth2Token token) Deprecated.since 10.2 UseupdateProviderToken(String, String, HttpServletRequest, NuxeoOAuth2Token)
instead.protected NuxeoOAuth2Token
updateToken
(OAuth2Client client, String nxuser, NuxeoOAuth2Token token) protected NuxeoOAuth2Token
updateToken
(NuxeoOAuth2ServiceProvider provider, String nxuser, NuxeoOAuth2Token token) protected void
updateTokenDoc
(NuxeoOAuth2Token token, DocumentModel entry) Methods inherited from class org.nuxeo.ecm.webengine.model.impl.AbstractResource
checkGuard, dispose, getActiveAdapter, getAdapter, getContext, getFacets, getLinks, getModule, getName, getNext, getNextSegment, getPath, getPrevious, getTemplate, getTrailingPath, getType, getURL, getView, hasFacet, initialize, initialize, isAdapter, isInstanceOf, isRoot, newAdapter, newObject, redirect, setNext, setPrevious, setRoot, toString
-
Field Details
-
ACCESS_DENIED_MESSAGE
- See Also:
-
TOKEN_DIR
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. UseOAuth2TokenServiceImpl.TOKEN_DIR
instead.- See Also:
-
-
Constructor Details
-
OAuth2Object
public OAuth2Object()
-
-
Method Details
-
getProviders
public List<NuxeoOAuth2ServiceProvider> getProviders(@Context javax.servlet.http.HttpServletRequest request) Lists all oauth2 service providers.- Since:
- 9.2
-
getProvider
public javax.ws.rs.core.Response getProvider(String providerId, @Context javax.servlet.http.HttpServletRequest request) Retrieves oauth2 data for a given provider. -
addProvider
public javax.ws.rs.core.Response addProvider(@Context javax.servlet.http.HttpServletRequest request, NuxeoOAuth2ServiceProvider provider) Creates a new OAuth2 service provider.- Since:
- 9.2
-
updateProvider
public javax.ws.rs.core.Response updateProvider(String providerId, @Context javax.servlet.http.HttpServletRequest request, NuxeoOAuth2ServiceProvider provider) Updates an OAuth2 service provider.- Since:
- 9.2
-
deleteProvider
public javax.ws.rs.core.Response deleteProvider(String providerId, @Context javax.servlet.http.HttpServletRequest request) Deletes an OAuth2 service provider.- Since:
- 9.2
-
getToken
public javax.ws.rs.core.Response getToken(String providerId, @Context javax.servlet.http.HttpServletRequest request) throws IOException Retrieves a valid access token for a given provider and the current user. If expired, the token will be refreshed.- Throws:
IOException
-
getTokens
Retrieves all OAuth2 tokens.- Since:
- 9.2
-
getTokens
Retrieves all oAuth2 tokens byNuxeoOAuth2TokenType
.- Parameters:
type
- , the value ofNuxeoOAuth2TokenType
- Returns:
- if
type
isNuxeoOAuth2TokenType.AS_PROVIDER
, then we retrieve tokens that are provided by Nuxeo, otherwise those used by Nuxeo to connect to others applications - Since:
- 11.1
-
searchTokens
Search all oAuth2 tokens that match the query.- Parameters:
query
- the query to match- Since:
- 11.1
-
getProviderToken
public javax.ws.rs.core.Response getProviderToken(String providerId, String nxuser, @Context javax.servlet.http.HttpServletRequest request) Retrieves an OAuth2 provider token.- Since:
- 10.2
-
getToken
@Deprecated public javax.ws.rs.core.Response getToken(String providerId, String nxuser, @Context javax.servlet.http.HttpServletRequest request) Deprecated.since 10.2 UsegetProviderToken(String, String, HttpServletRequest)
instead.Retrieves an OAuth2 Token.- Since:
- 9.2
-
updateProviderToken
public javax.ws.rs.core.Response updateProviderToken(String providerId, String nxuser, @Context javax.servlet.http.HttpServletRequest request, NuxeoOAuth2Token token) Updates an OAuth2 provider token.- Since:
- 10.2
-
updateToken
@Deprecated public javax.ws.rs.core.Response updateToken(String providerId, String nxuser, @Context javax.servlet.http.HttpServletRequest request, NuxeoOAuth2Token token) Deprecated.since 10.2 UseupdateProviderToken(String, String, HttpServletRequest, NuxeoOAuth2Token)
instead.Updates an OAuth2 Token.- Since:
- 9.2
-
deleteProviderToken
public javax.ws.rs.core.Response deleteProviderToken(String providerId, String nxuser, @Context javax.servlet.http.HttpServletRequest request) Deletes an OAuth2 provider token.- Since:
- 10.2
-
deleteToken
@Deprecated public javax.ws.rs.core.Response deleteToken(String providerId, String nxuser, @Context javax.servlet.http.HttpServletRequest request) Deprecated.since 10.2 UsedeleteProviderToken(String, String, HttpServletRequest)
instead.Deletes an OAuth2 Token.- Since:
- 9.2
-
getProviderUserTokens
public List<NuxeoOAuth2Token> getProviderUserTokens(@Context javax.servlet.http.HttpServletRequest request) Retrieves all oauth2 provider tokens for the current user.- Since:
- 10.2
-
getClientUserTokens
public List<NuxeoOAuth2Token> getClientUserTokens(@Context javax.servlet.http.HttpServletRequest request) Retrieves all oauth2 client tokens for the current user.- Since:
- 10.2
-
getClientToken
public javax.ws.rs.core.Response getClientToken(String clientId, String nxuser, @Context javax.servlet.http.HttpServletRequest request) Retrieves a oauth2 client token.- Since:
- 10.2
-
updateClientToken
public javax.ws.rs.core.Response updateClientToken(String clientId, String nxuser, @Context javax.servlet.http.HttpServletRequest request, NuxeoOAuth2Token token) Updates an OAuth2 client token.- Since:
- 10.2
-
deleteClientToken
public javax.ws.rs.core.Response deleteClientToken(String clientId, String nxuser, @Context javax.servlet.http.HttpServletRequest request) Deletes a oauth2 client token.- Since:
- 10.2
-
getClients
Retrieves oauth2 clients.- Since:
- 10.2
-
getClient
public javax.ws.rs.core.Response getClient(String clientId, @Context javax.servlet.http.HttpServletRequest request) Retrieves a oauth2 client.- Since:
- 10.2
-
createClient
Creates a new oauth2 client.- Parameters:
client
- the oAuth2Client to create- Returns:
- the
Response
- Since:
- 11.1
-
updateClient
Updates the oauth2 client.- Parameters:
clientId
- the oAuth2 client id to updateclient
- the oAuth2Client to update- Returns:
- the
Response
- Since:
- 11.1
-
deleteClient
Deletes the oauth2 client.- Parameters:
clientId
- the oAuth2 client id to delete- Returns:
- the
Response
- Since:
- 11.1
-
getProviders
-
getProvider
-
getTokens
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. UseOAuth2TokenService.getTokens(NuxeoPrincipal)
instead. -
getTokens
@Deprecated(since="11.1", forRemoval=true) protected List<NuxeoOAuth2Token> getTokens(String nxuser) Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. UseOAuth2TokenService.getTokens(String)
instead. -
getClient
-
getTokenDoc
-
getTokenDoc
-
getToken
-
getToken
-
updateToken
protected NuxeoOAuth2Token updateToken(NuxeoOAuth2ServiceProvider provider, String nxuser, NuxeoOAuth2Token token) -
updateToken
-
updateTokenDoc
-
deleteToken
-
getCredential
protected com.google.api.client.auth.oauth2.Credential getCredential(NuxeoOAuth2ServiceProvider provider, NuxeoOAuth2Token token) -
buildResponse
protected javax.ws.rs.core.Response buildResponse(javax.ws.rs.core.Response.StatusType status, Object obj) throws IOException - Throws:
IOException
-
checkPermission
protected void checkPermission() -
checkPermission
-
checkNotAnonymousUser
protected void checkNotAnonymousUser() -
getPrincipal
-