Hey Christian,
See here a simple code example of AuthenticationService.php.
<?php
namespace Xxx\Xxxauth\Service;
use Xxx\Xxxauth\Domain\Repository\BankaccountRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
class AuthenticationService extends \TYPO3\CMS\Core\Authentication\AuthenticationService
{
// We cannot use construct here:
// Too few arguments to function Xxx\Xxxauth\Service\AuthenticationService::__construct(), 0 passed in /Users/jaccovanderpost/Sites/Xxxned.test/public/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3221 and exactly 1 expected
// protected BankaccountRepository $bankaccountRepository;
//
// public function __construct(
// BankaccountRepository $bankaccountRepository
// )
// {
// $this->bankaccountRepository = $bankaccountRepository;
// }
public function getUser()
{
$bankaccountRepository = GeneralUtility::makeInstance(BankaccountRepository::class);
$test = $bankaccountRepository->findByUid(1);
// DebuggerUtility::var_dump($test);
// exit();
}
}
This results in the fe_login error mentioned above. When removing the repository lines or using QueryBuilder instead, the login process continues and the user is logged in. When removing the comments before var_dump the output is correct.
In 9.5 it was no problem to use repositories in an AuthenticationService.
In ext_localconf.php:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService(
'xxxauth',
'auth',
\Xxx\Xxxauth\Service\AuthenticationService::class,
[
'title' => 'Authentication service',
'description' => 'Authentication Lookup at XxxWorldWide',
'subtype' => 'getUserFE, authUserFE, getGroupsFE',
'available' => true,
'priority' => 90,
'quality' => 90,
'os' => '',
'exec' => '',
'className' => \Xxx\Xxxauth\Service\AuthenticationService::class
]
);