ClientExtension implements ArrayCopyable, Arrayable, Jsonable Uses ArrayTrait, JsonTrait
Extended information about a client application.
There are some attributes that belong to a client application but should not be changed by the developer of the client application. This class holds such attributes.
For example, an authorization server may narrow the range of scopes (permissions) that a particular client application can request. In this case, it is meaningless if the developer of the client application can freely decide the set of requestable scopes. It is not the developer of the client application but the administrator of the authorization server that should be allowed to define the set of scopes that the client application can request.
Interfaces, Classes and Traits
- ArrayCopyable
- Interface to declare instances can be converted into/from arrays.
- Arrayable
- Interface to declare that instances can be converted into an array.
- Jsonable
- Interface to declare that instances can be converted into JSON strings.
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.
- getAccessTokenDuration() : int|string
- Get the duration of access tokens per client in seconds.
- getRefreshTokenDuration() : int|string
- Get the duration of refresh tokens per client in seconds.
- getRequestableScopes() : array<string|int, string>
- Get the set of scopes that the client application can request when the "Requestable Scopes per Client" feature is enabled (= when the `isRequestableScopesEnabled()` method returns `true`).
- isRequestableScopesEnabled() : bool
- Get the flag which indicates whether the "Requestable Scopes per Client" feature is enabled or not.
- setAccessTokenDuration() : ClientExtension
- Set the duration of access tokens per client in seconds.
- setRefreshTokenDuration() : ClientExtension
- Set the duration of refresh tokens per client in seconds.
- setRequestableScopes() : ClientExtension
- Set the set of scopes that the client application can request when the "Requestable Scopes per Client" feature is enabled (= when the `isRequestableScopesEnabled()` method returns `true`).
- setRequestableScopesEnabled() : ClientExtension
- Set the flag which indicates whether the "Requestable Scopes per Client" feature is enabled or not.
- 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.
getAccessTokenDuration()
Get the duration of access tokens per client in seconds.
public
getAccessTokenDuration() : int|string
In normal cases, the values of the Service's accessTokenDuration
property is used as the duration of access tokens issued by the
service. However, if this accessTokenDuration
property holds a
non-zero positive number and its value is less than the duration
configured by the service, the value is used as the duration of
access tokens issued to the client application.
Note that the duration of access tokens can be controlled by the
scope attribute access_token.duration
, too. Authlete chooses the
minimum value among the candidates.
Tags
Return values
int|string —The duration of access tokens per client in seconds.
getRefreshTokenDuration()
Get the duration of refresh tokens per client in seconds.
public
getRefreshTokenDuration() : int|string
In normal cases, the values of the Service's refreshTokenDuration
property is used as the duration of refresh tokens issued by the
service. However, if this refreshTokenDuration
property holds a
non-zero positive number and its value is less than the duration
configured by the service, the value is used as the duration of
refresh tokens issued to the client application.
Note that the duration of refresh tokens can be controlled by the
scope attribute refresh_token.duration
, too. Authlete chooses the
minimum value among the candidates.
Tags
Return values
int|string —The duration of refresh tokens per client in seconds.
getRequestableScopes()
Get the set of scopes that the client application can request when the "Requestable Scopes per Client" feature is enabled (= when the `isRequestableScopesEnabled()` method returns `true`).
public
getRequestableScopes() : array<string|int, string>
Return values
array<string|int, string> —Scopes that the client application can request.
isRequestableScopesEnabled()
Get the flag which indicates whether the "Requestable Scopes per Client" feature is enabled or not.
public
isRequestableScopesEnabled() : bool
Return values
bool —true
if the "Requestable Scopes per Client" feature is enabled.
setAccessTokenDuration()
Set the duration of access tokens per client in seconds.
public
setAccessTokenDuration(int|string $duration) : ClientExtension
In normal cases, the values of the Service's accessTokenDuration
property is used as the duration of access tokens issued by the
service. However, if this accessTokenDuration
property holds a
non-zero positive number and its value is less than the duration
configured by the service, the value is used as the duration of
access tokens issued to the client application.
Note that the duration of access tokens can be controlled by the
scope attribute access_token.duration
, too. Authlete chooses the
minimum value among the candidates.
Parameters
- $duration : int|string
-
The duration of access tokens per client in seconds.
Tags
Return values
ClientExtension —$this
object.
setRefreshTokenDuration()
Set the duration of refresh tokens per client in seconds.
public
setRefreshTokenDuration(int|string $duration) : ClientExtension
In normal cases, the values of the Service's refreshTokenDuration
property is used as the duration of refresh tokens issued by the
service. However, if this refreshTokenDuration
property holds a
non-zero positive number and its value is less than the duration
configured by the service, the value is used as the duration of
refresh tokens issued to the client application.
Note that the duration of refresh tokens can be controlled by the
scope attribute refresh_token.duration
, too. Authlete chooses the
minimum value among the candidates.
Parameters
- $duration : int|string
-
The duration of refresh tokens per client in seconds.
Tags
Return values
ClientExtension —$this
object.
setRequestableScopes()
Set the set of scopes that the client application can request when the "Requestable Scopes per Client" feature is enabled (= when the `isRequestableScopesEnabled()` method returns `true`).
public
setRequestableScopes([array<string|int, string> $requestableScopes = null ]) : ClientExtension
Parameters
- $requestableScopes : array<string|int, string> = null
-
Scopes that the client application can request.
Return values
ClientExtension —$this
object.
setRequestableScopesEnabled()
Set the flag which indicates whether the "Requestable Scopes per Client" feature is enabled or not.
public
setRequestableScopesEnabled(bool $enabled) : ClientExtension
If true
is set, a special set of scopes (permissions) is defined on
the server side (getRequestableScopes()
method returns the special
set) and scopes which the client application can request are limited
to the scopes listed in the special set. In other words, the
application cannot request scopes that are not included in the special
set. To be specific, the client application cannot list other scopes
in the scope
request parameter when it makes an authorization
request. To be exact, other scopes can be listed but will be ignored
by the authorization server.
On the other hand, false
is set, the valid set of scopes
(permissions) that the client application can request is equal to the
whole scope set defined by the authorization server.
Parameters
- $enabled : bool
-
true
if the "Requestable Scopes per Client" feature is enabled.
Return values
ClientExtension —$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.