Class ClientRegistrationResponse

  • All Implemented Interfaces:
    Serializable

    public class ClientRegistrationResponse
    extends ApiResponse
    Response from Authlete's /api/client/registration API.

    Authlete's /api/client/register API returns JSON which can be mapped to this class. The implementation of client registration endpoint should retrieve the value of "action" from the response and take the following steps according to the value.

    INTERNAL_SERVER_ERROR

    When the value of "action" is "INTERNAL_SERVER_ERROR", it means that the request from the endpoint implementation (ClientRegistrationRequest) was wrong or that an error occurred in Authlete.

    In either case, from a viewpoint of the client application, it is an error on the server side. Therefore, the endpoint implementation should generate a response to the client application with the HTTP status of "500 Internal Server Error".

    getResponseContent() returns a JSON string which describes the error, so it can be used as the entity body of the response.

    The following illustrates the response which the endpoint implementation should generate and return to the client application.

     HTTP/1.1 500 Internal Server Error
     Content-Type: application/json
     Cache-Control: no-store
     Pragma: no-cache
    
     (The value returned from getResponseContent())
    BAD_REQUEST

    When the value of "action" is "BAD_REQUEST", it means that the request from the client application is invalid.

    The HTTP status of the response returned to the client application must be "400 Bad Request" and the content type must be "application/json".

    getResponseContent() returns a JSON string which describes the error, so it can be used as the entity body of the response.

    The following illustrates the response which the endpoint implementation should generate and return to the client application.

     HTTP/1.1 400 Bad Request
     Content-Type: application/json
     Cache-Control: no-store
     Pragma: no-cache
    
     (The value returned from getResponseContent())
    UNAUTHORIZED

    When the value of "action" is "UNAUTHORIZED", it means that the registration access token used by the client configuration request (RFC 7592) is invalid, or the client application which the token is tied to does not exist any longer or is invalid.

    The HTTP status of the response returned to the client application must be "401 Unauthorized" and the content type must be "application/json".

    getResponseContent() returns a JSON string which describes the error, so it can be used as the entity body of the response.

    The following illustrates the response which the endpoint implementation should generate and return to the client application.

     HTTP/1.1 401 Unauthorized
     Content-Type: application/json
     Cache-Control: no-store
     Pragma: no-cache
    
     (The value returned from getResponseContent())

    NOTE: The UNAUTHORIZED enum value was added recently (in October, 2021). See the description of Service.setUnauthorizedOnClientConfigSupported(boolean) for details.

    CREATED

    When the value of "action" is "CREATED", it means that the client registration request was valid and a client application has been registered successfully.

    In this case, the HTTP status of the response returned to the client application must be "201 Created" as described in "3.2.1. Client Information Response" of RFC 7591.

    The following illustrates the response which the endpoint implementation should generate and return to the client application.

     HTTP/1.1 201 Created
     Content-Type: application/json
     Cache-Control: no-store
     Pragma: no-cache
    
     (The value returned from getResponseContent())
    Since:
    2.22, Authlete 2.0.0
    See Also:
    Serialized Form
    • Constructor Detail

      • ClientRegistrationResponse

        public ClientRegistrationResponse()
    • Method Detail

      • getAction

        public ClientRegistrationResponse.Action getAction()
        Get the next action that the implementation of client registration endpoint should take.
        Returns:
        The next action that should be taken.
      • setAction

        public void setAction​(ClientRegistrationResponse.Action action)
        Set the next action that the implementation of client registration endpoint should take.
        Parameters:
        action - The next action that should be taken.
      • getResponseContent

        public String getResponseContent()
        Get the response content which can be used as the entity body of the response returned to the client application.
        Returns:
        The content of the response returned to the client application.
      • setResponseContent

        public void setResponseContent​(String responseContent)
        Set the response content which can be used as the entity body of the response returned to the client application.
        Parameters:
        responseContent - The content of the response returned to the client application.
      • getClient

        public Client getClient()
        Get the information about the client which has been registered successfully.

        The values returned from getClientId(), getClientSecret() and getCreatedAt() of the object returned from this method correspond to client_id, client_secret and client_id_issued_at in RFC 7591.

        As the client secret never expires in the current implementation of Authlete, the Client class does not have a property which corresponds to client_secret_expires_at.

        Returns:
        The information about the newly registered client.
      • setClient

        public void setClient​(Client client)
        Set the information about the newly registered client.
        Parameters:
        client - The information about the newly registered client.