Skip to content

Firefly III: a personal finances manager

Remote user guard accepts custom header

James Cole981960fcb494
diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php
index baf2d94f73..d93b98bcfa 100644
--- a/app/Support/Authentication/RemoteUserGuard.php
+++ b/app/Support/Authentication/RemoteUserGuard.php
@@ -69,16 +69,13 @@ class RemoteUserGuard implements Guard
return;
}
// Get the user identifier from $_SERVER
- $userID = request()->server('REMOTE_USER') ?? null;
+ $header = config('auth.guard_header', 'REMOTE_USER');
+ $userID = request()->server($header) ?? null;
if (null === $userID) {
- Log::debug('No user in REMOTE_USER.');
- throw new FireflyException('The REMOTE_USER header was unexpectedly empty.');
+ Log::error(sprintf('No user in header "%s".', $header));
+ throw new FireflyException('The guard header was unexpectedly empty. See the logs.');
}
-
- // do some basic debugging here:
- // $userID = 'test@firefly';
-
/** @var User $user */
$user = $this->provider->retrieveById($userID);