承接 baywa-re-lusy/jwt-authentication 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

baywa-re-lusy/jwt-authentication

最新稳定版本:3.0.2

Composer 安装命令:

composer require baywa-re-lusy/jwt-authentication

包简介

BayWa r.e. LUSY JWT Authentication

README 文档

README

CircleCI

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2022-08-01