Fix #80 - Cannot access accounts with proxy header auth

This commit is contained in:
Bubka
2022-05-19 15:50:06 +02:00
parent 9deb821d53
commit abce20419b
6 changed files with 50 additions and 33 deletions

View File

@ -3,7 +3,6 @@
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Support\Arr;
class Authenticate extends Middleware
{
@ -23,13 +22,11 @@ class Authenticate extends Middleware
$guards = [null];
}
else {
// We inject the reserve-proxy guard to ensure it will be available for every routes
// besides their declared guards. This way we ensure priority to declared guards and
// a fallback to the reverse-proxy guard
// We replace routes guard by the reverse proxy guard if necessary
$proxyGuard = 'reverse-proxy-guard';
if (config('auth.defaults.guard') === $proxyGuard && !Arr::has($guards, $proxyGuard)) {
$guards[] = $proxyGuard;
if (config('auth.defaults.guard') === $proxyGuard) {
$guards = [$proxyGuard];
}
}