laravel / passport

Laravel Passport provides OAuth2 server support to Laravel.
https://laravel.com/docs/passport
MIT License
3.3k stars 781 forks source link

[11.x] Add support for inherited scopes when limiting scopes on clients #1683

Closed axlon closed 1 year ago

axlon commented 1 year ago

This PR is a minor improvement to #1682.

This PR makes scope inheritance work with limiting scope access for clients.

As an example, let's say we have the following scopes:

user       update the user's info
user:read  read the user's info

And we have the following client:

Passport::$withInheritedScopes = true;

$client = new Client();
$client->scopes = ['user'];

Before this PR: The user:read scope cannot be granted to the client, because the client doesn't have access to it After this PR: Both of the scopes can be granted to the client if requested