Download the PHP package eljam/guzzle-jwt-middleware without Composer
On this page you can find all versions of the php package eljam/guzzle-jwt-middleware. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eljam/guzzle-jwt-middleware
More information about eljam/guzzle-jwt-middleware
Files in eljam/guzzle-jwt-middleware
Package guzzle-jwt-middleware
Short Description A jwt authentication middleware for guzzle 6
License MIT
Homepage https://github.com/eljam/guzzle-jwt-middleware
Informations about the package guzzle-jwt-middleware
Guzzle Jwt middleware
Introduction
Works great with LexikJWTAuthenticationBundle
Installation
composer require eljam/guzzle-jwt-middleware
Usage
Auth Strategies
QueryAuthStrategy
FormAuthStrategy
HttpBasicAuthStrategy
JsonAuthStrategy
Persistence
To avoid requesting a token everytime php runs, you can pass to JwtManager an implementation of TokenPersistenceInterface.
By default NullTokenPersistence will be used.
Simpe cache adapter (PSR-16)
If you have any PSR-16 compatible cache, you can use it as a persistence handler:
Optionnally you can specify the TTL and cache key used:
Custom persistence
You may create you own persistence handler by implementing the TokenPersistenceInterface:
Token key
Property accessor
With the property accessor you can point to a node in your json.
Json Example:
Library configuration:
Default behavior
By default this library assumes your json response has a key token, something like this:
but now you can change the token_key in the JwtManager options:
Null property accessor
If the response is not in json format (i.e. the response body contains only the token in plain text format), you need
to set the property accessor to null:
Authorization Header Type
Some endpoints use different Authorization header types (Bearer, JWT, etc...).
The default is Bearer, but another type can be supplied in the middleware:
Cached token
To avoid too many calls between multiple request, there is a cache system.
Json example:
The bundle natively supports the exp field in the JWT payload.
All versions of guzzle-jwt-middleware with dependencies
guzzlehttp/guzzle Version ^7.0
psr/simple-cache Version ^1 || ^2 || ^3
symfony/options-resolver Version >=2.8
symfony/property-access Version >=2.8
