Interface ClientService


public interface ClientService
Service for managing OAuth2 clients (from the provider's perspective).

When imported via OSGi, System Admin permission checks are enforced on all method calls.

  • Method Details

    • create

      @Nonnull Client create(@Nonnull String name, Scope scope, @Nonnull List<String> redirectUris)
      Creates a Client
      Parameters:
      name - the name of the client
      scope - optional scope for client. If not specified then this will be saved as ALL
      redirectUris - the redirect uris of the client
      Returns:
      the newly created entity
    • updateClient

      Optional<Client> updateClient(@Nonnull String id, String name, String scope, @Nonnull List<String> redirectUris)
      Updates an existing Client
      Parameters:
      id - the id of the entity to update
      name - the new name. Null means no update will occur
      redirectUris - the new redirectUri name
    • resetClientSecret

      Optional<Client> resetClientSecret(@Nonnull String clientId)
    • getById

      Optional<Client> getById(@Nonnull String id)
      Gets an existing Client
      Parameters:
      id - of the entity to return
      Returns:
      The Client matching the id or null
    • getByClientId

      Optional<Client> getByClientId(@Nonnull String clientId)
      Gets an existing Client
      Parameters:
      clientId - of the entity to return
      Returns:
      The Client matching the id or null
    • findRedirectUrisByClientId

      List<String> findRedirectUrisByClientId(@Nonnull String clientId)
      Gets an existing redirect uri
      Parameters:
      clientId - matching the entity to return
      Returns:
      The redirect uri matching the id or empty
    • list

      List<Client> list()
      Gets all Client
      Returns:
      the clients stored in the system
    • removeById

      Optional<Client> removeById(@Nonnull String id)
      Deletes a Client
      Parameters:
      id - of the entity to delete
    • isClientNameUnique

      boolean isClientNameUnique(@Nullable String clientId, @Nonnull String clientName)
      Checks if client name is unique
      Parameters:
      clientId - id of the client
      clientName - name of the client
      Returns:
      true if client name is unique
    • isClientSecretValid

      boolean isClientSecretValid(@Nonnull String clientId, @Nonnull String clientSecret)
      Checks if the provided client secret is a match for the client secret stored against the client ID provided
      Parameters:
      clientId - id of the client
      clientSecret - secret of the client
      Returns:
      true if provided client secret is a match
    • isClientSecretValid

      default boolean isClientSecretValid(@Nonnull String clientId, @Nullable String clientSecret, @Nonnull FlowType flowType)
      Checks if the provided client secret is a match for the client secret stored against the client ID provided. If the flow type is a public flow then this will always be true
      Parameters:
      clientId - id of the client
      clientSecret - secret of the client. Can be null if it is a public flow
      flowType - the flow type of the client that will determine if a client secret is required
      Returns:
      true if provided client secret is a match or the secret is not required
      Since:
      3.1.14