/php-jwt-middleware

PSR-7 compliant middleware to handle incoming JWT's

Primary LanguagePHP

PHP JWT Middleware

This package allows developers to add simple but powerful middleware to their application which does one thing, and one thing only: validate incoming JWT's.

Requirements

Goal of this package

This package aims to provide the developer with a PSR-7 compliant HTTP middleware class that ensures the validity and integrity of incoming JWT's. When a JWT is found valid, it is simply added to the request as an attribute. Within the application, the JWT can simply be accessed using the current ServerRequestInterface implementation for your application:

class MyController
{
    public function indexAction(ServerRequestInterface $request)
    {
        $jwt = $request->getAttribute('jwt'); // Instance of Lcobucci\JWT\Token 
    }
}