// Use 'auth' service to find the user
// First found user will be used
$subType = 'getUser' . $this->loginType;
+ /** @var AuthenticationService $serviceObj */
foreach ($this->getAuthServices($subType, $loginData, $authInfo) as $serviceObj) {
if ($row = $serviceObj->getUser()) {
$tempuserArr[] = $row;
$this->logger->debug('Auth user', $tempuser);
$subType = 'authUser' . $this->loginType;
+ /** @var AuthenticationService $serviceObj */
foreach ($this->getAuthServices($subType, $loginData, $authInfo) as $serviceObj) {
if (($ret = $serviceObj->authUser($tempuser)) > 0) {
// If the service returns >=200 then no more checking is needed - useful for IP checking without password
$loginSecurityLevel = trim($GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['loginSecurityLevel']) ?: 'normal';
$passwordTransmissionStrategy = $passwordTransmissionStrategy ?: $loginSecurityLevel;
$this->logger->debug('Login data before processing', $loginData);
- $serviceChain = '';
$subType = 'processLoginData' . $this->loginType;
$authInfo = $this->getAuthInfoArray();
$isLoginDataProcessed = false;
$processedLoginData = $loginData;
- while (is_object($serviceObject = GeneralUtility::makeInstanceService('auth', $subType, $serviceChain))) {
- $serviceChain .= ',' . $serviceObject->getServiceKey();
- $serviceObject->initAuth($subType, $loginData, $authInfo, $this);
+ /** @var AuthenticationService $serviceObject */
+ foreach ($this->getAuthServices($subType, $loginData, $authInfo) as $serviceObject) {
$serviceResult = $serviceObject->processLoginData($processedLoginData, $passwordTransmissionStrategy);
if (!empty($serviceResult)) {
$isLoginDataProcessed = true;
// If the service returns >=200 then no more processing is needed
if ((int)$serviceResult >= 200) {
- unset($serviceObject);
break;
}
}
- unset($serviceObject);
}
if ($isLoginDataProcessed) {
$loginData = $processedLoginData;
*/
use TYPO3\CMS\Core\Authentication\AbstractUserAuthentication;
+use TYPO3\CMS\Core\Authentication\AuthenticationService;
use TYPO3\CMS\Core\Configuration\Features;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Session\Backend\Exception\SessionNotFoundException;
}
$groupDataArr = [];
// Use 'auth' service to find the groups for the user
- $serviceChain = '';
$subType = 'getGroups' . $this->loginType;
- while (is_object($serviceObj = GeneralUtility::makeInstanceService('auth', $subType, $serviceChain))) {
- $serviceChain .= ',' . $serviceObj->getServiceKey();
- $serviceObj->initAuth($subType, [], $authInfo, $this);
+ /** @var AuthenticationService $serviceObj */
+ foreach ($this->getAuthServices($subType, [], $authInfo) as $serviceObj) {
$groupData = $serviceObj->getGroups($this->user, $groupDataArr);
if (is_array($groupData) && !empty($groupData)) {
// Keys in $groupData should be unique ids of the groups (like "uid") so this function will override groups.
$groupDataArr = $groupData + $groupDataArr;
}
- unset($serviceObj);
- }
- if ($serviceChain) {
- $this->logger->debug($subType . ' auth services called: ' . $serviceChain);
}
if (empty($groupDataArr)) {
$this->logger->debug('No usergroups found by services');
foreach ($groupDataArr as $groupData) {
// By default a group is valid
$validGroup = true;
- $serviceChain = '';
$subType = 'authGroups' . $this->loginType;
- while (is_object($serviceObj = GeneralUtility::makeInstanceService('auth', $subType, $serviceChain))) {
- $serviceChain .= ',' . $serviceObj->getServiceKey();
- $serviceObj->initAuth($subType, [], $authInfo, $this);
+ foreach ($this->getAuthServices($subType, [], $authInfo) as $serviceObj) {
+ // we assume that the service defines the authGroup function
if (!$serviceObj->authGroup($this->user, $groupData)) {
$validGroup = false;
$this->logger->debug($subType . ' auth service did not auth group', [
'uid ' => $groupData['uid'],
- 'title' => $groupData['title']
+ 'title' => $groupData['title'],
]);
break;
}
- unset($serviceObj);
}
- unset($serviceObj);
if ($validGroup && (string)$groupData['uid'] !== '') {
$this->groupData['title'][$groupData['uid']] = $groupData['title'];
$this->groupData['uid'][$groupData['uid']] = $groupData['uid'];