diff --git a/src/Command/ClearExpiredTokensCommand.php b/src/Command/ClearExpiredTokensCommand.php index 706ea2b4..16c6985b 100644 --- a/src/Command/ClearExpiredTokensCommand.php +++ b/src/Command/ClearExpiredTokensCommand.php @@ -7,16 +7,16 @@ use League\Bundle\OAuth2ServerBundle\Manager\AccessTokenManagerInterface; use League\Bundle\OAuth2ServerBundle\Manager\AuthorizationCodeManagerInterface; use League\Bundle\OAuth2ServerBundle\Manager\RefreshTokenManagerInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand(name: 'league:oauth2-server:clear-expired-tokens', description: 'Clears all expired access and/or refresh tokens and/or auth codes')] final class ClearExpiredTokensCommand extends Command { - protected static $defaultName = 'league:oauth2-server:clear-expired-tokens'; - /** * @var AccessTokenManagerInterface */ diff --git a/src/Command/CreateClientCommand.php b/src/Command/CreateClientCommand.php index ab5b00db..a6b66ea3 100644 --- a/src/Command/CreateClientCommand.php +++ b/src/Command/CreateClientCommand.php @@ -9,6 +9,7 @@ use League\Bundle\OAuth2ServerBundle\ValueObject\Grant; use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri; use League\Bundle\OAuth2ServerBundle\ValueObject\Scope; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -16,10 +17,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand(name: 'league:oauth2-server:create-client', description: 'Creates a new OAuth2 client')] final class CreateClientCommand extends Command { - protected static $defaultName = 'league:oauth2-server:create-client'; - /** * @var ClientManagerInterface */ diff --git a/src/Command/DeleteClientCommand.php b/src/Command/DeleteClientCommand.php index 874630b1..73302780 100644 --- a/src/Command/DeleteClientCommand.php +++ b/src/Command/DeleteClientCommand.php @@ -5,16 +5,16 @@ namespace League\Bundle\OAuth2ServerBundle\Command; use League\Bundle\OAuth2ServerBundle\Manager\ClientManagerInterface; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand(name: 'league:oauth2-server:delete-client', description: 'Deletes an OAuth2 client')] final class DeleteClientCommand extends Command { - protected static $defaultName = 'league:oauth2-server:delete-client'; - /** * @var ClientManagerInterface */ diff --git a/src/Command/ListClientsCommand.php b/src/Command/ListClientsCommand.php index 371b76d4..6e720473 100644 --- a/src/Command/ListClientsCommand.php +++ b/src/Command/ListClientsCommand.php @@ -10,18 +10,18 @@ use League\Bundle\OAuth2ServerBundle\ValueObject\Grant; use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri; use League\Bundle\OAuth2ServerBundle\ValueObject\Scope; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand(name: 'league:oauth2-server:list-clients', description: 'Lists existing OAuth2 clients')] final class ListClientsCommand extends Command { private const ALLOWED_COLUMNS = ['name', 'identifier', 'secret', 'scope', 'redirect uri', 'grant type']; - protected static $defaultName = 'league:oauth2-server:list-clients'; - /** * @var ClientManagerInterface */ @@ -37,7 +37,7 @@ public function __construct(ClientManagerInterface $clientManager) protected function configure(): void { $this - ->setDescription('Lists existing oAuth2 clients') + ->setDescription('Lists existing OAuth2 clients') ->addOption( 'columns', null, diff --git a/src/Command/UpdateClientCommand.php b/src/Command/UpdateClientCommand.php index 0926aecc..c462a60d 100644 --- a/src/Command/UpdateClientCommand.php +++ b/src/Command/UpdateClientCommand.php @@ -8,6 +8,7 @@ use League\Bundle\OAuth2ServerBundle\ValueObject\Grant; use League\Bundle\OAuth2ServerBundle\ValueObject\RedirectUri; use League\Bundle\OAuth2ServerBundle\ValueObject\Scope; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -15,10 +16,9 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +#[AsCommand(name: 'league:oauth2-server:update-client', description: 'Updates an OAuth2 client')] final class UpdateClientCommand extends Command { - protected static $defaultName = 'league:oauth2-server:update-client'; - /** * @var ClientManagerInterface */ diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php index 4829b01c..f9c4a600 100644 --- a/src/Resources/config/services.php +++ b/src/Resources/config/services.php @@ -235,28 +235,28 @@ service(ClientManagerInterface::class), null, ]) - ->tag('console.command') + ->tag('console.command', ['command' => 'league:oauth2-server:create-client']) ->alias(CreateClientCommand::class, 'league.oauth2_server.command.create_client') ->set('league.oauth2_server.command.update_client', UpdateClientCommand::class) ->args([ service(ClientManagerInterface::class), ]) - ->tag('console.command') + ->tag('console.command', ['command' => 'league:oauth2-server:update-client']) ->alias(UpdateClientCommand::class, 'league.oauth2_server.command.update_client') ->set('league.oauth2_server.command.delete_client', DeleteClientCommand::class) ->args([ service(ClientManagerInterface::class), ]) - ->tag('console.command') + ->tag('console.command', ['command' => 'league:oauth2-server:delete-client']) ->alias(DeleteClientCommand::class, 'league.oauth2_server.command.delete_client') ->set('league.oauth2_server.command.list_clients', ListClientsCommand::class) ->args([ service(ClientManagerInterface::class), ]) - ->tag('console.command') + ->tag('console.command', ['command' => 'league:oauth2-server:list-clients']) ->alias(ListClientsCommand::class, 'league.oauth2_server.command.list_clients') ->set('league.oauth2_server.command.clear_expired_tokens', ClearExpiredTokensCommand::class) @@ -265,7 +265,7 @@ service(RefreshTokenManagerInterface::class), service(AuthorizationCodeManagerInterface::class), ]) - ->tag('console.command') + ->tag('console.command', ['command' => 'league:oauth2-server:clear-expired-tokens']) ->alias(ClearExpiredTokensCommand::class, 'league.oauth2_server.command.clear_expired_tokens') // Utility services