Changeset View
Changeset View
Standalone View
Standalone View
src/app/Providers/AuthServiceProvider.php
<?php | <?php | ||||
namespace App\Providers; | namespace App\Providers; | ||||
use Illuminate\Support\Facades\Auth; | |||||
use Illuminate\Support\Facades\Route; | |||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; | use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; | ||||
use Laravel\Passport\Passport; | |||||
class AuthServiceProvider extends ServiceProvider | class AuthServiceProvider extends ServiceProvider | ||||
{ | { | ||||
/** | /** | ||||
* The policy mappings for the application. | * The policy mappings for the application. | ||||
* | * | ||||
* @var array<class-string, class-string> | * @var array<class-string, class-string> | ||||
*/ | */ | ||||
protected $policies = [ | protected $policies = [ | ||||
]; | ]; | ||||
/** | /** | ||||
* Register any authentication / authorization services. | * Register any authentication / authorization services. | ||||
* | * | ||||
* @return void | * @return void | ||||
*/ | */ | ||||
public function boot() | public function boot() | ||||
{ | { | ||||
$this->registerPolicies(); | $this->registerPolicies(); | ||||
Passport::tokensCan([ | |||||
'api' => 'Access API', | |||||
'mfa' => 'Access MFA API', | |||||
]); | |||||
Passport::tokensExpireIn(now()->addMinutes(\config('auth.token_expiry_minutes'))); | |||||
Passport::refreshTokensExpireIn(now()->addMinutes(\config('auth.refresh_token_expiry_minutes'))); | |||||
Passport::personalAccessTokensExpireIn(now()->addMonths(6)); | |||||
Passport::useClientModel(\App\Auth\PassportClient::class); | |||||
Passport::tokenModel()::observe(\App\Observers\Passport\TokenObserver::class); | |||||
} | } | ||||
} | } |