-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Labels
Description
Pulse Version
v1.0.0-beta9
Laravel Version
10.40.0
PHP Version
8.3.1
Livewire Version
3.3.5
Database Driver & Version
postgres:16-alpine3.19 (Docker linux amd/64)
Description
Working on a solution with two different user's guards, we notice that the POST /livewire/update requests does not use the intended guard for pulse. Indeed, the auth:other_guard middleware is set up in the Pulse config file, but it seems that the POST livewire/update request does not use the middleware in the pulse config and instead, only the web middleware, thus using the default user guard.
Steps To Reproduce
-
Set up a second Auth provider (
admin_sessionin this example) -
Add another user guard in
config/auth.php.
<?php
use App\Models\User;
return [
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'admin' => [
'driver' => 'admin_session',
'provider' => 'users',
],
],
// ...
}- Adapt pulse config (
config/pulse.php) to use the intended guard
use Laravel\Pulse\Http\Middleware\Authorize;
return [
'middleware' => [
'auth:admin',
'web',
Authorize::class,
],
]- Connect to both user systems, and notice that the main pulse page uses the
adminguard as intended, whereasPOST livewire/updateuses the defaultwebguard. It can be easily noticed using theviewPulseGate.
use Illuminate\Support\Facades\Gate;
use App\Models\User;
Gate::define('viewPulse', function (?User $user) {
if ($user->login !== 'theoneconnectedtotheadmin') {
throw new \Exception('Wrong one');
}
return true;
});LuonaMill, redpiks, kefir500 and ianfortier