From 58a7199b05957ae9a9476eaffac07cf63f8e0fba Mon Sep 17 00:00:00 2001 From: Ben Rutland Date: Thu, 26 Aug 2021 20:40:25 +0100 Subject: [PATCH] updated auth middleware --- config/auth.php | 61 +++++++++++++++++++++++++++++++++++++++---------- functions.php | 11 +++------ 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/config/auth.php b/config/auth.php index bb57aac..ad10a27 100644 --- a/config/auth.php +++ b/config/auth.php @@ -4,17 +4,47 @@ /* |-------------------------------------------------------------------------- - | Authentication Provider Default + | Authentication Defaults |-------------------------------------------------------------------------- | - | This option controls the default authentication "provider". You may - | change this default as required. + | This option controls the default authentication "guard" and password + | reset options for your application. You may change these defaults + | as required, but they're a perfect start for most applications. | - | Supported: "radiate", "wordpress" + */ + + 'defaults' => [ + 'guard' => 'web', + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | here which uses session storage and the Eloquent user provider. + | + | All authentication drivers have a user provider. This defines how the + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | Supported: "session" | */ - 'default' => 'radiate', + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'users', + ], + + # 'api' => [ + # 'driver' => 'session', + # 'provider' => 'users', + # ], + ], /* |-------------------------------------------------------------------------- @@ -22,19 +52,26 @@ |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the - | users are accessed from the authentication system. + | users are actually retrieved out of your database or other storage + | mechanisms used by this application to persist your user's data. + | + | If you have multiple user tables or models you may configure multiple + | sources which represent each model / table. These sources may then + | be assigned to any extra authentication guards you have defined. + | + | Supported: "wordpress", "radiate" | */ 'providers' => [ + # 'users' => [ + # 'driver' => 'wordpress', + # 'table' => 'users', + # ], - 'radiate' => [ + 'users' => [ 'driver' => 'radiate', - 'model' => \Theme\Models\User::class, - ], - - 'wordpress' => [ - 'driver' => 'wordpress', + 'model' => \Theme\Models\User::class, ], ], ]; diff --git a/functions.php b/functions.php index 658b745..42ad195 100644 --- a/functions.php +++ b/functions.php @@ -46,14 +46,9 @@ ]); $app->routeMiddleware([ - 'auth' => Radiate\Auth\Middleware\Authenticate::class, - 'ajax' => [ - // - ], - 'api' => [ - // - ], - 'signed' => Radiate\Routing\Middleware\ValidateSignature::class, + 'auth' => Radiate\Auth\Middleware\Authenticate::class, + 'auth.basic' => Radiate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'signed' => Radiate\Routing\Middleware\ValidateSignature::class, ]);