diff options
author | Marvin Borner | 2018-07-20 16:34:32 +0200 |
---|---|---|
committer | Marvin Borner | 2018-07-20 16:34:32 +0200 |
commit | 74cb1477bb921a2378ea22a552b71a48c11e0931 (patch) | |
tree | 621ab17315be667c16dad8f3d5f44d67a7a47e8f /infrastructure/Auth/AuthServiceProvider.php | |
parent | 400591b34d4b0a6288834539808a9dede8a60e3a (diff) |
Better API (integrated oauth completely)
Diffstat (limited to 'infrastructure/Auth/AuthServiceProvider.php')
-rw-r--r-- | infrastructure/Auth/AuthServiceProvider.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/infrastructure/Auth/AuthServiceProvider.php b/infrastructure/Auth/AuthServiceProvider.php new file mode 100644 index 0000000..944f812 --- /dev/null +++ b/infrastructure/Auth/AuthServiceProvider.php @@ -0,0 +1,41 @@ +<?php + +namespace Infrastructure\Auth; + +use Carbon\Carbon; +use Laravel\Passport\Passport; +use Illuminate\Support\Facades\Gate; +use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; + +class AuthServiceProvider extends ServiceProvider +{ + /** + * The policy mappings for the application. + * + * @var array + */ + protected $policies = [ + 'App\Model' => 'App\Policies\ModelPolicy', + ]; + + /** + * Register any authentication / authorization services. + * + * @return void + */ + public function boot() + { + $this->registerPolicies(); + + Passport::routes(function ($router) { + $router->forAccessTokens(); + // Uncomment for allowing personal access tokens + // $router->forPersonalAccessTokens(); + $router->forTransientTokens(); + }); + + Passport::tokensExpireIn(Carbon::now()->addMinutes(10)); + + Passport::refreshTokensExpireIn(Carbon::now()->addDays(10)); + } +}
\ No newline at end of file |