com.nimbusds.oauth2.sdk
Class TokenErrorResponse

java.lang.Object
  extended by com.nimbusds.oauth2.sdk.TokenResponse
      extended by com.nimbusds.oauth2.sdk.TokenErrorResponse
All Implemented Interfaces:
ErrorResponse, Message, Response
Direct Known Subclasses:
OIDCTokenErrorResponse

@Immutable
public class TokenErrorResponse
extends TokenResponse
implements ErrorResponse

OAuth 2.0 Token error response. This class is immutable.

Standard token errors:

Example HTTP response:

 HTTP/1.1 400 Bad Request
 Content-Type: application/json
 Cache-Control: no-store
 Pragma: no-cache
 
 {
  "error": "invalid_request"
 }
 

Related specifications:

Author:
Vladimir Dzhuvinov

Constructor Summary
protected TokenErrorResponse()
          Creates a new OAuth 2.0 Access Token error response.
  TokenErrorResponse(ErrorObject error)
          Creates a new OAuth 2.0 Access Token error response.
 
Method Summary
 ErrorObject getErrorObject()
          Gets the error associated with the error response.
static Set<ErrorObject> getStandardErrors()
          Gets the standard OAuth 2.0 errors for an Access Token error response.
static TokenErrorResponse parse(HTTPResponse httpResponse)
          Parses an OAuth 2.0 Token Error response from the specified HTTP response.
static TokenErrorResponse parse(net.minidev.json.JSONObject jsonObject)
          Parses an OAuth 2.0 Token Error response from the specified JSON object.
 HTTPResponse toHTTPResponse()
          Returns the matching HTTP response.
 net.minidev.json.JSONObject toJSONObject()
          Returns the JSON object for this token error response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenErrorResponse

protected TokenErrorResponse()
Creates a new OAuth 2.0 Access Token error response. No OAuth 2.0 error is specified.


TokenErrorResponse

public TokenErrorResponse(ErrorObject error)
Creates a new OAuth 2.0 Access Token error response.

Parameters:
error - The error. Should match one of the standard errors for a token error response. Must not be null.
Method Detail

getStandardErrors

public static Set<ErrorObject> getStandardErrors()
Gets the standard OAuth 2.0 errors for an Access Token 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.

toJSONObject

public net.minidev.json.JSONObject toJSONObject()
Returns the JSON object for this token error response.

Returns:
The JSON object for this token error response.

toHTTPResponse

public HTTPResponse toHTTPResponse()
Description copied from interface: Response
Returns the matching HTTP response.

Specified by:
toHTTPResponse in interface Response
Returns:
The HTTP response.

parse

public static TokenErrorResponse parse(net.minidev.json.JSONObject jsonObject)
                                throws ParseException
Parses an OAuth 2.0 Token Error response from the specified JSON object.

Parameters:
jsonObject - The JSON object to parse. Its status code must not be 200 (OK). Must not be null.
Throws:
ParseException - If the JSON object couldn't be parsed to an OAuth 2.0 Token Error response.

parse

public static TokenErrorResponse parse(HTTPResponse httpResponse)
                                throws ParseException
Parses an OAuth 2.0 Token Error response from the specified HTTP response.

Parameters:
httpResponse - The HTTP response to parse. Its status code must not be 200 (OK). Must not be null.
Throws:
ParseException - If the HTTP response couldn't be parsed to an OAuth 2.0 Token Error response.


Copyright © 2013 NimbusDS. All Rights Reserved.