@Immutable public class AuthorizationErrorResponse extends AuthorizationResponse implements ErrorResponse
Standard authorisation errors:
OAuth2Error.INVALID_REQUEST
OAuth2Error.UNAUTHORIZED_CLIENT
OAuth2Error.ACCESS_DENIED
OAuth2Error.UNSUPPORTED_RESPONSE_TYPE
OAuth2Error.INVALID_SCOPE
OAuth2Error.SERVER_ERROR
OAuth2Error.TEMPORARILY_UNAVAILABLE
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:
Constructor and Description |
---|
AuthorizationErrorResponse(URI redirectURI,
ErrorObject error,
ResponseType rt,
State state)
Creates a new authorisation error response.
|
AuthorizationErrorResponse(URI redirectURI,
ErrorObject error,
State state)
Creates a new authorisation error response, with no specified
response type to determine the redirection URI composition.
|
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
indicatesSuccess()
Checks if the response indicates success.
|
static AuthorizationErrorResponse |
parse(HTTPResponse httpResponse)
Parses an authorisation error response from the specified HTTP
response.
|
static AuthorizationErrorResponse |
parse(URI uri)
Parses an authorisation error response from the specified URI.
|
static AuthorizationErrorResponse |
parse(URI 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.
|
URI |
toURI()
Returns the URI representation (redirection URI + fragment / query
string) of this authorisation response.
|
getRedirectionURI, getState, toHTTPResponse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toHTTPResponse
public AuthorizationErrorResponse(URI redirectURI, ErrorObject error, ResponseType rt, State state)
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
.rt
- The response type, used to determine the
redirection URI composition. If unknown
null
.state
- The state, null
if not requested.public AuthorizationErrorResponse(URI redirectURI, ErrorObject error, State state)
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.public static Set<ErrorObject> getStandardErrors()
public boolean indicatesSuccess()
Response
indicatesSuccess
in interface Response
true
if the response indicates success, else
false
.public ErrorObject getErrorObject()
ErrorResponse
getErrorObject
in interface ErrorResponse
null
if none.public ResponseType getResponseType()
null
if not specified.public Map<String,String> toParameters()
AuthorizationResponse
Example parameters (authorisation success):
access_token = 2YotnFZFEjr1zCsicMWpAA state = xyz token_type = example expires_in = 3600
toParameters
in class AuthorizationResponse
public URI toURI() throws SerializeException
AuthorizationResponse
Example URI:
http://example.com/cb#access_token=2YotnFZFEjr1zCsicMWpAA &state=xyz &token_type=example &expires_in=3600
toURI
in class AuthorizationResponse
SerializeException
- If this response couldn't be serialised
to a URI.public static AuthorizationErrorResponse parse(URI redirectURI, Map<String,String> params) throws ParseException
redirectURI
- The base redirection URI. Must not be
null
.params
- The response parameters to parse. Must not be
null
.ParseException
- If the parameters couldn't be parsed to an
authorisation error response.public static AuthorizationErrorResponse parse(URI uri) throws ParseException
Example URI:
https://client.example.com/cb? error=invalid_request &error_description=the%20request%20is%20not%20valid%20or%20malformed &state=af0ifjsldkj
uri
- The URI to parse. Can be absolute or relative. Must not
be null
.ParseException
- If the URI couldn't be parsed to an
authorisation error response.public static AuthorizationErrorResponse parse(HTTPResponse httpResponse) throws ParseException
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
httpResponse
- The HTTP response to parse. Must not be
null
.ParseException
- If the HTTP response couldn't be parsed to an
authorisation error response.Copyright © 2015 Connect2id Ltd.. All Rights Reserved.