paysera / lib-bearer-authentication-bundle
Bearer Authentication Bundle
Installs: 9 132
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 9
Forks: 3
Open Issues: 0
Requires
- php: >=7.4
- paysera/lib-dependency-injection: ^1.4
- symfony/http-kernel: ^v4.0 || ^v5.4
- symfony/security-bundle: ^v4.0 || ^v5.4
Requires (Dev)
- phpunit/phpunit: ^9.6|^10.0
README
Install
Add bundle to AppKernel.php
:
$bundles = [ ... new Paysera\BearerAuthenticationBundle\PayseraBearerAuthenticationBundle(), ];
Samples
Sample security.yml
for symfony 3/4
security: providers: bearer_user: id: paysera_bearer_authentication.security_user.bearer_user_provider firewalls: bearer_secured: pattern: ^/api/ stateless: true bearer: true provider: bearer_user
Sample security.yml for Symfony 5
security: enable_authenticator_manager: true providers: bearer_user: id: paysera_bearer_authentication.security_user.bearer_user_provider firewalls: bearer_secured: pattern: ^/api stateless: true provider: bearer_user custom_authenticators: - Paysera\BearerAuthenticationBundle\Security\BearerPassportAuthenticator access_control: # require ROLE_ADMIN for /admin* - { path: '^/api', roles: ROLE_ADMIN }
All bearer handlers must be tagged with:
<tag name="paysera_bearer_authentication.handler" />
and implement \Paysera\BearerAuthenticationBundle\Security\User\HandlerInterface
Example of a handler services.yaml
paysera_auth_token.security.auth_token_handler: class: 'App\Services\BearerHandler' tags: - { name: 'paysera_bearer_authentication.handler' }
Support matrix
The below table shows the supported PHP versions for this library, please review the composer.json file for each individual package for additional requirements.