1
0

AuthServiceProvider.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Providers;
  3. use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
  4. use Laravel\Passport\Passport;
  5. use Gate;
  6. class AuthServiceProvider extends ServiceProvider
  7. {
  8. /**
  9. * The policy mappings for the application.
  10. *
  11. * @var array
  12. */
  13. protected $policies = [
  14. // 'App\Model' => 'App\Policies\ModelPolicy',
  15. ];
  16. /**
  17. * Register any authentication / authorization services.
  18. *
  19. * @return void
  20. */
  21. public function boot()
  22. {
  23. if(config('app.env') === 'production' && config('pixelfed.oauth_enabled') == true) {
  24. Passport::tokensExpireIn(now()->addDays(config('instance.oauth.token_expiration', 356)));
  25. Passport::refreshTokensExpireIn(now()->addDays(config('instance.oauth.refresh_expiration', 400)));
  26. Passport::enableImplicitGrant();
  27. if(config('instance.oauth.pat.enabled')) {
  28. Passport::personalAccessClientId(config('instance.oauth.pat.id'));
  29. }
  30. Passport::setDefaultScope([
  31. 'read',
  32. 'write',
  33. 'follow',
  34. ]);
  35. Passport::tokensCan([
  36. 'read' => 'Full read access to your account',
  37. 'write' => 'Full write access to your account',
  38. 'follow' => 'Ability to follow other profiles',
  39. 'push' => ''
  40. ]);
  41. }
  42. // Gate::define('viewWebSocketsDashboard', function ($user = null) {
  43. // return $user->is_admin;
  44. // });
  45. }
  46. }