baywa-re-lusy/jwt-authentication
最新稳定版本:3.0.2
Composer 安装命令:
composer require baywa-re-lusy/jwt-authentication
包简介
BayWa r.e. LUSY JWT Authentication
README 文档
README
Installation
To install the JWT Authentication service, you will need Composer in your project:
composer require baywa-re-lusy/jwt-authentication
Usage example code for Laminas projects
In Module.php:
use BayWaReLusy\JwtAuthentication\TokenService; use Laminas\Cache\Psr\CacheItemPool\CacheItemPoolDecorator; use BayWaReLusy\JwtAuthentication\Token; public function onAuthentication(MvcAuthEvent $e): IdentityInterface { $jwt = ...; // The JSON Web Token $laminasCacheStorageInterface = ...; // Instance of Laminas\Cache\Storage\StorageInterface $jwksUrl = ...; // URL from where to get JWKs $cache = new CacheItemPoolDecorator($laminasCacheStorageInterface); $tokenService = new TokenService(); try { $token = $tokenService->validateToken($jwt, $cache, $jwksUrl); } catch (\BayWaReLusy\JwtAuthentication\InvalidTokenException $e) { return new GuestIdentity(); } ... }
统计信息
- 总下载量: 932
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-08-01