I want to extend Laravel stock authentication to use the OAuth server to search and authenticate users, taking advantage of existing functionality. I have already managed to expand EloquentUserProviderto partially rewrite / expand the implementation of the contract Illuminate\Contracts\Auth\UserProvider. The current implementation is as follows:
class EloquentOauthServiceProvider extends ServiceProvider
{
public function boot()
{
Auth::provider('oauth',function($app){
$model = $app['config']['auth.providers.oauth.model'];
$repository = new OauthUserRepository();
return new EloquentOauthUserProvider($app['hash'], $model, $repository);
});
}
}
In the configuration, auth.phpI changed the descriptors as follows:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'oauth',
],
]
'providers' => [
'oauth' => [
'driver' => 'oauth',
'model' => App\Models\User::class,
],
]
, . , SessionGuard (login logout, ), OAuth, Laravel. , (, Laravel 5.2), Authmanager, overkill.
, : Laravel 5.2 SessionGuard?