{"repo":"365Werk/jwtauthroles","free":true,"listed":false,"github":"https://github.com/365Werk/jwtauthroles","clone":"git clone https://github.com/365Werk/jwtauthroles.git","description":"Made to use JWTs from an external identity provider in Laravel. Tested with Fusionauth, but should be quite general purpose.","language":"PHP","stars":15,"topics":["laravel","jwt","jwk","jwks","fusionauth","roles"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"JWT Auth and Roles [![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] ![StyleCI][ico-styleci] [![Scrutinizer Quality][ico-scrutinizer]][link-scrutinizer] Made to use JWTs from an external identity provider in Laravel. Tested with Fusionauth, but should be quite general purpose. With this package you can validate the incoming JWT, and create an authenticated user that has to roles specified in the JWT for further (route based) authentication using a role middleware that is included. . Take a look at contributing.md to see a to do list. Installation Via Composer Publish config and migration Migrations are only needed if you want to either cache the JWKs or store the user, this can be configured in the config. It's possible to use this package without storing anything related to it in the database at all. Run migration Usage In your AuthServiceProvider modify boot() Then either change one of your guards in config/auth.php to use the jwt driver and jwt users provider, or add a new guard Now you can use the JWT guard in your routes, for example on a group: You can also use the RolesMiddelware to do role-based authentication on a route like this: To make the authenticated user actually useful, the JwtUser model extends the User model. This means that you can define any relations in the User model, and then use them for the authenticated user. For example, add the following relationship in the default User model: This as","default_branch":null,"files":null,"tree":[],"storefront":"/r/365Werk","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/365Werk/jwtauthroles/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}