Download the PHP package denniseilander/laravel-passport-scopes-restriction without Composer
On this page you can find all versions of the php package denniseilander/laravel-passport-scopes-restriction. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download denniseilander/laravel-passport-scopes-restriction
More information about denniseilander/laravel-passport-scopes-restriction
Files in denniseilander/laravel-passport-scopes-restriction
Package laravel-passport-scopes-restriction
Short Description Restrict scopes for different Laravel Passport clients.
License MIT
Homepage https://github.com/denniseilander/laravel-passport-client-scopes
Informations about the package laravel-passport-scopes-restriction
Laravel Passport client scopes restriction
This package allows you to limit the scopes a client can request.
By default, Laravel Passport doesn't support restricting scopes per client.
Every client can access all available scopes in your project. This package solves that problem.
When to use this package
When your api project contains multiple third party oauth_clients, and you can't control which scopes they request, you may want to limit the scopes a client can request.
Installation
You can install the package via composer:
You can publish and run the migrations with:
Optionally you can publish the config file with:
Usage
After running the migration, you may add specific scopes to each of your oauth_clients allowed_scopes
column.
You can assign specific scopes the same way as they are assigned to the oauth_access_tokens scopes
column:
Every time an access token is requested for a specific client, the allowed_scopes
will be added to the scopes
column of that token.
You may also add an allowed scope within your POST: passport/oauth
request, to specific assign a scope to that access_token:
This will only assign scope-1
to the access_token.
You may leave the scope field empty, which will assign all allowed scopes to the access_token
Syncing existing scopes with new allowed scopes
Sometimes you have your oauth_access_tokens
table filled with existing tokens and want to update the scopes
because you've changed the allowed_scopes
value of a specific client.
This package makes it easy to synchronize exiting token scopes with your allowed scopes by running the following command:
If you've added new scopes to the allowed_scopes
column on the clients table,
but you want to keep the existing scopes on your tokens, you may add the --keep-existing-scopes
flag to the sync command:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Dennis Eilander
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-passport-scopes-restriction with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0
laravel/passport Version ^12.0
ext-json Version *