2017 © Pedro Peláez
 

library jwt-middleware

PSR-15 compatible JWT Authentication middleware

image

ideationnet/jwt-middleware

PSR-15 compatible JWT Authentication middleware

  • Tuesday, November 29, 2016
  • by darrenmothersele
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

JWT Middleware

A simple PSR-15 compatible JWT authentication middleware., (*1)

Install

Via Composer, (*2)

$ composer require ideationnet/jwt-middleware

Usage

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 variable
  • algorithms is the array of supported algorithms, defaults to ['HS512']
  • public is an array of paths that bypass authentication
  • attribute 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');

Security

If you discover any security related issues, please email darren@darrenmothersele.com instead of using the issue tracker., (*6)

Credits

License

The MIT License. Please see License File for more information., (*7)

The Versions

29/11 2016

dev-master

9999999-dev https://github.com/ideationnet/jwt-middleware

PSR-15 compatible JWT Authentication middleware

  Sources   Download

MIT

The Requires

 

ideationnet jwt-middleware