mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Add debug for https://github.com/firefly-iii/firefly-iii/issues/6831
This commit is contained in:
@@ -89,11 +89,11 @@ class Authenticate
|
|||||||
{
|
{
|
||||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||||
if (0 === count($guards)) {
|
if (0 === count($guards)) {
|
||||||
// Log::debug('No guards present.');
|
Log::debug('No guards present.');
|
||||||
// go for default guard:
|
// go for default guard:
|
||||||
/** @noinspection PhpUndefinedMethodInspection */
|
/** @noinspection PhpUndefinedMethodInspection */
|
||||||
if ($this->auth->check()) {
|
if ($this->auth->check()) {
|
||||||
// Log::debug('Default guard says user is authenticated.');
|
Log::debug('Default guard says user is authenticated.');
|
||||||
// do an extra check on user object.
|
// do an extra check on user object.
|
||||||
/** @noinspection PhpUndefinedMethodInspection */
|
/** @noinspection PhpUndefinedMethodInspection */
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
@@ -103,16 +103,18 @@ class Authenticate
|
|||||||
|
|
||||||
return $this->auth->authenticate(); // @phpstan-ignore-line (thinks function returns void)
|
return $this->auth->authenticate(); // @phpstan-ignore-line (thinks function returns void)
|
||||||
}
|
}
|
||||||
// Log::debug('Guard array is not empty.');
|
Log::debug('Guard array is not empty.');
|
||||||
|
|
||||||
foreach ($guards as $guard) {
|
foreach ($guards as $guard) {
|
||||||
Log::debug(sprintf('Now in guard loop, guard is "%s"', $guard));
|
Log::debug(sprintf('Now in guard loop, guard is "%s"', $guard));
|
||||||
if ('api' !== $guard) {
|
if ('api' !== $guard) {
|
||||||
|
Log::debug('Guard is "api", call authenticate()');
|
||||||
$this->auth->guard($guard)->authenticate();
|
$this->auth->guard($guard)->authenticate();
|
||||||
}
|
}
|
||||||
$result = $this->auth->guard($guard)->check();
|
$result = $this->auth->guard($guard)->check();
|
||||||
Log::debug(sprintf('Result is %s', var_export($result, true)));
|
Log::debug(sprintf('Result is %s', var_export($result, true)));
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
Log::debug('Guard says user is authenticated.');
|
||||||
$user = $this->auth->guard($guard)->user();
|
$user = $this->auth->guard($guard)->user();
|
||||||
$this->validateBlockedUser($user, $guards);
|
$this->validateBlockedUser($user, $guards);
|
||||||
// According to PHPstan the method returns void, but we'll see.
|
// According to PHPstan the method returns void, but we'll see.
|
||||||
|
@@ -81,6 +81,9 @@ class RemoteUserGuard implements Guard
|
|||||||
// Get the user identifier from $_SERVER or apache filtered headers
|
// Get the user identifier from $_SERVER or apache filtered headers
|
||||||
$header = config('auth.guard_header', 'REMOTE_USER');
|
$header = config('auth.guard_header', 'REMOTE_USER');
|
||||||
$userID = request()->server($header) ?? null;
|
$userID = request()->server($header) ?? null;
|
||||||
|
|
||||||
|
//$userID = 'james@firefly';
|
||||||
|
|
||||||
if (function_exists('apache_request_headers')) {
|
if (function_exists('apache_request_headers')) {
|
||||||
$userID = request()->server($header) ?? apache_request_headers()[$header] ?? null;
|
$userID = request()->server($header) ?? apache_request_headers()[$header] ?? null;
|
||||||
}
|
}
|
||||||
@@ -146,7 +149,7 @@ class RemoteUserGuard implements Guard
|
|||||||
public function hasUser(): bool
|
public function hasUser(): bool
|
||||||
{
|
{
|
||||||
Log::debug(sprintf('Now at %s', __METHOD__));
|
Log::debug(sprintf('Now at %s', __METHOD__));
|
||||||
// TODO: Implement hasUser() method.
|
throw new FireflyException('Did not implement RemoteUserGuard::hasUser()');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user