Class InvalidRegistrationException

    • Constructor Detail

      • InvalidRegistrationException

        public InvalidRegistrationException()
        Creates a new invalid client registration exception with a general invalid_client_metadata error code and description that doesn't specify the cause.

        This will result in the following error response:

         HTTP/1.1 400 Bad Request
         Content-Type: application/json
         Cache-Control: no-store
         Pragma: no-cache
        
         {
           "error"             : "invalid_client_metadata",
           "error_description" : "Invalid client metadata field"
         }
         
      • InvalidRegistrationException

        public InvalidRegistrationException​(com.nimbusds.oauth2.sdk.ErrorObject errorObject)
        Creates a new invalid client registration exception with the specified error code and description.

        The error code should be one of the following:

        • invalid_redirect_uri
        • invalid_client_metadata
        • invalid_software_statement
        • unapproved_software_statement

        To construct an exception for a general invalid_client_metadata error with a description:

         new InvalidRegistrationException(RegistrationError.INVALID_CLIENT_METADATA
                .setDescription("The policy_uri must be on a redirect_uris domain"));
         

        This will result in the following error response:

         HTTP/1.1 400 Bad Request
         Content-Type: application/json
         Cache-Control: no-store
         Pragma: no-cache
        
         {
           "error"             : "invalid_client_metadata",
           "error_description" : "The policy_uri must be on a redirect_uris domain"
         }
         
        Parameters:
        errorObject - The associated error object. If null will be set to invalid_client_metadata.
      • InvalidRegistrationException

        public InvalidRegistrationException​(String field,
                                            String cause)
        Creates a new invalid client registration exception, with the error code set to invalid_client_metadata and a description specifying the name of the invalid field and cause.

        Example:

         new InvalidRegistrationException("policy_uri", "Must be on a redirect_uris domain");
         

        This will result in the following error response:

         HTTP/1.1 400 Bad Request
         Content-Type: application/json
         Cache-Control: no-store
         Pragma: no-cache
        
         {
           "error"             : "invalid_client_metadata",
           "error_description" : "Invalid client metadata field policy_uri: Must be on a redirect_uris domain"
         }
         
        Parameters:
        field - The name of the invalid client metadata field. Must not be null.
        cause - The cause, null if not specified.
    • Method Detail

      • getErrorObject

        public com.nimbusds.oauth2.sdk.ErrorObject getErrorObject()
        Returns the associated error object.
        Returns:
        The associated error object.