Update AuthServiceProvider, increase default token + refresh token lifetime

This commit is contained in:
Daniel Supernault 2021-05-27 23:04:24 -06:00
parent 0788bffa37
commit 178ed63d0a
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -26,10 +26,10 @@ class AuthServiceProvider extends ServiceProvider
{
$this->registerPolicies();
if(config('pixelfed.oauth_enabled')) {
if(config_cache('pixelfed.oauth_enabled') == true) {
Passport::routes(null, ['middleware' => ['twofactor', \Fruitcake\Cors\HandleCors::class]]);
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 15)));
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 30)));
Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 356)));
Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 400)));
Passport::enableImplicitGrant();
if(config('instance.oauth.pat.enabled')) {
Passport::personalAccessClientId(config('instance.oauth.pat.id'));
@ -48,8 +48,8 @@ class AuthServiceProvider extends ServiceProvider
]);
}
Gate::define('viewWebSocketsDashboard', function ($user = null) {
return $user->is_admin;
});
// Gate::define('viewWebSocketsDashboard', function ($user = null) {
// return $user->is_admin;
// });
}
}