yiisoft / auth-jwt Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://www.yiiframework.com/
License: BSD 3-Clause "New" or "Revised" License
Home Page: https://www.yiiframework.com/
License: BSD 3-Clause "New" or "Revised" License
I am using an RS256 algorithm instead of the (default) HS256 algorithm. RS256 uses a public/private key pair instead of a secret. The TokenManager only implements the possibility to define a secret but not a public or private file path or encryption key.
config/web/auth.php
<?php
declare(strict_types=1);
/**
* @var array $params
*/
use Jose\Component\Signature\Algorithm\RS256;
use Yiisoft\Auth\Jwt\TokenManagerInterface;
use Yiisoft\Auth\Jwt\TokenManager;
use Yiisoft\Auth\AuthenticationMethodInterface;
use Yiisoft\Auth\Jwt\JwtMethod;
return [
TokenManagerInterface::class => [
'__class' => TokenManager::class,
'__construct()' => [
// `secret` not needed for this algorithm, but must be defined for the token manager constructor
'secret' => $params['yiisoft/auth-jwt']['secret'],
'algorithms' => [new RS256()]
// where do i define the public/private key file path or the encryption key?
]
],
AuthenticationMethodInterface::class => JwtMethod::class
];
A possibility to define a public and private key file path for the token manager and the secret not to be a default
No possibility to use a JWT with RS256 algorithm
Q | A |
---|---|
Version | dev-master#cc62114 |
PHP version | 7.4.12 |
Operating system | Docker yiisoftware/yii-php:7.4-apache |
About JWT(JSON Web Tokens [RFC 7519]):
https://jwt.io
Yii2 RESTful Web Services Authentication:
https://www.yiiframework.com/doc/guide/2.0/en/rest-authentication
@rustamwin suggests lcobucci/jwt in this issue from yiisoft/yii-web
The Problem is, we will need version v4.x (php 7.3) but this version is not stable and we don't know, how long it will takes.
Related issue: yiisoft/auth#69
composer update
Outdated packages are not installed.
composer: Package web-token/* is abandoned
, you should avoid using it. Use web-token/jwt-library
instead.
Q | A |
---|---|
Version | 2.0.1 |
PHP version | 8.3 |
Operating system | macOS |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.