laravel / passport

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

[11.x] Add Provider Guard to ClientRepository for Personal Access Clients #1655

Closed michaelnabil230 closed 1 year ago

michaelnabil230 commented 1 year ago

This PR adds support for provider guards in the ClientRepository class of Laravel Passport for creating Personal Access Clients. The provider guard functionality allows developers to authenticate users using any provider they choose, or any custom provider.

The implementation involves adding a provider parameter to the createPersonalAccessClient method in the ClientRepository class. If the parameter is specified, the authentication will be done using the specified provider guard. If the parameter is not specified, the authentication will be done using the default provider guard.

This feature is useful for developers who want to use a custom authentication provider in their applications while still being able to create Personal Access Clients in Laravel Passport. It also allows for multi-authorizations in applications.

I have included tests to ensure that the functionality works as expected.

Thank you for your time and consideration in reviewing this PR.

It complements the idea of (https://github.com/laravel/passport/pull/1606) and (https://github.com/laravel/passport/pull/1617)