Package com.nimbusds.oauth2.sdk.device
Class DeviceAuthorizationErrorResponse
java.lang.Object
com.nimbusds.oauth2.sdk.device.DeviceAuthorizationResponse
com.nimbusds.oauth2.sdk.device.DeviceAuthorizationErrorResponse
- All Implemented Interfaces:
ErrorResponse,Message,Response
@Immutable
public class DeviceAuthorizationErrorResponse
extends DeviceAuthorizationResponse
implements ErrorResponse
OAuth 2.0 device authorization error response.
Standard authorization 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:
- OAuth 2.0 Device Authorization Grant (RFC 8628)
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new OAuth 2.0 device authorization error response.Creates a new OAuth 2.0 device authorization 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 a device authorization error response.booleanChecks if the response indicates success.parse(HTTPResponse httpResponse) Parses an OAuth 2.0 ciba authorization error, push error or token response - from the specified HTTP response.parse(net.minidev.json.JSONObject jsonObject) Parses an OAuth 2.0 device authorization response from the specified JSON object.Returns the matching HTTP response.net.minidev.json.JSONObjectReturns the JSON object for this token error response.Methods inherited from class com.nimbusds.oauth2.sdk.device.DeviceAuthorizationResponse
toErrorResponse, toSuccessResponse
-
Constructor Details
-
DeviceAuthorizationErrorResponse
protected DeviceAuthorizationErrorResponse()Creates a new OAuth 2.0 device authorization error response. No OAuth 2.0 error is specified. -
DeviceAuthorizationErrorResponse
Creates a new OAuth 2.0 device authorization error response.- Parameters:
error- The error. Should match one of thestandard errorsfor a token error response. Must not benull.
-
-
Method Details
-
getStandardErrors
Gets the standard OAuth 2.0 errors for a device authorization error response.- Returns:
- The standard errors, as a read-only set.
-
indicatesSuccess
Description copied from interface:ResponseChecks if the response indicates success.- Specified by:
indicatesSuccessin interfaceResponse- Returns:
trueif the response indicates success, elsefalse.
-
getErrorObject
Description copied from interface:ErrorResponseGets the error associated with the error response.- Specified by:
getErrorObjectin interfaceErrorResponse- Returns:
- The error,
nullif 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:ResponseReturns the matching HTTP response.- Specified by:
toHTTPResponsein interfaceResponse- Returns:
- The HTTP response.
-
parse
public static DeviceAuthorizationErrorResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException Parses an OAuth 2.0 device authorization 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 device authorization error response.
-
parse
public static DeviceAuthorizationErrorResponse parse(HTTPResponse httpResponse) throws ParseException Parses an OAuth 2.0 ciba authorization error, push error or token 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 device authorization error response.
- Throws:
ParseException- If the HTTP response couldn't be parsed to an OAuth 2.0 device authorization error response.
-