Files
alfa-bank-sdk/src/Data/Auth/UserInfo/UserInfoData.php
Anatoliy Poloz b15d29f8e9 fix(formating)
2026-01-28 03:36:26 +03:00

43 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
/*
// MODULE_CONTRACT: Defines the data structure for OpenID Connect UserInfo claims.
// RESPONSIBILITY: To hold and type-safely represent details about the authenticated end-user.
// INPUTS: Raw JSON object (typically from a JWT payload) from the UserInfo endpoint.
// OUTPUTS: A structured object containing user claims.
// LINKS: Requests/Auth/UserInfo/GetUserInfoRequest.php
*/
namespace Apoloz\AlfaBank\Data\Auth\UserInfo;
// <SECTION name="module_imports" intent="Import the base Spatie Laravel Data class.">
// <BELIEF_STATE "Extending `Spatie\LaravelData\Data` enables automatic casting from JSON and provides other DTO benefits.">
use Spatie\LaravelData\Data;
// </SECTION>
// <SECTION name="class_definition" intent="Define a DTO for OpenID Connect UserInfo claims.">
// <BELIEF_STATE "This DTO provides a clear, type-safe contract for handling user claims returned by the OIDC UserInfo endpoint, ensuring consistent access to user attributes.">
class UserInfoData extends Data
{
// <SECTION name="constructor_properties" intent="Define the standard and extended properties (claims) for user information.">
// <BELIEF_STATE "The constructor includes `sub` (subject identifier) as mandatory. Many other fields are optional and represent common OIDC claims like `name`, `email`, `birthdate`, `phone_number`, and `inn`. These claims provide rich detail about the end-user.">
public function __construct(
public string $sub,
public ?string $iss = null, // Issuer
public ?string $aud = null, // Audience
public ?string $name = null,
public ?string $given_name = null,
public ?string $family_name = null,
public ?string $middle_name = null,
public ?string $email = null,
public ?string $gender = null,
public ?string $birthdate = null,
public ?string $phone_number = null,
public ?string $inn = null, // Individual Taxpayer Number (Russia)
// Add more claims as needed based on the response
) {}
// </SECTION>
}