java.lang.Object
com.irurueta.authserver.authorization.api.web.clients.ClientDtoMapper

@Component public class ClientDtoMapper extends Object
Maps between the DTOs generated from the contract and the client registrations of the domain, so a domain model is never returned from ClientAdminController.
  • Field Details

    • jwksParser

      private final ClientJwksParser jwksParser
      Validates the JWK sets of the clients.
  • Constructor Details

    • ClientDtoMapper

      public ClientDtoMapper()
  • Method Details

    • toRegistration

      public ClientRegistration toRegistration(ClientRequest request)
      Maps a create or update request to a client registration. An absent flag is false, absent audiences are empty (the client identifier is then used), absent post-logout redirect URIs are empty and an absent or blank format is "self-contained".
      Parameters:
      request - the validated request.
      Returns:
      the registration.
      Throws:
      IllegalArgumentException - if the registration is not valid.
      InvalidClientJwksException - if the JWK set is invalid or holds a private key.
    • toResponse

      public ClientResponse toResponse(ClientRegistration registration)
      Maps a registration to its public view, which never contains a secret.
      Parameters:
      registration - the registration.
      Returns:
      its public view.
    • toResponses

      public List<ClientResponse> toResponses(List<ClientRegistration> registrations)
      Maps several registrations, keeping their order.
      Parameters:
      registrations - the registrations.
      Returns:
      their public views.
    • toCreatedResponse

      public CreatedClientResponse toCreatedResponse(CreatedClient created)
      Maps a created client: its public view and, for a confidential one, its secret (shown only once).
      Parameters:
      created - the created client.
      Returns:
      the answer to the creation.
    • toSecretResponse

      public ClientSecretResponse toSecretResponse(String clientSecret)
      Maps a rotated secret (shown only once).
      Parameters:
      clientSecret - the new secret in clear text.
      Returns:
      the answer to the rotation.