skrip42 / stateless-secure-bundle
add secure authentication to you stateless route
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1
- doctrine/annotations: ^1.0
- symfony/config: ^5.0
- symfony/dependency-injection: ^5.2
- symfony/http-foundation: ^5.2
- symfony/http-kernel: ^5.2
- symfony/routing: ^5.2
- symfony/security-bundle: 5.*
This package is auto-updated.
Last update: 2024-10-29 06:18:58 UTC
README
add security token to you stateless route
install
composer require skrip42/stateless-secure-bundle
then add stateless token gate to you routes.yaml
#routes.yaml stateless_secure: resource: '@StatelessSecureBundle/Resources/config/routes.yaml'
make sure the route 'stateless_secure_get_token' is not accessible as public
configure you security.yaml
#security.yaml security: providers: stateless_user_provider: id: Skrip42\StatelessSecureBundle\Security\UserProvider firewalls: stateless: anonymous: true stateless: true request_matcher: Skrip42\StatelessSecureBundle\RequestMatcher provider: stateless_user_provider guard: authenticators: - Skrip42\StatelessSecureBundle\Security\Authenticator
optional redeclare you own cache pool:
#cache.yaml framework: cache: default_redis_provider: 'redis://redis:6379' pools: stateless_token.cache: adapter: cache.adapter.redis
usage
just add annotation @StatelessSecure to you target action:
/** * @Route( * "/some_path", * name="some_name", * stateless=true * ) * @StatelessSecure */ public function sameAction(Request $request) : Response { ...