This commit is contained in:
James Cole
2023-01-15 15:54:41 +01:00
parent e135d01655
commit dea86242fd
2 changed files with 9 additions and 4 deletions

View File

@@ -89,11 +89,11 @@ class Authenticate
{
Log::debug(sprintf('Now in %s', __METHOD__));
if (0 === count($guards)) {
// Log::debug('No guards present.');
Log::debug('No guards present.');
// go for default guard:
/** @noinspection PhpUndefinedMethodInspection */
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.
/** @noinspection PhpUndefinedMethodInspection */
/** @var User $user */
@@ -103,16 +103,18 @@ class Authenticate
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) {
Log::debug(sprintf('Now in guard loop, guard is "%s"', $guard));
if ('api' !== $guard) {
Log::debug('Guard is "api", call authenticate()');
$this->auth->guard($guard)->authenticate();
}
$result = $this->auth->guard($guard)->check();
Log::debug(sprintf('Result is %s', var_export($result, true)));
if ($result) {
Log::debug('Guard says user is authenticated.');
$user = $this->auth->guard($guard)->user();
$this->validateBlockedUser($user, $guards);
// According to PHPstan the method returns void, but we'll see.