23 lines
717 B
PHP
23 lines
717 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace App\Services\Registry\V2\Api;
|
|
|
|
use App\Dto\Service\Registry\V2\AuthorizationConfig;
|
|
use App\Services\Registry\V2\JwtCommand;
|
|
use App\Services\Registry\V2\PayloadCommand;
|
|
|
|
final readonly class GenerateJwtTokenCommand
|
|
{
|
|
public function __construct(
|
|
private AuthorizationConfig $authorizationConfig,
|
|
private JwtCommand $jwtCommand,
|
|
private PayloadCommand $payloadCommand,
|
|
) { }
|
|
|
|
public function execute($access, $username): string
|
|
{
|
|
$payload = $this->payloadCommand->execute($this->authorizationConfig, $access, $username);
|
|
return $this->jwtCommand->execute($this->authorizationConfig, $payload);
|
|
}
|
|
}
|