k3progetti / jwt-bundle
Bundle Symfony per la gestione dei token JWT con supporto a refresh token e logout
Installs: 65
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/k3progetti/jwt-bundle
Requires
- php: >=8.2
 - doctrine/doctrine-bundle: ^2.10
 - doctrine/orm: ^2.15
 - firebase/php-jwt: ^6.11
 - k3progetti/mercure-bridge-bundle: *
 - nesbot/carbon: ~3.0
 - symfony/framework-bundle: ^7.0
 - symfony/http-client: ~7.0
 - symfony/messenger: ~7.0
 - symfony/redis-messenger: ~7.0
 - symfony/security-bundle: *
 - symfony/serializer: *
 - symfony/validator: ~7.0
 
This package is auto-updated.
Last update: 2025-10-27 15:08:33 UTC
README
Bundle Symfony per la gestione avanzata dei token JWT, con supporto a:
- Login e generazione token JWT
 - Refresh token
 - Logout e invalidazione dei token
 - Comandi da terminale per la pulizia dei token scaduti
 
β Requisiti
- PHP >= 8.2
 - Symfony 7.0
 
π Installazione
composer require k3progetti/jwt-bundle
php composer.phar install --ignore-platform-req=ext-redis
βοΈ Configurazione
π¦ Registrazione del bundle
Aggiungi il bundle al tuo config/bundles.php se non viene registrato automaticamente:
return [ // ... K3Progetti\JwtBundle\JwtBundle::class => ['all' => true], ];
π Configurazione del firewall (config/packages/security.yaml)
firewalls: api: pattern: ^/api/ stateless: true custom_authenticator: K3Progetti\JwtBundle\Security\JwtAuthenticator
π§± Migrazioni
Il bundle include due entitΓ : JwtToken e JwtRefreshToken.
Dopo aver installato il bundle, genera e applica le migrazioni:
php bin/console make:migration php bin/console doctrine:migrations:migrate
π§ Struttura del Progetto
JwtBundle/
βββ JwtBundle.php
βββ bin/
β   βββ register-jwt-bundle.php
βββ resources/
β   βββ config/
β       βββ services.yaml
βββ src/
β   βββ Command/
β   β   βββ RemoveJwtRefreshTokenExpired.php
β   β   βββ RemoveJwtTokenExpired.php
β   β   βββ RemoveJwtTokenUser.php
β   βββ Controller/
β   β   βββ AuthController.php
β   βββ DependencyInjection/
β   β   βββ Configuration.php
β   β   βββ JwtExtension.php
β   βββ Entity/
β   β   βββ JwtToken.php
β   β   βββ JwtRefreshToken.php
β   βββ Event/
β   β   βββ JwtUserLoggedOutEvent.php
β   βββ Helper/
β   β   βββ AuthHelper.php
β   βββ Repository/
β   β   βββ JwtTokenRepository.php
β   β   βββ JwtRefreshTokenRepository.php
β   βββ Security/
β   β   βββ JwtAuthenticator.php
β   β   βββ Handler/
β   β       βββ LoginHandler.php
β   β       βββ LogoutHandler.php
β   β       βββ RefreshTokenHandler.php
β   βββ Service/
β       βββ JwtService.php
β       βββ JwtRefreshService.php
π§ Comandi Console Disponibili
bin/console jwt:remove-jwt-refresh-token-expired bin/console jwt:remove-jwt-token-expired bin/console jwt:remove-jwt-token-user
π€ Contributi
Sono aperto a qualsiasi confronto.