authentication: SessionAuthenticator `'identify' => true` config does not work

What i did:

$authenticationService->setConfig('identityClass', User::class);
$authenticationService->loadAuthenticator('Authentication.Session', [
    'fields' => [IdentifierInterface::CREDENTIAL_USERNAME => 'email'],
    'identify' => true,
]);
$authenticationService->loadIdentifier('Authentication.Password', [
    'fields' => [
        IdentifierInterface::CREDENTIAL_USERNAME => 'email',
        IdentifierInterface::CREDENTIAL_PASSWORD => 'password',
    ],
    'passwordHasher' => 'Authentication.Default',
    'resolver' => [
        'className' => 'Authentication.Orm',
        'userModel' => UsersTable::class,
        'finder' => 'session',
    ],
]);

After logging in, i manually modified logged user database row and refreshed page and identity in session did not update.

After investigation i have determined that new and updated identity that was indeed fetched from database but this condition resolves to false and this new identity value is never written to session

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Seems he might be directly accessing the session instead of getting the identity through the request or the authn service.

So don’t do that is the solution.

Having the option to set the identity refetched from db to the session does make sense.