Class ClientAdminController

java.lang.Object
com.irurueta.authserver.authorization.api.web.clients.ClientAdminController
All Implemented Interfaces:
ClientsApi

@RestController public class ClientAdminController extends Object implements ClientsApi
Administration of the registered clients, as the contract apis/auth-server/rest-server/auth-server-api-v1.yaml describes it through the generated ClientsApi. Secrets are never returned, except once when a confidential client is created or its secret is rotated. Failures are answered as problem details by ClientExceptionHandler.
  • Field Details

    • listClientsUseCase

      private final ListClientsUseCase listClientsUseCase
      Lists the clients.
    • getClientUseCase

      private final GetClientUseCase getClientUseCase
      Finds a client.
    • createClientUseCase

      private final CreateClientUseCase createClientUseCase
      Creates clients.
    • updateClientUseCase

      private final UpdateClientUseCase updateClientUseCase
      Updates clients.
    • deleteClientUseCase

      private final DeleteClientUseCase deleteClientUseCase
      Deletes clients.
    • rotateClientSecretUseCase

      private final RotateClientSecretUseCase rotateClientSecretUseCase
      Rotates client secrets.
    • clientDtoMapper

      private final ClientDtoMapper clientDtoMapper
      Maps between the generated DTOs and the domain.
  • Constructor Details

    • ClientAdminController

      public ClientAdminController()
  • Method Details

    • listClients

      public org.springframework.http.ResponseEntity<List<ClientResponse>> listClients()
      Lists the clients.
      Specified by:
      listClients in interface ClientsApi
      Returns:
      every client, without secrets.
    • getClient

      public org.springframework.http.ResponseEntity<ClientResponse> getClient(String clientId)
      Finds a client.
      Specified by:
      getClient in interface ClientsApi
      Parameters:
      clientId - identifier of the client.
      Returns:
      the client, without secret.
      Throws:
      ClientNotFoundException - if no such client exists.
    • createClient

      public org.springframework.http.ResponseEntity<CreatedClientResponse> createClient(ClientRequest request)
      Creates a client.
      Specified by:
      createClient in interface ClientsApi
      Parameters:
      request - definition of the client.
      Returns:
      201 Created with the client and, when confidential, its generated secret (shown only once).
    • updateClient

      public org.springframework.http.ResponseEntity<ClientResponse> updateClient(String clientId, ClientRequest request)
      Replaces the definition of a client. Its secret is kept.
      Specified by:
      updateClient in interface ClientsApi
      Parameters:
      clientId - identifier of the client.
      request - new definition; its identifier must match the path.
      Returns:
      the updated client.
      Throws:
      IllegalArgumentException - if the identifier in the body differs from the path.
    • deleteClient

      public org.springframework.http.ResponseEntity<Void> deleteClient(String clientId)
      Deletes a client.
      Specified by:
      deleteClient in interface ClientsApi
      Parameters:
      clientId - identifier of the client.
      Returns:
      204 No Content.
    • rotateClientSecret

      public org.springframework.http.ResponseEntity<ClientSecretResponse> rotateClientSecret(String clientId)
      Generates a new secret for a confidential client.
      Specified by:
      rotateClientSecret in interface ClientsApi
      Parameters:
      clientId - identifier of the client.
      Returns:
      the new secret (shown only once).