fidelize / jwt-auth-multiple-keys
Add multiple keychain support to tymon/jwt-auth package
Installs: 11 736
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 2
Open Issues: 1
Requires
- php: >=7.0
- laravel/framework: >=5.0
- php-open-source-saver/jwt-auth: ^2.1
Requires (Dev)
- mockery/mockery: ^1.4
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-10-26 15:03:30 UTC
README
This is an extension of tymon/jwt-auth, adding support to:
- Replace deprecated
namshi/jose
withlcobucci/jwt
- JWT with key pairs instead of a secret
- Validate a JWT against multiple public keys
- Use JWT secret as a fallback
Installing
Firstly, you must install tymon/jwt-auth.
Add this package through Composer: composer require "fidelize/jwt-auth-multiple-keys"
Edit your config/jwt.php
file adding/editing these lines:
<?php return [ // ... 'providers' => [ // ... 'jwt' => 'Fidelize\JWTAuth\JwtAdapter', 'auth' => 'Fidelize\JWTAuth\AuthAdapter', // ... ], 'keys_directory' => '/path/yo/your/keys/directory/' ]; ?>
# Don't add a passphrase!
ssh-keygen -t rsa -b 4096 -f keys/jwt.app.key
openssl rsa -in keys/jwt.wholesaler.key -pubout -outform PEM -out keys/jwt.app.key.pub
Warning
Keys must follow the pattern name key.*.key
and key.*.key.pub
TODO List
- Support different name patterns
- Add command to generate keys