jimtools/jwt-auth
最新稳定版本:3.0.0
Composer 安装命令:
composer require jimtools/jwt-auth
包简介
PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth
README 文档
README
This package is a PSR-15 compliant JSON Web Token authentication middleware, which take a JWT from the headers or cookies.
use JimTools\JwtAuth\Decoder\FirebaseDecoder; use JimTools\JwtAuth\Middleware\JwtAuthentication; use JimTools\JwtAuth\Exceptions\AuthorizationException; use JimTools\JwtAuth\Options; use JimTools\JwtAuth\Secret; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; require './vendor/autoload.php'; $app = AppFactory::create(); $app->addErrorMiddleware(false, false, false) ->setErrorHandler(AuthorizationException::class, new MyErrorHandler()); $middleware = new JwtAuthentication( new Options(), new FirebaseDecoder(new Secret('tooManySecrets', 'HS256')) ); $app->get('/protected', static function (Request $request, Response $response, array $args) { $response->getBody()->write('you will need a token'); return $response; })->addMiddleware($middleware); $app->run();
Note
V1 is still supported!! For documentation on v1.x which is compatible with tuupola/slim-jwt-auth
see 1.x
Install
The recommended way to install packages is through composer.
composer require jimtools/jwt-auth
Documentation
GitHub issues are used for only to discuss bugs and new features, for support please use GitHub discussions.
Security
If you discover any security-related issues, please email james.read.18@gmail.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 106.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 1
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-19