Documentation

DeviceVerificationResponse extends ApiResponse

Response from Authlete's /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 the action response parameter (which can be obtained by getAction() method of this class) from the response and take the following steps according to the value.


When the value returned from getAction() method is DeviceVerificationAction::$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.


When the value returned from getAction() method is DeviceVerificationAction::$EXPIRED, it means that the 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.


When the value returned from getAction() method is DeviceVerificationAction::$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.


When the value returned from getAction() method is DeviceVerificationAction::$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.

Tags
since
1.8

Table of Contents

copyFromArray()  : mixed
Copy the content of the given array into this object.
copyToArray()  : mixed
Copy the content of this object into the given array.
fromArray()  : static
Convert an array into an instance of this class.
fromJson()  : static
Convert a JSON string into an instance of this class.
getAcrs()  : array<string|int, string>
Get the list of ACR values requestsed by the device authorization request.
getAction()  : DeviceVerificationAction
Get the next action that the authorization server should take.
getClaimNames()  : array<string|int, string>
Get the names of the claims which were requested indirectly via some special scopes. See [5.4. Requesting Claims using Scope Values](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims) in [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims) for details.
getClientId()  : int|string
Get the ID of the client application to which the user code has been issued.
getClientIdAlias()  : string
Get the client ID alias of the client application to which the user code has been issued.
getClientName()  : string
Get the name of the client application to which the user code has been issued.
getExpiresAt()  : int|string
Get the date in milliseconds since the Unix epoch (1970-Jan-01) at which the user code will expire.
getResources()  : array<string|int, string>
Get the resources specified by the `resource` request parameters in the preceding device authorization request.
getResultCode()  : string
Get the code of the result of an Authlete API call.
getResultMessage()  : string
Get the message of the result of an Authlete API call.
getScopes()  : array<string|int, Scope>
Get the scopes requested by the device authorization request for the user code.
isClientIdAliasUsed()  : bool
Get the flag which indicates whether the client ID alias was used in the device authorization request for the user code.
setAcrs()  : DeviceVerificationResponse
Set the list of ACR values requestsed by the device authorization request.
setAction()  : DeviceVerificationResponse
Set the next action that the authorization server should take.
setClaimNames()  : DeviceVerificationResponse
Set the names of the claims which were requested indirectly via some special scopes.
setClientId()  : DeviceVerificationResponse
Set the ID of the client application to which the user code has been issued.
setClientIdAlias()  : DeviceVerificationResponse
Set the client ID alias of the client application to which the user code has been issued.
setClientIdAliasUsed()  : DeviceVerificationResponse
Set the flag which indicates whether the client ID alias was used in the device authorization request for the user code.
setClientName()  : DeviceVerificationResponse
Set the name of the client application to which the user code has been issued.
setExpiresAt()  : DeviceVerificationResponse
Set the date in milliseconds since the Unix epoch (1970-Jan-01) at which the user code will expire.
setResources()  : DeviceVerificationResponse
Set the resources specified by the `resource` request parameters in the preceding device authorization request.
setResultCode()  : ApiResponse
Set the code of the result of an Authlete API call.
setResultMessage()  : ApiResponse
Set the message of the result of an Authlete API call.
setScopes()  : DeviceVerificationResponse
Set the scopes requested by the device authorization request for the user code.
toArray()  : array<string|int, mixed>
Convert this object into an array.
toJson()  : string
Convert this object into a JSON string.

Methods

copyFromArray()

Copy the content of the given array into this object.

public copyFromArray(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

copyToArray()

Copy the content of this object into the given array.

public copyToArray(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

fromArray()

Convert an array into an instance of this class.

public static fromArray([array<string|int, mixed> $array = null ]) : static

This static function returns a new instance of this class. If $array is null, null is returned.

Parameters
$array : array<string|int, mixed> = null

An array

Return values
static

An instance of this class.

fromJson()

Convert a JSON string into an instance of this class.

public static fromJson(string $json) : static

This static function returns a new instance of this class. If $json is null or the type of $json is not string, null is returned.

Parameters
$json : string

A JSON string.

Return values
static

An instance of this class.

getAcrs()

Get the list of ACR values requestsed by the device authorization request.

public getAcrs() : array<string|int, string>
Return values
array<string|int, string>

The list of requested ACR values.

getClaimNames()

Get the names of the claims which were requested indirectly via some special scopes. See [5.4. Requesting Claims using Scope Values](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims) in [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims) for details.

public getClaimNames() : array<string|int, string>

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).

Return values
array<string|int, string>

The names of the requested claims.

getClientId()

Get the ID of the client application to which the user code has been issued.

public getClientId() : int|string
Return values
int|string

The client ID.

getClientIdAlias()

Get the client ID alias of the client application to which the user code has been issued.

public getClientIdAlias() : string
Return values
string

The client ID alias.

getClientName()

Get the name of the client application to which the user code has been issued.

public getClientName() : string
Return values
string

The name of the client application.

getExpiresAt()

Get the date in milliseconds since the Unix epoch (1970-Jan-01) at which the user code will expire.

public getExpiresAt() : int|string
Return values
int|string

The expiration date in milliseconds since the Unix epoch (1970-Jan-01) at which the user code will expire.

getResources()

Get the resources specified by the `resource` request parameters in the preceding device authorization request.

public getResources() : array<string|int, string>
Tags
see
https://www.rfc-editor.org/rfc/rfc8707.html

RFC 8707 Resource Indicators for OAuth 2.0

Return values
array<string|int, string>

The target resources.

getResultCode()

Get the code of the result of an Authlete API call.

public getResultCode() : string
Return values
string

The result code.

getResultMessage()

Get the message of the result of an Authlete API call.

public getResultMessage() : string
Return values
string

The result message.

getScopes()

Get the scopes requested by the device authorization request for the user code.

public getScopes() : array<string|int, Scope>

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.

Return values
array<string|int, Scope>

The requested scopes.

isClientIdAliasUsed()

Get the flag which indicates whether the client ID alias was used in the device authorization request for the user code.

public isClientIdAliasUsed() : bool
Return values
bool

true if the client ID alias was used in the request.

setExpiresAt()

Set the date in milliseconds since the Unix epoch (1970-Jan-01) at which the user code will expire.

public setExpiresAt(int|string $expiresAt) : DeviceVerificationResponse
Parameters
$expiresAt : int|string

The expiration date in milliseconds since the Unix epoch (1970-Jan-01) at which the user code will expire.

Return values
DeviceVerificationResponse

$this object.

setResultCode()

Set the code of the result of an Authlete API call.

public setResultCode(string $resultCode) : ApiResponse
Parameters
$resultCode : string

The result code.

Return values
ApiResponse

$this object.

setResultMessage()

Set the message of the result of an Authlete API call.

public setResultMessage(string $resultMessage) : ApiResponse
Parameters
$resultMessage : string

The result message.

Return values
ApiResponse

$this object.

toArray()

Convert this object into an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array.

toJson()

Convert this object into a JSON string.

public toJson(int $options) : string
Parameters
$options : int

Options passed to json_encode(). This parameter is optional and its default value is 0.

Return values
string

A JSON string.

Search results