Repository: symfony/symfony
File: src/Symfony/Component/Security/Http/Command/OidcTokenGenerateCommand.php (PHP)

Code before:
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Http\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Security\Http\AccessToken\Oidc\OidcTokenGenerator;

/**
 * Generates an OIDC token.
 *
 * @final
 */
#[AsCommand(name: 'security:oidc:generate-token', description: 'Generate an OIDC token for a given user')]
final class OidcTokenGenerateCommand extends Command
{
    /** @var array<string, OidcTokenGenerator> */
    private array $generators = [];
    /** @var array<string, list<string>> */
    private array $algorithms;
    /** @var array<string, list<string>> */
    private array $issuers;

    protected function configure(): void
    {
        $this
            ->addArgument('user-identifier', InputArgument::REQUIRED, 'User identifier')
            ->addOption('firewall', null, InputOption::VALUE_REQUIRED, 'Firewall')
            ->addOption('algorithm', null, InputOption::VALUE_REQUIRED, 'Algorithm name to use to sign')
            ->addOption('issuer', null, InputOption::VALUE_REQUIRED, 'Set the Issuer claim (iss)')
            ->addOption('ttl', null, InputOption::VALUE_REQUIRED, 'Set the Expiration Time claim (exp) (time to live in seconds)')
            ->addOption('not-before', null, InputOption::VALUE_REQUIRED, 'Set the Not Before claim (nbf)')
        ;
    }


    /**

Review comment (suggestion):
Not needed as the class is already marked as final.
```suggestion
```

Code after:
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Http\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Security\Http\AccessToken\Oidc\OidcTokenGenerator;

#[AsCommand(name: 'security:oidc:generate-token', description: 'Generate an OIDC token for a given user')]
final class OidcTokenGenerateCommand extends Command
{
    /** @var array<string, OidcTokenGenerator> */
    private array $generators = [];
    /** @var array<string, list<string>> */
    private array $algorithms;
    /** @var array<string, list<string>> */
    private array $issuers;

    protected function configure(): void
    {
        $this
            ->addArgument('user-identifier', InputArgument::REQUIRED, 'User identifier')
            ->addOption('firewall', null, InputOption::VALUE_REQUIRED, 'Firewall')
            ->addOption('algorithm', null, InputOption::VALUE_REQUIRED, 'Algorithm name to use to sign')
            ->addOption('issuer', null, InputOption::VALUE_REQUIRED, 'Set the Issuer claim (iss)')
            ->addOption('ttl', null, InputOption::VALUE_REQUIRED, 'Set the Expiration Time claim (exp) (time to live in seconds)')
            ->addOption('not-before', null, InputOption::VALUE_REQUIRED, 'Set the Not Before claim (nbf)')
        ;
    }


    /**
     * @params array<string, list<string>> $algorithms
     * @params array<string, list<string>> $issuers
     */
    public function addGenerator(string $firewall, OidcTokenGenerator $oidcTokenGenerator, array $algorithms, array $issuers): void
    {