free2er / jwt-authenticator-bundle
JWT 验证器组件
2.0.1
2019-11-28 19:29 UTC
Requires
- php: ^7.2
- ext-json: *
- lcobucci/jwt: ^3.3
- nesbot/carbon: ^2.27
- sensio/framework-extra-bundle: ^5.5
- symfony/config: ^4.3 || ^5.0
- symfony/dependency-injection: ^4.3 || ^5.0
- symfony/http-kernel: ^4.3 || ^5.0
- symfony/security-core: ^4.3 || ^5.0
- symfony/security-guard: ^4.3|| ^5.0
Requires (Dev)
- free2er/coding-standard: ^1.1
- phpunit/phpunit: ^8.3
README
JWT 验证器组件
安装
该组件可以通过 Composer 依赖管理器进行安装。
-
将组件作为项目依赖项安装
composer require free2er/jwt-authenticator-bundle
-
启用组件
<?php // config/bundles.php return [ // ... Free2er\Jwt\JwtAuthenticatorBundle::class => ['all' => true], // ... ];
- 配置公钥路径
# config/packages/jwt_authenticator.yaml jwt_authenticator: key: file://%kernel.project_dir%/path/to/public.key
- 配置防火墙
# config/packages/security.yaml security: providers: jwt: id: Free2er\Jwt\Service\UserProvider firewalls: # ... main: pattern: ^/api stateless: true provider: jwt guard: authenticators: - Free2er\Jwt\Service\Authenticator # ...
- 完成!