UserInfoRequestHandlerSpi
extends
UserClaimProvider
in
Service Provider Interface for UserInfoRequestHandler.
The constructor of UserInfoRequestHandler
requires an implementation
of this interface.
UserInfoRequestHandlerSpiAdapter
is an empty implementation of this
interface.
Tags
Table of Contents
Methods
- getSub() : string
- Get the value of the "sub" claim that will be embedded in the response from the userinfo endpoint.
- getUserClaimValue() : mixed
- Get the value of a claim of the user.
Methods
getSub()
Get the value of the "sub" claim that will be embedded in the response from the userinfo endpoint.
public
getSub() : string
If this method returns null
, the subject associated with the access
token (which was presented by the client application at the userinfo
endpoint) will be used as the value of the "sub"
claim.
Return values
string —The value of the "sub"
claim.
getUserClaimValue()
Get the value of a claim of the user.
public
getUserClaimValue(string $subject, string $claimName, string $languageTag) : mixed
This method may be called multiple times.
The value returned from this method must be able to be processed by
json_encode()
. In most cases, a string, a boolean value or an
integer should be returned. When $claimName
is "address"
, an
array which conforms to the format defined in
5.1.1. Address Claim
of OpenID Connect Core 1.0
should be returned. For example,
return array(
'country' => 'Japan',
'region' => 'Tokyo'
);
\Authlete\Dto\Address class can be used to generate an array that conforms to the specification.
// Create an instance of Address class and set property values.
$address = new Address();
$address->setCountry('Japan')->setRegion('Tokyo');
// Convert the Address instance into an array.
$array = $address->toArray();
Parameters
- $subject : string
-
The subject (= unique identifier) of a user.
- $claimName : string
-
A claim name such as
"name"
and"family_name"
. Standard claim names are listed in 5.1. Standard Claims of OpenID Connect Core 1.0. Constanct values that represent the standard claims are listed in \Authlete\Types\StandardClaims class. Note that the value of this argument ($claimName
) does NOT contain a language tag. - $languageTag : string
-
A language tag such as
"en"
and"ja"
. Implementations of this method should take this into consideration if possible. See 5.2. Claims Languages and Scripts of OpenID Connect Core 1.0 for details.
Return values
mixed —The value of the claim. null
if the value is not available.
The returned value must be able to be processed by json_encode()
.