Class UserInfoErrorResponse

    • Constructor Detail

      • UserInfoErrorResponse

        public UserInfoErrorResponse​(BearerTokenError error)
        Creates a new UserInfo error response indicating a bearer token error.
        Parameters:
        error - The OAuth 2.0 bearer token error. Should match one of the standard errors for a UserInfo error response. Must not be null.
      • UserInfoErrorResponse

        public UserInfoErrorResponse​(ErrorObject error)
        Creates a new UserInfo error response indicating a general error.
        Parameters:
        error - The error. Must not be null.
    • Method Detail

      • getStandardErrors

        public static Set<BearerTokenErrorgetStandardErrors()
        Gets the standard errors for a UserInfo 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.
      • toHTTPResponse

        public HTTPResponse toHTTPResponse()
        Returns the HTTP response for this UserInfo error response.

        Example HTTP response:

         HTTP/1.1 401 Unauthorized
         WWW-Authenticate: Bearer realm="example.com",
                           error="invalid_token",
                           error_description="The access token expired"
         
        Specified by:
        toHTTPResponse in interface Response
        Returns:
        The HTTP response matching this UserInfo error response.
      • parse

        public static UserInfoErrorResponse parse​(String wwwAuth)
                                           throws ParseException
        Parses a UserInfo error response from the specified HTTP response WWW-Authenticate header.
        Parameters:
        wwwAuth - The WWW-Authenticate header value to parse. Must not be null.
        Returns:
        The UserInfo error response.
        Throws:
        ParseException - If the WWW-Authenticate header value couldn't be parsed to a UserInfo error response.
      • parse

        public static UserInfoErrorResponse parse​(HTTPResponse httpResponse)
                                           throws ParseException
        Parses a UserInfo error response from the specified HTTP response.

        Note: The HTTP status code is not checked for matching the error code semantics.

        Parameters:
        httpResponse - The HTTP response to parse. Its status code must not be 200 (OK). Must not be null.
        Returns:
        The UserInfo error response.
        Throws:
        ParseException - If the HTTP response couldn't be parsed to a UserInfo error response.