New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

fidelize/jwt-auth-multiple-keys

Add multiple keychain support to tymon/jwt-auth package
16,837
Install
composer require fidelize/jwt-auth-multiple-keys
Latest Version:4.2.0
PHP:>=7.0
Laravel:5 – 10
License:MIT
Last Updated:Jul 26, 2023
Links: GitHub  ·  Packagist
Maintainer: alanwillms

JWT Auth with Multiple Keys

This is an extension of tymon/jwt-auth, adding support to:

  • Replace deprecated namshi/jose with lcobucci/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

Related Packages

tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

56,132,372 11,487
php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

13,464,171 845
dees040/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

81,241 0
tomfordrumm/jwt-auth

JSON Web Token Authentication for Laravel and Lumen (fork from tymon/jwt-auth)

62,895 2
ad-mos/laravel-jwt-auth

JSON Web Token Authentication for Laravel and Lumen

6,925 0

Version History

Version Released PHP Laravel License
4.2.0 >=7.0 >=5.0 MIT
4.1.0 >=7.0 >=5.0 MIT
4.0.0 >=7.0 >=5.0 MIT
3.0.2 >=7.0 >=5.0 MIT
3.0.1 >=7.0 >=5.0 MIT