mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Expand code to support laravel passport
This commit is contained in:
parent
ca8b4cb11a
commit
f1d77bdb50
@ -44,7 +44,7 @@ use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
|
||||
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use Illuminate\View\Middleware\ShareErrorsFromSession;
|
||||
|
||||
use \Laravel\Passport\Http\Middleware\CreateFreshApiToken;
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Kernel
|
||||
@ -84,7 +84,7 @@ class Kernel extends HttpKernel
|
||||
StartFireflySession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
//SubstituteBindings::class,
|
||||
CreateFreshApiToken::class,
|
||||
],
|
||||
|
||||
// MUST NOT be logged in. Does not care about 2FA or confirmation.
|
||||
@ -95,7 +95,6 @@ class Kernel extends HttpKernel
|
||||
StartFireflySession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
//SubstituteBindings::class,
|
||||
Binder::class,
|
||||
RedirectIfAuthenticated::class,
|
||||
],
|
||||
@ -109,7 +108,6 @@ class Kernel extends HttpKernel
|
||||
StartFireflySession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
//SubstituteBindings::class,
|
||||
Binder::class,
|
||||
Authenticate::class,
|
||||
RedirectIfTwoFactorAuthenticated::class,
|
||||
@ -125,7 +123,6 @@ class Kernel extends HttpKernel
|
||||
StartFireflySession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
//SubstituteBindings::class,
|
||||
Binder::class,
|
||||
Authenticate::class,
|
||||
],
|
||||
@ -141,11 +138,11 @@ class Kernel extends HttpKernel
|
||||
StartFireflySession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
//SubstituteBindings::class,
|
||||
Authenticate::class,
|
||||
AuthenticateTwoFactor::class,
|
||||
Range::class,
|
||||
Binder::class,
|
||||
CreateFreshApiToken::class,
|
||||
],
|
||||
// MUST be logged in
|
||||
// MUST have 2fa
|
||||
@ -159,12 +156,12 @@ class Kernel extends HttpKernel
|
||||
StartFireflySession::class,
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
//SubstituteBindings::class,
|
||||
Authenticate::class,
|
||||
AuthenticateTwoFactor::class,
|
||||
IsAdmin::class,
|
||||
Range::class,
|
||||
Binder::class,
|
||||
CreateFreshApiToken::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
|
@ -24,6 +24,7 @@ namespace FireflyIII\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Passport\Passport;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
@ -44,5 +45,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
Passport::ignoreMigrations();
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Laravel\Passport\Passport;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
@ -46,5 +47,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies();
|
||||
Passport::routes();
|
||||
Passport::tokensExpireIn(now()->addDays(14));
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Log;
|
||||
use Request;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
@ -39,7 +40,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use Notifiable, HasApiTokens;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
|
@ -64,7 +64,7 @@ return [
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'driver' => 'token',
|
||||
'driver' => 'passport',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user