Hello all!
This is my current implementation to check beside Username and Password that the User is enabled:
src/Model/Table/UsersTable.php:
/**
* Add the 'enabled' fields in authentication with AuthenticationService
*
* @param Query $query
* @param array $options
* @return Query
*/
public function findEnabledUser(Query $query, array $options): Query
{
return $query->where(['Users.enabled' => true);
}
src/Application.php:
public function getAuthenticationService(ServerRequestInterface $request): AuthenticationServiceInterface {
...
// Load identifiers, ensure we check email and password fields
$authenticationService->loadIdentifier('Authentication.Password', [
'fields' => [
'username' => 'username',
'password' => 'password',
],
'resolver' => [
'className' => 'Authentication.Orm',
'userModel' => 'Users',
'finder' => 'enabledUser' // default: 'all'
],
]);
...
In Authentication 3.3.0 the loadIdentifier() usage is deprecated.
How do I directly pass Identifier to Authenticator?