Message
, Response
, SuccessResponse
@Immutable public class DeviceAuthorizationSuccessResponse extends DeviceAuthorizationResponse implements SuccessResponse
Example HTTP response:
HTTP/1.1 200 OK Content-Type: application/json;charset=UTF-8 Cache-Control: no-store Pragma: no-cache { "device_code" : "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS", "user_code" : "WDJB-MJHT", "verification_uri" : "https://example.com/device", "verification_uri_complete" : "https://example.com/device?user_code=WDJB-MJHT", "expires_in" : 1800, "interval" : 5 }
Related specifications:
Constructor | Description |
---|---|
DeviceAuthorizationSuccessResponse(DeviceCode deviceCode,
UserCode userCode,
URI verificationURI,
long lifetime) |
Creates a new device authorization success response.
|
DeviceAuthorizationSuccessResponse(DeviceCode deviceCode,
UserCode userCode,
URI verificationURI,
URI verificationURIComplete,
long lifetime,
long interval,
Map<String,Object> customParams) |
Creates a new device authorization success response.
|
Modifier and Type | Method | Description |
---|---|---|
Map<String,Object> |
getCustomParameters() |
Returns the custom parameters.
|
DeviceCode |
getDeviceCode() |
Returns the device verification code.
|
long |
getInterval() |
Returns the minimum amount of time in seconds that the client SHOULD
wait between polling requests to the token endpoint.
|
long |
getLifetime() |
Returns the lifetime in seconds of the "device_code" and "user_code".
|
static Set<String> |
getRegisteredParameterNames() |
Returns the registered (standard) OAuth 2.0 device authorization
response parameter names.
|
UserCode |
getUserCode() |
Returns the end-user verification code.
|
URI |
getVerificationUri() |
Deprecated.
|
URI |
getVerificationURI() |
Returns the end-user verification URI on the authorization server.
|
URI |
getVerificationUriComplete() |
Deprecated.
|
URI |
getVerificationURIComplete() |
Returns the end-user verification URI that includes the user_code.
|
boolean |
indicatesSuccess() |
Checks if the response indicates success.
|
static DeviceAuthorizationSuccessResponse |
parse(HTTPResponse httpResponse) |
Parses an device authorization response from the specified HTTP
response.
|
static DeviceAuthorizationSuccessResponse |
parse(net.minidev.json.JSONObject jsonObject) |
Parses an device authorization response from the specified JSON
object.
|
HTTPResponse |
toHTTPResponse() |
Returns the matching HTTP response.
|
net.minidev.json.JSONObject |
toJSONObject() |
Returns a JSON object representation of this device authorization
response.
|
toErrorResponse, toSuccessResponse
public DeviceAuthorizationSuccessResponse(DeviceCode deviceCode, UserCode userCode, URI verificationURI, long lifetime)
deviceCode
- The device verification code. Must not be
null
.userCode
- The user verification code. Must not be
null
.verificationURI
- The end-user verification URI on the
authorization server. Must not be
null
.lifetime
- The lifetime in seconds of the "device_code"
and "user_code".public DeviceAuthorizationSuccessResponse(DeviceCode deviceCode, UserCode userCode, URI verificationURI, URI verificationURIComplete, long lifetime, long interval, Map<String,Object> customParams)
deviceCode
- The device verification code. Must
not be null
.userCode
- The user verification code. Must not
be null
.verificationURI
- The end-user verification URI on the
authorization server. Must not be
null
.verificationURIComplete
- The end-user verification URI on the
authorization server that includes
the user_code. Can be null
.lifetime
- The lifetime in seconds of the
"device_code" and "user_code". Must
be greater than 0
.interval
- The minimum amount of time in seconds
that the client SHOULD wait between
polling requests to the token
endpoint.customParams
- Optional custom parameters,
null
if none.public static Set<String> getRegisteredParameterNames()
public boolean indicatesSuccess()
Response
indicatesSuccess
in interface Response
true
if the response indicates success, else
false
.public DeviceCode getDeviceCode()
public UserCode getUserCode()
public URI getVerificationURI()
@Deprecated public URI getVerificationUri()
getVerificationURI()
public URI getVerificationURIComplete()
null
if not specified.@Deprecated public URI getVerificationUriComplete()
getVerificationURIComplete()
public long getLifetime()
public long getInterval()
public Map<String,Object> getCustomParameters()
public net.minidev.json.JSONObject toJSONObject()
Example JSON object:
{ "device_code" : "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS", "user_code" : "WDJB-MJHT", "verification_uri" : "https://example.com/device", "verification_uri_complete" : "https://example.com/device?user_code=WDJB-MJHT", "expires_in" : 1800, "interval" : 5 }
public HTTPResponse toHTTPResponse()
Response
toHTTPResponse
in interface Response
public static DeviceAuthorizationSuccessResponse parse(net.minidev.json.JSONObject jsonObject) throws ParseException
jsonObject
- The JSON object to parse. Must not be null
.ParseException
- If the JSON object couldn't be parsed to a
device authorization response.public static DeviceAuthorizationSuccessResponse parse(HTTPResponse httpResponse) throws ParseException
httpResponse
- The HTTP response. Must not be null
.ParseException
- If the HTTP response couldn't be parsed to a
device authorization response.Copyright © 2019 Connect2id Ltd.. All rights reserved.