public class DeviceVerificationResponse extends ApiResponse
/api/device/verification API.
Authlete's /api/device/verification 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.
VALID
When the value of action is VALID, it means that the user
code exists, has not expired, and belongs to the service. The authorization
server implementation should interact with the end-user to ask whether she
approves or rejects the authorization request from the device.
EXPIRED
When the value of action is EXPIRED, it means that the user
code has expired. The authorization server implementation should tell the
end-user that the user code has expired and urge her to re-initiate a device
flow.
NOT_EXIST
When the value of action is NOT_EXIST, it means that the
user code does not exist. The authorization server implementation should
tell the end-user that the user code is invalid and urge her to retry to
input a valid user code.
SERVER_ERROR
When the value of action is SERVER_ERROR, it means that an
error occurred on Authlete side. The authorization server implementation
should tell the end-user that something wrong happened and urge her to
re-initiate a device flow.
| Modifier and Type | Class and Description |
|---|---|
static class |
DeviceVerificationResponse.Action
The next action that the authorization server implementation should take.
|
| Constructor and Description |
|---|
DeviceVerificationResponse() |
| Modifier and Type | Method and Description |
|---|---|
String[] |
getAcrs()
Get the list of ACR values requested by the device authorization
request.
|
DeviceVerificationResponse.Action |
getAction()
Get the next action that the authorization server should take.
|
AuthzDetails |
getAuthorizationDetails()
Get the authorization details.
|
String[] |
getClaimNames()
Get the names of the claims which were requested indirectly via some
special scopes.
|
Pair[] |
getClientAttributes()
Get the attributes of the client.
|
long |
getClientId()
Get the client ID of the client application to which the user code has
been issued.
|
String |
getClientIdAlias()
Get the client ID alias of the client application to which the user code
has been issued.
|
String |
getClientIdentifier()
Get the client identifier used in the device authorization request for
the user code.
|
String |
getClientName()
Get the name of the client application to which the user code has been
issued.
|
DynamicScope[] |
getDynamicScopes()
Get the dynamic scopes which the client application requested
by the
scope request parameter. |
long |
getExpiresAt()
Get the date in milliseconds since the Unix epoch (1970-01-01)
at which the user code will expire.
|
GMAction |
getGmAction()
Get the value of the
grant_management_action request parameter
of the device authorization request. |
Grant |
getGrant()
Get the content of the grant which is identified by the
grant_id
request parameter of the device authorization request. |
String |
getGrantId()
Get the value of the
grant_id request parameter of the device
authorization request. |
String |
getGrantSubject()
Get the subject of the user who has given the grant which is identified
by the
grant_id request parameter of the device authorization
request. |
URI[] |
getResources()
Get the resources specified by the
resource request parameters
in the preceding device authorization request. |
Scope[] |
getScopes()
Get the scopes requested by the device authorization request for the
user code.
|
Pair[] |
getServiceAttributes()
Get the attributes of the service that the client application belongs to.
|
boolean |
isClientIdAliasUsed()
Get the flag which indicates whether the client ID alias was used in
the device authorization request for the user code.
|
DeviceVerificationResponse |
setAcrs(String[] acrs)
Set the list of ACR values requested by the device authorization
request.
|
DeviceVerificationResponse |
setAction(DeviceVerificationResponse.Action action)
Set the next action that the authorization server should take.
|
DeviceVerificationResponse |
setAuthorizationDetails(AuthzDetails details)
Set the authorization details.
|
DeviceVerificationResponse |
setClaimNames(String[] names)
Set the names of the claims which were requested indirectly via some
special scopes.
|
DeviceVerificationResponse |
setClientAttributes(Pair[] attributes)
Set the attributes of the client.
|
DeviceVerificationResponse |
setClientId(long clientId)
Set the client ID of the client application to which the user code has
been issued.
|
DeviceVerificationResponse |
setClientIdAlias(String alias)
Set the client ID alias of the client application to which the user code
has been issued.
|
DeviceVerificationResponse |
setClientIdAliasUsed(boolean used)
Set the flag which indicates whether the client ID alias was used in
the device authorization request for the user code.
|
DeviceVerificationResponse |
setClientName(String name)
Set the name of the client application to which the user code has been
issued.
|
DeviceVerificationResponse |
setDynamicScopes(DynamicScope[] dynamicScopes)
Set the dynamic scopes which the client application requested
by the
scope request parameter. |
DeviceVerificationResponse |
setExpiresAt(long expiresAt)
Set the date in milliseconds since the Unix epoch (1970-01-01)
at which the user code will expire.
|
DeviceVerificationResponse |
setGmAction(GMAction action)
Set the value of the
grant_management_action request parameter
of the device authorization request. |
DeviceVerificationResponse |
setGrant(Grant grant)
Set the content of the grant which is identified by the
grant_id
request parameter of the device authorization request. |
DeviceVerificationResponse |
setGrantId(String grantId)
Set the value of the
grant_id request parameter of the device
authorization request. |
DeviceVerificationResponse |
setGrantSubject(String subject)
Set the subject of the user who has given the grant which is identified
by the
grant_id request parameter of the device authorization
request. |
DeviceVerificationResponse |
setResources(URI[] resources)
Set the resources specified by the
resource request parameters
in the preceding device authorization request. |
DeviceVerificationResponse |
setScopes(Scope[] scopes)
Set the scopes requested by the device authorization request for the
user code.
|
DeviceVerificationResponse |
setServiceAttributes(Pair[] attributes)
Set the attributes of the service that the client application belongs to.
|
getResultCode, getResultMessage, setResultCode, setResultMessagepublic DeviceVerificationResponse.Action getAction()
public DeviceVerificationResponse setAction(DeviceVerificationResponse.Action action)
action - The next action.this object.public long getClientId()
public DeviceVerificationResponse setClientId(long clientId)
clientId - The client ID of the client application.this object.public String getClientIdAlias()
public DeviceVerificationResponse 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 DeviceVerificationResponse 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 DeviceVerificationResponse setClientName(String name)
name - The name of the client application.this object.public Scope[] getScopes()
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 DeviceVerificationResponse setScopes(Scope[] scopes)
scopes - The requested scopes.this object.public DynamicScope[] getDynamicScopes()
scope request parameter. See the description of
DynamicScope for details.DynamicScopepublic DeviceVerificationResponse setDynamicScopes(DynamicScope[] dynamicScopes)
scope request parameter. See the description of
DynamicScope for details.dynamicScopes - The list of dynamic scopes.this object.DynamicScopepublic 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 DeviceVerificationResponse setClaimNames(String[] names)
names - The names of the requested claims.this object.public String[] getAcrs()
public DeviceVerificationResponse setAcrs(String[] acrs)
acrs - The list of requested ACR values.this object.public long getExpiresAt()
public DeviceVerificationResponse setExpiresAt(long expiresAt)
expiresAt - The expiration date in milliseconds since the Unix epoch
(1970-01-01) at which the user code will expire.this object.public URI[] getResources()
resource request parameters
in the preceding device authorization request.
See "Resource Indicators for OAuth 2.0" for details.public DeviceVerificationResponse setResources(URI[] resources)
resource request parameters
in the preceding device authorization request.
See "Resource Indicators for OAuth 2.0" for details.resources - Target resources.this object.public AuthzDetails getAuthorizationDetails()
"authorization_details" request parameter which is defined in
"OAuth 2.0 Rich Authorization Requests".public DeviceVerificationResponse setAuthorizationDetails(AuthzDetails details)
"authorization_details" request parameter which is defined in
"OAuth 2.0 Rich Authorization Requests".details - Authorization details.this object.public GMAction getGmAction()
grant_management_action request parameter
of the device authorization request.
The grant_management_action request parameter is defined in
Grant
Management for OAuth 2.0, which is supported by Authlete 2.3 and
newer versions.
null or one of
CREATE, REPLACE
and UPDATE.public DeviceVerificationResponse setGmAction(GMAction action)
grant_management_action request parameter
of the device authorization request.
The grant_management_action request parameter is defined in
Grant
Management for OAuth 2.0, which is supported by Authlete 2.3 and
newer versions.
action - A grant management action. null or one of
CREATE, REPLACE
and UPDATE.this object.public String getGrantId()
grant_id request parameter of the device
authorization request.
The grant_id request parameter is defined in
Grant
Management for OAuth 2.0, which is supported by Authlete 2.3 and
newer versions.
public DeviceVerificationResponse setGrantId(String grantId)
grant_id request parameter of the device
authorization request.
The grant_id request parameter is defined in
Grant
Management for OAuth 2.0, which is supported by Authlete 2.3 and
newer versions.
grantId - A grant ID.this object.public String getGrantSubject()
grant_id request parameter of the device authorization
request.
Authlete 2.3 and newer versions support Grant Management
for OAuth 2.0. An authorization request may contain a grant_id
request parameter which is defined in the specification. If the value of
the request parameter is valid, getGrantSubject() will return
the subject of the user who has given the grant to the client application.
Authorization server implementations may use the value returned from
getGrantSubject() in order to determine the user to authenticate.
The user your system will authenticate during the authorization process
(or has already authenticated) may be different from the user of the
grant. The first implementer's draft of "Grant Management for OAuth 2.0"
does not mention anything about the case, so the behavior in the case is
left to implementations. Authlete will not perform the grant management
action when the subject passed to Authlete does not match the
user of the grant.
public DeviceVerificationResponse setGrantSubject(String subject)
grant_id request parameter of the device authorization
request.
Authlete 2.3 and newer versions support Grant Management
for OAuth 2.0. An authorization request may contain a grant_id
request parameter which is defined in the specification. If the value of
the request parameter is valid, getGrantSubject() will return
the subject of the user who has given the grant to the client application.
Authorization server implementations may use the value returned from
getGrantSubject() in order to determine the user to authenticate.
The user your system will authenticate during the authorization process
(or has already authenticated) may be different from the user of the
grant. The first implementer's draft of "Grant Management for OAuth 2.0"
does not mention anything about the case, so the behavior in the case is
left to implementations. Authlete will not perform the grant management
action when the subject passed to Authlete does not match the
user of the grant.
subject - The subject of the user who has given the grant.this object.public Grant getGrant()
grant_id
request parameter of the device authorization request.
The user your system will authenticate during the authorization process (or has already authenticated) may be different from the user of the grant. Be careful when your system displays the content of the grant.
public DeviceVerificationResponse setGrant(Grant grant)
grant_id
request parameter of the device authorization request.
The user your system will authenticate during the authorization process (or has already authenticated) may be different from the user of the grant. Be careful when your system displays the content of the grant.
grant - The content of the grant.this object.public Pair[] getServiceAttributes()
This property is available since Authlete 2.2.
public DeviceVerificationResponse setServiceAttributes(Pair[] attributes)
This property is available since Authlete 2.2.
attributes - The attributes of the service.this object.public Pair[] getClientAttributes()
This property is available since Authlete 2.2.
public DeviceVerificationResponse setClientAttributes(Pair[] attributes)
This property is available since Authlete 2.2.
attributes - The attributes of the client.this object.Copyright © 2022. All rights reserved.