public class DeviceAuthorizationResponse extends ApiResponse
/api/device/authorization API.
Authlete's /api/device/authorization API returns JSON which can
be mapped to this class. The authorization server implementation should
retrieve the value of action from the response and take the
following steps according to the value.
OK
When the value of action is OK, it means that the device
authorization request from the client application is valid.
The authorization server implementation should generate a response to the
client application with 200 OK and application/json.
The getResponseContent() method returns a JSON string which can
be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
BAD_REQUEST
When the value of action is BAD_REQUEST, it means that the
device authorization request from the client application was wrong.
The authorization server implementation should generate a response to the
client application with 400 Bad Request and application/json.
The getResponseContent() method returns a JSON string which
describes the error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
UNAUTHORIZED
When the value of action is UNAUTHORIZED, it means that
client authentication of the device authorization request failed.
The authorization server implementation should generate a response to the
client application with 401 Unauthorized and application/json.
The getResponseContent() method returns a JSON string which
describes the error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 401 Unauthorized
WWW-Authenticate: (challenge)
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
INTERNAL_SERVER_ERROR
When the value of action is INTERNAL_SERVER_ERROR, it means
that the API call from the authorization server implementation was wrong or
that an error occurred in Authlete.
In either case, from a viewpoint of the client application, it is an error
on the server side. Therefore, the authorization server implementation
should generate a response to the client application with
500 Internal Server Error and application/json.
The getResponseContent() method returns a JSON string which
describes the error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
| Modifier and Type | Class and Description |
|---|---|
static class |
DeviceAuthorizationResponse.Action
The next action that the authorization server implementation should take.
|
| Constructor and Description |
|---|
DeviceAuthorizationResponse() |
| Modifier and Type | Method and Description |
|---|---|
String[] |
getAcrs()
Get the list of ACR values requested by the device authorization
request.
|
DeviceAuthorizationResponse.Action |
getAction()
Get the next action that the implementation of the device authorization
endpoint should take.
|
String[] |
getClaimNames()
Get the names of the claims which were requested indirectly via some
special scopes.
|
ClientAuthMethod |
getClientAuthMethod()
Get the client authentication method that should be performed at the
device authorization endpoint.
|
long |
getClientId()
Get the client ID of the client application that has made the device
authorization request.
|
String |
getClientIdAlias()
Get the client ID alias of the client application that has made the
device authorization request.
|
String |
getClientIdentifier()
Get the client identifier used in the device authorization request.
|
String |
getClientName()
Get the name of the client application which has made the device
authorization request.
|
String |
getDeviceCode()
Get the device verification code.
|
int |
getExpiresIn()
Get the duration of the issued device verification code and end-user
verification code in seconds.
|
int |
getInterval()
Get the minimum amount of time in seconds that the client must wait for
between polling requests to the token endpoint.
|
String |
getResponseContent()
Get the content that can be used to generate a response to the client
application.
|
Scope[] |
getScopes()
Get the scopes requested by the device authorization request.
|
String |
getUserCode()
Get the end-user verification code.
|
URI |
getVerificationUri()
Get the end-user verification URI.
|
URI |
getVerificationUriComplete()
Get the end-user verification URI that includes the end-user verification
code.
|
String[] |
getWarnings()
Get the warnings raised during processing the device authorization
request.
|
boolean |
isClientIdAliasUsed()
Get the flag which indicates whether the client ID alias was used in
the device authorization request.
|
DeviceAuthorizationResponse |
setAcrs(String[] acrs)
Set the list of ACR values requested by the device authorization
request.
|
DeviceAuthorizationResponse |
setAction(DeviceAuthorizationResponse.Action action)
Set the next action that the implementation of the device authorization
endpoint should take.
|
DeviceAuthorizationResponse |
setClaimNames(String[] names)
Set the names of the claims which were requested indirectly via some
special scopes.
|
DeviceAuthorizationResponse |
setClientAuthMethod(ClientAuthMethod method)
Set the client authentication method that should be performed at the
device authorization endpoint.
|
DeviceAuthorizationResponse |
setClientId(long clientId)
Set the client ID of the client application that has made the device
authorization request.
|
DeviceAuthorizationResponse |
setClientIdAlias(String alias)
Set the client ID alias of the client application that has made the
device authorization request.
|
DeviceAuthorizationResponse |
setClientIdAliasUsed(boolean used)
Set the flag which indicates whether the client ID alias was used in
the device authorization request.
|
DeviceAuthorizationResponse |
setClientName(String name)
Set the name of the client application which has made the device
authorization request.
|
DeviceAuthorizationResponse |
setDeviceCode(String code)
Set the device verification code.
|
DeviceAuthorizationResponse |
setExpiresIn(int expiresIn)
Set the duration of the issued device verification code and end-user
verification code in seconds.
|
DeviceAuthorizationResponse |
setInterval(int interval)
Set the minimum amount of time in seconds that the client must wait for
between polling requests to the token endpoint.
|
DeviceAuthorizationResponse |
setResponseContent(String responseContent)
Set the content that can be used to generate a response to the client
application.
|
DeviceAuthorizationResponse |
setScopes(Scope[] scopes)
Set the scopes requested by the device authorization request.
|
DeviceAuthorizationResponse |
setUserCode(String code)
Set the end-user verification code.
|
DeviceAuthorizationResponse |
setVerificationUri(URI uri)
Set the end-user verification URI.
|
DeviceAuthorizationResponse |
setVerificationUriComplete(URI uri)
Set the end-user verification URI that includes the end-user verification
code.
|
DeviceAuthorizationResponse |
setWarnings(String[] warnings)
Set the warnings raised during processing the device authorization
request.
|
getResultCode, getResultMessage, setResultCode, setResultMessagepublic DeviceAuthorizationResponse.Action getAction()
public DeviceAuthorizationResponse setAction(DeviceAuthorizationResponse.Action action)
action - The next action.this object.public String getResponseContent()
public DeviceAuthorizationResponse setResponseContent(String responseContent)
responseContent - The content of a response to the client.this object.public long getClientId()
public DeviceAuthorizationResponse setClientId(long clientId)
clientId - The client ID of the client application.this object.public String getClientIdAlias()
public DeviceAuthorizationResponse setClientIdAlias(String alias)
alias - The client ID alias of the client application.this object.public boolean isClientIdAliasUsed()
true if the client ID alias was used in the request.public DeviceAuthorizationResponse setClientIdAliasUsed(boolean used)
used - true to indicate that the client ID alias was used in
the request.this object.public String getClientIdentifier()
When isClientIdAliasUsed() returns true, this method
returns the same value as getClientIdAlias() does. Otherwise,
this method returns the string representation of the value returned
from getClientId().
public String getClientName()
public DeviceAuthorizationResponse setClientName(String name)
name - The name of the client application.this object.public ClientAuthMethod getClientAuthMethod()
If the client could not be identified by the information in the request,
this method returns null.
public DeviceAuthorizationResponse setClientAuthMethod(ClientAuthMethod method)
method - The client authentication method that should be performed at
the device authorization endpoint.this object.public Scope[] getScopes()
Basically, this method returns the value of the "scope" request
parameter in the device authorization request. However, because
unregistered scopes are dropped on Authlete side, if the "scope"
request parameter contains unknown scopes, the list returned by this
method becomes different from the value of the "scope" request
parameter.
Note that Scope.getDescription() method and
Scope.getDescriptions() method of each element (Scope
instance) in the array returned from this method always return
null even if descriptions of the scopes are registered.
public DeviceAuthorizationResponse setScopes(Scope[] scopes)
scopes - The requested scopes.this object.public String[] getClaimNames()
This method always returns null if the scope request
parameter of the device authorization request does not include the
openid scope even if special scopes (such as profile)
are included in the request (unless the openid scope is included
in the default set of scopes which is used when the scope
request parameter is omitted).
public DeviceAuthorizationResponse setClaimNames(String[] names)
names - The names of the requested claims.this object.public String[] getAcrs()
Basically, this method returns the value of the "acr_values"
request parameter in the device authorization request. However,
because unsupported ACR values are dropped on Authlete side, if the
"acr_values" request parameter contains unrecognized ACR
values, the list returned by this method becomes different from the
value of the "acr_values" request parameter.
If the request does not include the acr_values request
parameter, the value of the default_acr_values client metadata
is used.
public DeviceAuthorizationResponse setAcrs(String[] acrs)
acrs - The list of requested ACR values.this object.public String getDeviceCode()
device_code property in the response to the client.public DeviceAuthorizationResponse setDeviceCode(String code)
device_code property in the response to the client.code - The device verification code.this object.public String getUserCode()
user_code property in the response to the client.public DeviceAuthorizationResponse setUserCode(String code)
user_code property in the response to the client.code - The end-user verification code.this object.public URI getVerificationUri()
verification_uri property in the response to the client.public DeviceAuthorizationResponse setVerificationUri(URI uri)
verification_uri property in the response to the client.uri - The end-user verification URI.this object.public URI getVerificationUriComplete()
verification_uri_complete property
in the response to the client.public DeviceAuthorizationResponse setVerificationUriComplete(URI uri)
verification_uri_complete property
in the response to the client.uri - The end-user verification URI that includes the end-user
verification code.this object.public int getExpiresIn()
expires_in
property in the response to the client.public DeviceAuthorizationResponse setExpiresIn(int expiresIn)
expires_in
property in the response to the client.expiresIn - The duration of the issued device verification code and end-user
verification code in seconds.this object.public int getInterval()
interval property in the response to the client.public DeviceAuthorizationResponse setInterval(int interval)
interval property in the response to the client.interval - The minimum amount of time in seconds between polling requests.this object.public String[] getWarnings()
null.public DeviceAuthorizationResponse setWarnings(String[] warnings)
warnings - Warnings.this object.Copyright © 2019. All rights reserved.