This commit is contained in:
James Cole
2020-06-11 06:55:13 +02:00
parent 2130eef971
commit a63b8322db
4 changed files with 245 additions and 5 deletions

View File

@@ -22,8 +22,12 @@ declare(strict_types=1);
namespace FireflyIII\Providers;
use FireflyIII\Support\Authentication\RemoteUserGuard;
use FireflyIII\Support\Authentication\RemoteUserProvider;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Laravel\Passport\Passport;
use Log;
/**
* @codeCoverageIgnore
@@ -48,11 +52,28 @@ class AuthServiceProvider extends ServiceProvider
*/
public function boot(): void
{
Log::debug('Boot() of AuthServiceProvider');
Auth::provider(
'remote_user_provider', function ($app, array $config) {
//Log::debug('Creating remote_user_provider in Closure');
return new RemoteUserProvider($app, $config);
}
);
Auth::extend(
'remote_user_guard', static function ($app, string $name, array $config) {
//Log::debug('Creating remote_user_guard in Closure');
return new RemoteUserGuard(Auth::createUserProvider($config['provider']), $app);
}
);
$this->registerPolicies();
Passport::routes();
Passport::tokensExpireIn(now()->addDays(14));
//
}
}