class OidcIdToken
{
- /**
- * @var array
- */
- protected $header;
-
- /**
- * @var array
- */
- protected $payload;
-
- /**
- * @var string
- */
- protected $signature;
+ protected array $header;
+ protected array $payload;
+ protected string $signature;
+ protected string $issuer;
+ protected array $tokenParts = [];
/**
* @var array[]|string[]
*/
- protected $keys;
-
- /**
- * @var string
- */
- protected $issuer;
-
- /**
- * @var array
- */
- protected $tokenParts = [];
+ protected array $keys;
public function __construct(string $token, string $issuer, array $keys)
{
return $this->payload;
}
+ /**
+ * Replace the existing claim data of this token with that provided.
+ */
+ public function replaceClaims(array $claims): void
+ {
+ $this->payload = $claims;
+ }
+
/**
* Validate the structure of the given token and ensure we have the required pieces.
* As per https://datatracker.ietf.org/doc/html/rfc7519#section-7.2.