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, name
Fields inherited from interface org.nuxeo.ecm.platform.oauth2.clients.OAuth2ClientService
OAUTH2CLIENT_DIRECTORY_NAME, OAUTH2CLIENT_SCHEMA
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkPermission
(NuxeoPrincipal principal) protected void
checkUnicity
(String clientId) Checks if a client with theclientId
is unique.create
(OAuth2Client oAuth2Client, NuxeoPrincipal principal) Registers a new oAuth2 client as the given principal.void
delete
(String clientId, NuxeoPrincipal principal) Deletes an oAuth2 client as the given principal.protected <T> T
protected <T> T
execute
(Function<Session, T> function, NuxeoPrincipal principal) Gets the oAuth2 client with the given client id.protected DocumentModel
getClientModel
(String clientId) Gets all the oAuth2 clients.protected DocumentModel
getDocument
(String clientId) Gets the document model from a givenclientId
boolean
Checks if an oAuth2 client with the given client id exists.boolean
isValidClient
(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 void
validate
(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, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Constructor Details
-
OAuth2ClientServiceImpl
public OAuth2ClientServiceImpl()
-
-
Method Details
-
hasClient
Description copied from interface:OAuth2ClientService
Checks if an oAuth2 client with the given client id exists.Done as a privileged user.
- Specified by:
hasClient
in interfaceOAuth2ClientService
- Parameters:
clientId
- the client id of the oAuth2 client whose existence to check- Returns:
true
if an oAuth2 client with the given client id exists,false
otherwise
-
isValidClient
Description copied from interface:OAuth2ClientService
Checks if the oAuth2 client with the given client id is valid regarding the given client secret.Done as a privileged user.
- Specified by:
isValidClient
in interfaceOAuth2ClientService
- Parameters:
clientId
- the client id of the oAuth2 client to validateclientSecret
- the client secret used for validation- Returns:
true
if the oAuth2 client with the given client id is valid regarding the given client secret,false
otherwise
-
getClient
Description copied from interface:OAuth2ClientService
Gets the oAuth2 client with the given client id.Done as a privileged user.
- Specified by:
getClient
in interfaceOAuth2ClientService
- Parameters:
clientId
- the client id of the oAuth2 client to get- Returns:
- the oAuth2 client with the given client id if it exists,
null
otherwise
-
getClients
Description copied from interface:OAuth2ClientService
Gets all the oAuth2 clients.Done as a privileged user.
- Specified by:
getClients
in interfaceOAuth2ClientService
- Returns:
- the oAuth2 clients
-
create
Description copied from interface:OAuth2ClientService
Registers a new oAuth2 client as the given principal.- Specified by:
create
in interfaceOAuth2ClientService
- Parameters:
oAuth2Client
- theOAuth2Client
to registerprincipal
- the current user- Returns:
- the newly registered client
-
update
Description copied from interface:OAuth2ClientService
Updates an exiting oAuth2 client as the given principal.- Specified by:
update
in interfaceOAuth2ClientService
- Parameters:
clientId
- the client id of oAuth2Client to updateoAuth2Client
- the newOAuth2Client
dataprincipal
- the current user- Returns:
- the updated oAuth2Client
-
delete
Description copied from interface:OAuth2ClientService
Deletes an oAuth2 client as the given principal.- Specified by:
delete
in 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
. AnOAuth2Client
is 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 null
oAuth2Client to validate- Throws:
NullPointerException
- if the oAuth2Client isnull
NuxeoException
- if oAuth2Client is not valid- Since:
- 11.1
- It is not
-
checkUnicity
Checks if a client with theclientId
is unique.- Parameters:
clientId
- the client id to check- Throws:
NuxeoException
- if an oAuth2 client with the givenclientId
already 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
-