com.nimbusds.oauth2.sdk
Class AuthorizationErrorResponse

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.AuthorizationResponse
      extended by com.nimbusds.oauth2.sdk.AuthorizationErrorResponse
All Implemented Interfaces:
ErrorResponse, Message, Response
Direct Known Subclasses:
OIDCAuthorizationErrorResponse

@Immutable
public class AuthorizationErrorResponse
extends AuthorizationResponse
implements ErrorResponse

Authorisation error response. This class is immutable.

Standard authorisation errors:

Example HTTP response:

 HTTP/1.1 302 Found
 Location: https://client.example.com/cb?
 error=invalid_request
 &error_description=the%20request%20is%20not%20valid%20or%20malformed
 &state=af0ifjsldkj
 

Related specifications:

Author:
Vladimir Dzhuvinov

Constructor Summary
AuthorizationErrorResponse(URL redirectURI, ErrorObject error, ResponseType rt, State state)
          Creates a new authorisation error response.
 
Method Summary
 ErrorObject getErrorObject()
          Gets the error associated with the error response.
 ResponseType getResponseType()
          Gets the response type.
static Set<ErrorObject> getStandardErrors()
          Gets the standard OAuth 2.0 errors for an Authorisation error response.
static AuthorizationErrorResponse parse(HTTPResponse httpResponse)
          Parses an authorisation error response from the specified HTTP response.
static AuthorizationErrorResponse parse(URL uri)
          Parses an authorisation error response from the specified URI.
static AuthorizationErrorResponse parse(URL redirectURI, Map<String,String> params)
          Parses an authorisation error response from the specified redirect URI and parameters.
 Map<String,String> toParameters()
          Returns the parameters of this authorisation response.
 URL toURI()
          Returns the URI representation (redirect URI + fragment / query string) of this authorisation response.
 
Methods inherited from class com.nimbusds.oauth2.sdk.AuthorizationResponse
getRedirectURI, getState, toHTTPResponse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nimbusds.oauth2.sdk.Response
toHTTPResponse
 

Constructor Detail

AuthorizationErrorResponse

public AuthorizationErrorResponse(URL redirectURI,
                                  ErrorObject error,
                                  ResponseType rt,
                                  State state)
Creates a new authorisation error response.

Parameters:
redirectURI - The base redirect URI. Must not be null.
error - The error. Should match one of the standard errors for an authorisation error response. Must not be null.
rt - The response type, used to determine the redirect URI composition. If unknown null.
state - The state, null if not requested.
Method Detail

getStandardErrors

public static Set<ErrorObject> getStandardErrors()
Gets the standard OAuth 2.0 errors for an Authorisation error response.

Returns:
The standard errors, as a read-only set.

getErrorObject

public ErrorObject getErrorObject()
Description copied from interface: ErrorResponse
Gets the error associated with the error response.

Specified by:
getErrorObject in interface ErrorResponse
Returns:
The error, null if none.

getResponseType

public ResponseType getResponseType()
Gets the response type.

Returns:
The response type, null if not specified.

toParameters

public Map<String,String> toParameters()
Description copied from class: AuthorizationResponse
Returns the parameters of this authorisation response.

Example parameters (authorisation success):

 access_token = 2YotnFZFEjr1zCsicMWpAA
 state = xyz
 token_type = example
 expires_in = 3600
 

Specified by:
toParameters in class AuthorizationResponse
Returns:
The parameters as a map.

toURI

public URL toURI()
          throws SerializeException
Description copied from class: AuthorizationResponse
Returns the URI representation (redirect URI + fragment / query string) of this authorisation response.

Example URI:

 http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA
 &state=xyz
 &token_type=example
 &expires_in=3600
 

Specified by:
toURI in class AuthorizationResponse
Returns:
The URI representation of this authorisation response.
Throws:
SerializeException - If this response couldn't be serialised to a URI.

parse

public static AuthorizationErrorResponse parse(URL redirectURI,
                                               Map<String,String> params)
                                        throws ParseException
Parses an authorisation error response from the specified redirect URI and parameters.

Parameters:
redirectURI - The base redirect 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(URL uri)
                                        throws ParseException
Parses an authorisation error response from the specified URI.

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. 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 HTTP response.

Example HTTP response:

 HTTP/1.1 302 Found
 Location: https://client.example.com/cb?
 error=invalid_request
 &error_description=the%20request%20is%20not%20valid%20or%20malformed
 &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.


Copyright © 2013 NimbusDS. All Rights Reserved.