Class AuthorizationErrorResponse

    • Constructor Detail

      • AuthorizationErrorResponse

        public AuthorizationErrorResponse​(URI redirectURI,
                                          ErrorObject error,
                                          State state,
                                          ResponseMode rm)
        Creates a new authorisation error response.
        Parameters:
        redirectURI - The base redirection URI. Must not be null.
        error - The error. Should match one of the standard errors for an authorisation error response. Must not be null.
        state - The state, null if not requested.
        rm - The implied response mode, null if unknown.
      • AuthorizationErrorResponse

        public AuthorizationErrorResponse​(URI redirectURI,
                                          com.nimbusds.jwt.JWT jwtResponse,
                                          ResponseMode rm)
        Creates a new JSON Web Token (JWT) secured authorisation error response.
        Parameters:
        redirectURI - The base redirection URI. Must not be null.
        jwtResponse - The JWT-secured response. Must not be null.
        rm - The implied response mode, null if unknown.
    • Method Detail

      • getStandardErrors

        public static Set<ErrorObjectgetStandardErrors()
        Gets the standard OAuth 2.0 errors for an Authorisation error response.
        Returns:
        The standard errors, as a read-only set.
      • indicatesSuccess

        public boolean indicatesSuccess()
        Description copied from interface: Response
        Checks if the response indicates success.
        Specified by:
        indicatesSuccess in interface Response
        Returns:
        true if the response indicates success, else false.
      • parse

        public static AuthorizationErrorResponse parse​(URI redirectURI,
                                                       Map<String,​List<String>> params)
                                                throws ParseException
        Parses an authorisation error response.
        Parameters:
        redirectURI - The base redirection URI. Must not be null.
        params - The response parameters to parse. Must not be null.
        Returns:
        The authorisation error response.
        Throws:
        ParseException - If the parameters couldn't be parsed to an authorisation error response.
      • parse

        public static AuthorizationErrorResponse parse​(URI uri)
                                                throws ParseException
        Parses an authorisation error response.

        Use a relative URI if the host, port and path details are not known:

         URI relUrl = new URI("https:///?error=invalid_request");
         

        Example URI:

         https://client.example.com/cb?
         error=invalid_request
         &error_description=the%20request%20is%20not%20valid%20or%20malformed
         &state=af0ifjsldkj
         
        Parameters:
        uri - The URI to parse. Can be absolute or relative, with a fragment or query string containing the authorisation response parameters. Must not be null.
        Returns:
        The authorisation error response.
        Throws:
        ParseException - If the URI couldn't be parsed to an authorisation error response.
      • parse

        public static AuthorizationErrorResponse parse​(HTTPResponse httpResponse)
                                                throws ParseException
        Parses an authorisation error response from the specified initial HTTP 302 redirect response generated at the authorisation endpoint.

        Example HTTP response:

         HTTP/1.1 302 Found
         Location: https://client.example.com/cb?error=invalid_request&state=af0ifjsldkj
         
        Parameters:
        httpResponse - The HTTP response to parse. Must not be null.
        Returns:
        The authorisation error response.
        Throws:
        ParseException - If the HTTP response couldn't be parsed to an authorisation error response.
        See Also:
        parse(HTTPRequest)
      • parse

        public static AuthorizationErrorResponse parse​(HTTPRequest httpRequest)
                                                throws ParseException
        Parses an authorisation error response from the specified HTTP request at the client redirection (callback) URI. Applies to query, fragment and form_post response modes.

        Example HTTP request (authorisation success):

         GET /cb?error=invalid_request&state=af0ifjsldkj HTTP/1.1
         Host: client.example.com
         
        Parameters:
        httpRequest - The HTTP request to parse. Must not be null.
        Returns:
        The authorisation error response.
        Throws:
        ParseException - If the HTTP request couldn't be parsed to an authorisation error response.
        See Also:
        parse(HTTPResponse)