Class OAuth2ClientServiceImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.platform.oauth2.clients.OAuth2ClientServiceImpl
- All Implemented Interfaces:
OAuth2ClientService,Adaptable,Component,Extensible,TimestampedService
OAuth2 Client service
- Since:
- 9.2
-
Field Summary
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, nameFields inherited from interface org.nuxeo.ecm.platform.oauth2.clients.OAuth2ClientService
OAUTH2CLIENT_DIRECTORY_NAME, OAUTH2CLIENT_SCHEMA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckPermission(NuxeoPrincipal principal) protected voidcheckUnicity(String clientId) Checks if a client with theclientIdis unique.create(OAuth2Client oAuth2Client, NuxeoPrincipal principal) Registers a new oAuth2 client as the given principal.voiddelete(String clientId, NuxeoPrincipal principal) Deletes an oAuth2 client as the given principal.protected <T> Tprotected <T> Texecute(Function<Session, T> function, NuxeoPrincipal principal) Gets the oAuth2 client with the given client id.protected DocumentModelgetClientModel(String clientId) Gets all the oAuth2 clients.protected DocumentModelgetDocument(String clientId) Gets the document model from a givenclientIdbooleanChecks if an oAuth2 client with the given client id exists.booleanisValidClient(String clientId, String clientSecret) Checks if the oAuth2 client with the given client id is valid regarding the given client secret.protected List<DocumentModel> update(String clientId, OAuth2Client oAuth2Client, NuxeoPrincipal principal) Updates an exiting oAuth2 client as the given principal.protected voidvalidate(OAuth2Client oAuth2Client) Validates theOAuth2Client.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterContribution, unregisterExtensionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Constructor Details
-
OAuth2ClientServiceImpl
public OAuth2ClientServiceImpl()
-
-
Method Details
-
hasClient
Description copied from interface:OAuth2ClientServiceChecks if an oAuth2 client with the given client id exists.Done as a privileged user.
- Specified by:
hasClientin interfaceOAuth2ClientService- Parameters:
clientId- the client id of the oAuth2 client whose existence to check- Returns:
trueif an oAuth2 client with the given client id exists,falseotherwise
-
isValidClient
Description copied from interface:OAuth2ClientServiceChecks if the oAuth2 client with the given client id is valid regarding the given client secret.Done as a privileged user.
- Specified by:
isValidClientin interfaceOAuth2ClientService- Parameters:
clientId- the client id of the oAuth2 client to validateclientSecret- the client secret used for validation- Returns:
trueif the oAuth2 client with the given client id is valid regarding the given client secret,falseotherwise
-
getClient
Description copied from interface:OAuth2ClientServiceGets the oAuth2 client with the given client id.Done as a privileged user.
- Specified by:
getClientin interfaceOAuth2ClientService- Parameters:
clientId- the client id of the oAuth2 client to get- Returns:
- the oAuth2 client with the given client id if it exists,
nullotherwise
-
getClients
Description copied from interface:OAuth2ClientServiceGets all the oAuth2 clients.Done as a privileged user.
- Specified by:
getClientsin interfaceOAuth2ClientService- Returns:
- the oAuth2 clients
-
create
Description copied from interface:OAuth2ClientServiceRegisters a new oAuth2 client as the given principal.- Specified by:
createin interfaceOAuth2ClientService- Parameters:
oAuth2Client- theOAuth2Clientto registerprincipal- the current user- Returns:
- the newly registered client
-
update
Description copied from interface:OAuth2ClientServiceUpdates an exiting oAuth2 client as the given principal.- Specified by:
updatein interfaceOAuth2ClientService- Parameters:
clientId- the client id of oAuth2Client to updateoAuth2Client- the newOAuth2Clientdataprincipal- the current user- Returns:
- the updated oAuth2Client
-
delete
Description copied from interface:OAuth2ClientServiceDeletes an oAuth2 client as the given principal.- Specified by:
deletein interfaceOAuth2ClientService- Parameters:
clientId- the client id of the oAuth2Client to deleteprincipal- the current user
-
getClientModel
-
queryClients
-
execute
- Since:
- 11.1
-
execute
- Since:
- 11.1
-
checkPermission
-
validate
Validates theOAuth2Client. AnOAuth2Clientis valid if and only if- It is not
null - The required fields are filled in:
OAuth2Client.getId(),OAuth2Client.getName(),OAuth2Client.getRedirectURIs() - The
OAuth2Client.getRedirectURIs()is a valid URI,OAuth2Client.isRedirectURIValid(String)
- Parameters:
oAuth2Client- thenot nulloAuth2Client to validate- Throws:
NullPointerException- if the oAuth2Client isnullNuxeoException- if oAuth2Client is not valid- Since:
- 11.1
- It is not
-
checkUnicity
Checks if a client with theclientIdis unique.- Parameters:
clientId- the client id to check- Throws:
NuxeoException- if an oAuth2 client with the givenclientIdalready exists- Since:
- 11.1
-
getDocument
Gets the document model from a givenclientId- Parameters:
clientId- the oAuth client id- Throws:
NuxeoException- if there is no document model for the givenclientId- Since:
- 11.1
-