Download the PHP package laravelha/jwt-auth-acl without Composer
On this page you can find all versions of the php package laravelha/jwt-auth-acl. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package jwt-auth-acl
JWT Auth ACL
JWT Auth ACL is a Laravel package to authentication and authorization package.
The middleware ha.acl check if auth user is authorized to access the route and he is authorized when has permission with
the same name of the route within any role he has
Install
- Install packaqe with composer
composer require laravelha/jwt-auth-acl - Remove default User files:
app/User.phpdatabase/factories/UserFactory.phpdatabase/migrations/2014_10_12_000000_create_users_table.php
- Publish config
php artisan vendor:publish --foce --tag ha-auth-config - Publish seeder
php artisan vendor:publish --foce --tag ha-auth-seeds - Add
ha.aclon routes with that you wish check permissions - Run
php artisan db:seed --class=PermissionsTableSeederto populate permissions table - Run
php artisan jwt:secret - Set
config/l5-swagger.phpto read annotations onvendor/laravelha/jwt-auth-acl/src - Run
php artisan l5-swagger:generateto generate docs
Use
- Add
ha.aclon your protected routes - Publish seeder
php artisan vendor:publish --foce --tag ha-auth-seeds - Run
php artisan db:seed --class=PermissionsTableSeederto populate permissions table
Create roles
Tinker
GuzzleHttp
axios
cUrl bash php artisan tinker $role = Role::find(ID) $role->permissions->sync([ID_P1, ID_P2, ID_P3..]) js axios.post('/api/auth/login', { email: '[email protected]', password: 'password', });
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.put('/api/auth/roles/' + ID, { permissions: [ID_P1, ID_P2, ID_P3..], }); bash curl -X POST "APP_URL/api/auth/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"email\": \"[email protected]\", \"password\": \"password\"}" curl -X PUT "APP_URL/api/auth/roles/ID" -H "accept: application/json" -H "Authorization: Bearer TOKEN" -d "{ \"permissions\": \"[ID_P1, ID_P2, ID_P3..]\"}" bash php artisan tinker $user = User::find(ID) $user->roles->sync([ID_R1, ID_R2, ID_R3..]) js axios.post('/api/auth/login', { email: '[email protected]', password: 'password', });
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
axios.put('/api/auth/users/' + ID, { permissions: [ID_R1, ID_R2, ID_R3..], }); bash curl -X POST "APP_URL/api/auth/login" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"email\": \"[email protected]\", \"password\": \"password\"}" curl -X PUT "APP_URL/api/auth/users/ID" -H "accept: application/json" -H "Authorization: Bearer TOKEN" -d "{ \"roles\": \"[ID_R1, ID_R2, ID_R3..]\"}"
## Screenshots
All versions of jwt-auth-acl with dependencies
darkaonline/l5-swagger Version ^6.0|^7.0
illuminate/support Version ^6.0|^7.0
laravelha/support Version ^1.0
tymon/jwt-auth Version ^1.0