Package com.nimbusds.oauth2.sdk
Class TokenErrorResponse
java.lang.Object
com.nimbusds.oauth2.sdk.TokenResponse
com.nimbusds.oauth2.sdk.TokenErrorResponse
- All Implemented Interfaces:
ErrorResponse
,Message
,Response
OAuth 2.0 Token error response.
Standard token errors:
OAuth2Error.INVALID_REQUEST
OAuth2Error.INVALID_CLIENT
OAuth2Error.INVALID_GRANT
OAuth2Error.UNAUTHORIZED_CLIENT
OAuth2Error.UNSUPPORTED_GRANT_TYPE
OAuth2Error.INVALID_SCOPE
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:
- OAuth 2.0 (RFC 6749), section 5.2.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionGets the error associated with the error response.static Set<ErrorObject>
Gets the standard OAuth 2.0 errors for an Access Token error response.boolean
Checks if the response indicates success.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.Returns the matching HTTP response.net.minidev.json.JSONObject
Returns the JSON object for this token error response.Methods inherited from class com.nimbusds.oauth2.sdk.TokenResponse
toErrorResponse, toSuccessResponse
-
Constructor Details
-
TokenErrorResponse
protected TokenErrorResponse()Creates a new OAuth 2.0 Access Token error response. No OAuth 2.0 error is specified. -
TokenErrorResponse
Creates a new OAuth 2.0 Access Token error response.- Parameters:
error
- The error. Should match one of thestandard errors
for a token error response. Must not benull
.
-
-
Method Details
-
getStandardErrors
Gets the standard OAuth 2.0 errors for an Access Token error response.- Returns:
- The standard errors, as a read-only set.
-
indicatesSuccess
Description copied from interface:Response
Checks if the response indicates success.- Specified by:
indicatesSuccess
in interfaceResponse
- Returns:
true
if the response indicates success, elsefalse
.
-
getErrorObject
Description copied from interface:ErrorResponse
Gets the error associated with the error response.- Specified by:
getErrorObject
in interfaceErrorResponse
- Returns:
- The error,
null
if none.
-
toJSONObject
Returns the JSON object for this token error response.- Returns:
- The JSON object for this token error response.
-
toHTTPResponse
Description copied from interface:Response
Returns the matching HTTP response.- Specified by:
toHTTPResponse
in interfaceResponse
- 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 benull
.- Returns:
- The token error response.
- Throws:
ParseException
- If the JSON object couldn't be parsed to an OAuth 2.0 Token Error response.
-
parse
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 benull
.- Returns:
- The token error response.
- Throws:
ParseException
- If the HTTP response couldn't be parsed to an OAuth 2.0 Token Error response.
-