dev-master
9999999-dev https://github.com/ideationnet/jwt-middlewarePSR-15 compatible JWT Authentication middleware
MIT
The Requires
ideationnet jwt-middleware
Wallogit.com
2017 © Pedro Peláez
PSR-15 compatible JWT Authentication middleware
A simple PSR-15 compatible JWT authentication middleware., (*1)
Via Composer, (*2)
$ composer require ideationnet/jwt-middleware
Use with your favourite PSR-15 middleware dispatcher,
like Stack Runner.
Example configuration (using PHP-DI) where the options
are changed to add /token as a public path:, (*3)
return [
JwtMiddleware::class => object()
->constructorParameter('options', ['public' => ['/token']]),
];
Options:, (*4)
key is the JWT secret key, defaults to JWT_SECRET environment variablealgorithms is the array of supported algorithms, defaults to ['HS512']
public is an array of paths that bypass authenticationattribute is the name of the attribute into which the decoded token is stored,
defaults to jwt-token
The token is available in the $request object in middleware further
down the stack:, (*5)
$token = $request->getAttribute('jwt-token');
If you discover any security related issues, please email darren@darrenmothersele.com instead of using the issue tracker., (*6)
The MIT License. Please see License File for more information., (*7)
PSR-15 compatible JWT Authentication middleware
MIT
ideationnet jwt-middleware