承接 paragonie/php-jwt-guard 相关项目开发

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

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

paragonie/php-jwt-guard

最新稳定版本:v0.3.0

Composer 安装命令:

composer require paragonie/php-jwt-guard

包简介

README 文档

README

Build Status Latest Stable Version Latest Unstable Version License Downloads

Protect your code from being impacted by issue 351 in firebase/php-jwt.

Installation

First, install this library with Composer:

composer require paragonie/php-jwt-guard

And then in your PHP namespace imports, swap the namespace:

- use Firebase\JWT\JWT;
+ use ParagonIE\PhpJwtGuard\JWT;

You're no longer going to provide an array or ArrayAccess object to JWT. You will instead need to use the provided KeyRing class.

<?php
use ParagonIE\PhpJwtGuard\KeyRing;
use ParagonIE\PhpJwtGuard\JWT;

// Setup keyring:
$keyring = (new KeyRing())
    ->withHS256('key-id-foo', 'raw-key-data-goes-here')
    ->withHS384('key-id-bar', 'raw-key-data-goes-here-too')
    // ...
    ->withPS384('key-id-xyzzy', 'raw-key-data-goes-here-too')
    ->withPS512('key-id-thud', 'raw-key-data-goes-here-too');

// Pass it to JWT Dcode:
JWT::decode($jwt, $keyring, array($allowedAlgs));

Using the KeyRing class

KeyRing->with($alg, $keyId, $rawKeyData)

Parameters:

  1. string $alg - The algorithm this key is intended for
  2. string $keyId - The kid header that maps to this key
  3. string $rawKeyData - The actual key material. For asymmetric keys, this is usually PEM-encoded.

Returns the KeyRing object. Chainable.

KeyRing->count()

Returns an integer.

KeyRing->partition($alg)

Parameters:

  1. string $alg - The algorithm this key is intended for

Returns a new KeyRing object with a subset of all supported keys.

统计信息

  • 总下载量: 814
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2021-08-11