Classes/Factory/Event/EnrichPayloadEvent.php
<?php
declare(strict_types=1);
/*
* This file is part of the "Secure Downloads" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) Dev <dev@Leuchtfeuer.com>, Leuchtfeuer Digital Marketing
*/
namespace Leuchtfeuer\SecureDownloads\Factory\Event;
use Leuchtfeuer\SecureDownloads\Domain\Transfer\Token\AbstractToken;
/**
* You can use this event for extending or manipulating the payload of the JSON Web Token. This event is executed immediately
* before the JSON Web token is generated.
*/
final class EnrichPayloadEvent
{
/**
* @param array<string, mixed> $payload This array contains the default payload of the JSON Web Token. You can enrich this data by
* your own properties or manipulate the existing data.
* @param AbstractToken $token This property is read-only and contains the generated token object.
*/
public function __construct(private array $payload, private readonly AbstractToken $token) {}
/**
* @return array<string, mixed>
*/
public function getPayload(): array
{
return $this->payload;
}
/**
* @param array<string, mixed> $payload
*/
public function setPayload(array $payload): void
{
$this->payload = $payload;
}
public function getToken(): AbstractToken
{
return $this->token;
}
}