‪TYPO3CMS  ‪main
AbstractUserAuthentication.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use Psr\EventDispatcher\EventDispatcherInterface;
19 use Psr\Http\Message\ResponseInterface;
20 use Psr\Http\Message\ServerRequestInterface;
21 use Psr\Log\LoggerAwareInterface;
22 use Psr\Log\LoggerAwareTrait;
23 use Symfony\Component\HttpFoundation\Cookie;
48 use ‪TYPO3\CMS\Core\SysLog\Action\Login as SystemLogLoginAction;
49 use ‪TYPO3\CMS\Core\SysLog\Error as SystemLogErrorClassification;
50 use ‪TYPO3\CMS\Core\SysLog\Type as SystemLogType;
52 
60 abstract class ‪AbstractUserAuthentication implements LoggerAwareInterface
61 {
62  use LoggerAwareTrait;
64 
69  public ‪$name = '';
70 
75  public ‪$user_table = '';
76 
81  public ‪$usergroup_table = '';
82 
87  public ‪$username_column = '';
88 
93  public ‪$userident_column = '';
94 
99  public ‪$userid_column = '';
100 
105  public ‪$usergroup_column = '';
106 
111  public ‪$lastLogin_column = '';
112 
117  public ‪$enablecolumns = [
118  'rootLevel' => '',
119  // Boolean: If TRUE, 'AND pid=0' will be a part of the query...
120  'disabled' => '',
121  'starttime' => '',
122  'endtime' => '',
123  'deleted' => '',
124  ];
125 
130  public ‪$formfield_uname = '';
131 
136  public ‪$formfield_uident = '';
137 
142  public ‪$formfield_status = '';
143 
153  protected ‪$lifetime = 0;
154 
159  public ‪$writeStdLog = false;
160 
165  public ‪$writeAttemptLog = false;
166 
171  public ‪$checkPid = true;
172 
177  public ‪$checkPid_value = 0;
178 
183  public ‪$loginSessionStarted = false;
184 
189  public ‪$user;
190 
194  public array ‪$userGroups = [];
195 
200  public ‪$dontSetCookie = false;
201 
206  public ‪$loginType = '';
207 
211  public array ‪$uc = [];
212 
213  protected ?‪UserSession ‪$userSession = null;
214 
216 
220  protected ?Cookie ‪$setCookie = null;
221 
227  public function ‪__construct()
228  {
229  // Backend or frontend login - used for auth services
230  if (empty($this->loginType)) {
231  throw new ‪Exception('No loginType defined, must be set explicitly by subclass', 1476045345);
232  }
233  $this->lifetime = (int)(‪$GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['lifetime'] ?? 0);
234  }
235 
243  {
244  $this->userSessionManager = ‪$userSessionManager ?? ‪UserSessionManager::create($this->loginType);
245  $this->userSession = $this->userSessionManager->createAnonymousSession();
246  }
247 
257  public function ‪start(ServerRequestInterface $request)
258  {
259  $this->logger->debug('## Beginning of auth logging.');
260 
261  // Make certain that NO user is set initially
262  $this->user = null;
263 
264  if (!isset($this->userSessionManager)) {
266  }
267  $this->userSession = $this->userSessionManager->createFromRequestOrAnonymous($request, $this->name);
268 
269  // Load user session, check to see if anyone has submitted login-information and if so authenticate
270  // the user with the session. $this->user[uid] may be used to write log...
271  try {
272  $this->‪checkAuthentication($request);
273  } catch (MfaRequiredException $mfaRequiredException) {
274  // Ensure the cookie is still set to keep the user session available
275  if (!$this->dontSetCookie || $this->‪isRefreshTimeBasedCookie()) {
276  $this->‪setSessionCookie();
277  }
278  throw $mfaRequiredException;
279  }
280  // Set cookie if generally enabled or if the current session is a non-session cookie (FE permalogin)
281  if (!$this->dontSetCookie || $this->‪isRefreshTimeBasedCookie()) {
282  $this->‪setSessionCookie();
283  }
284  // Hook for alternative ways of filling the $this->user array (is used by the "timtaw" extension)
285  foreach (‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postUserLookUp'] ?? [] as $funcName) {
286  $_params = [
287  'pObj' => $this,
288  ];
289  GeneralUtility::callUserFunction($funcName, $_params, $this);
290  }
291  }
292 
296  public function ‪appendCookieToResponse(ResponseInterface $response): ResponseInterface
297  {
298  if ($this->setCookie !== null) {
299  $response = $response->withAddedHeader('Set-Cookie', $this->setCookie->__toString());
300  }
301  return $response;
302  }
303 
307  protected function ‪setSessionCookie()
308  {
309  $isRefreshTimeBasedCookie = $this->‪isRefreshTimeBasedCookie();
310  if ($this->‪isSetSessionCookie() || $isRefreshTimeBasedCookie) {
311  // Get the domain to be used for the cookie (if any):
312  $cookieDomain = $this->‪getCookieDomain();
313  // If no cookie domain is set, use the base path:
314  $cookiePath = $cookieDomain ? '/' : GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
315  // If the cookie lifetime is set, use it:
316  $cookieExpire = $isRefreshTimeBasedCookie ? ‪$GLOBALS['EXEC_TIME'] + $this->lifetime : 0;
317  // Valid options are "strict", "lax" or "none", whereas "none" only works in HTTPS requests (default & fallback is "strict")
318  $cookieSameSite = $this->sanitizeSameSiteCookieValue(
319  strtolower(‪$GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['cookieSameSite'] ?? Cookie::SAMESITE_STRICT)
320  );
321  // Use the secure option when the current request is served by a secure connection:
322  // SameSite "none" needs the secure option (only allowed on HTTPS)
323  $isSecure = $cookieSameSite === Cookie::SAMESITE_NONE || GeneralUtility::getIndpEnv('TYPO3_SSL');
324  $sessionId = $this->userSession->getIdentifier();
325  $cookieValue = $this->userSession->getJwt();
326  $this->setCookie = new Cookie(
327  $this->name,
328  $cookieValue,
329  $cookieExpire,
330  $cookiePath,
331  $cookieDomain,
332  $isSecure,
333  true,
334  false,
335  $cookieSameSite
336  );
337  $message = $isRefreshTimeBasedCookie ? 'Updated Cookie: {session}, {domain}' : 'Set Cookie: {session}, {domain}';
338  $this->logger->debug($message, [
339  'session' => sha1($sessionId),
340  'domain' => $cookieDomain,
341  ]);
342  }
343  }
344 
351  protected function ‪getCookieDomain()
352  {
353  $result = '';
354  $cookieDomain = ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['cookieDomain'] ?? '';
355  // If a specific cookie domain is defined for a given application type, use that domain
356  if (!empty(‪$GLOBALS['TYPO3_CONF_VARS'][$this->loginType]['cookieDomain'])) {
357  $cookieDomain = ‪$GLOBALS['TYPO3_CONF_VARS'][‪$this->loginType]['cookieDomain'];
358  }
359  if ($cookieDomain) {
360  if ($cookieDomain[0] === '/') {
361  $match = [];
362  $matchCnt = @preg_match($cookieDomain, GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'), $match);
363  if ($matchCnt === false) {
364  $this->logger->critical('The regular expression for the cookie domain ({domain}) contains errors. The session is not shared across sub-domains.', ['domain' => $cookieDomain]);
365  } elseif ($matchCnt) {
366  $result = $match[0];
367  }
368  } else {
369  $result = $cookieDomain;
370  }
371  }
372  return $result;
373  }
374 
381  public function ‪isSetSessionCookie()
382  {
383  return $this->userSession->isNew() && $this->lifetime === 0;
384  }
385 
392  public function ‪isRefreshTimeBasedCookie()
393  {
394  return $this->lifetime > 0;
395  }
396 
400  protected function ‪getAuthServiceConfiguration(): array
401  {
402  if (is_array(‪$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup'] ?? null)) {
403  return ‪$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup'];
404  }
405  return [];
406  }
407 
414  public function ‪checkAuthentication(ServerRequestInterface $request)
415  {
416  $authConfiguration = $this->‪getAuthServiceConfiguration();
417  if (!empty($authConfiguration)) {
418  $this->logger->debug('Authentication Service Configuration found.', ['auth_configuration' => $authConfiguration]);
419  }
420  $userRecordCandidate = false;
421  // User is not authenticated by default
422  $authenticated = false;
423  // User want to login with passed login data (name/password)
424  $activeLogin = false;
425  $this->logger->debug('Login type: {type}', ['type' => $this->loginType]);
426  // Get Login/Logout data submitted by a form or params
427  ‪$loginData = $this->‪getLoginFormData($request);
428  $this->logger->debug('Login data', $this->‪removeSensitiveLoginDataForLoggingInfo(‪$loginData));
429  // Active logout (eg. with "logout" button)
430  if (‪$loginData['status'] === ‪LoginType::LOGOUT) {
431  if ($this->writeStdLog) {
432  // $type,$action,$error,$details_nr,$details,$data,$tablename,$recuid,$recpid
433  $this->‪writelog(SystemLogType::LOGIN, SystemLogLoginAction::LOGOUT, SystemLogErrorClassification::MESSAGE, 2, 'User %s logged out', [$this->user['username']], '', 0, 0);
434  }
435  $this->logger->info('User logged out. Id: {session}', ['session' => sha1($this->userSession->getIdentifier())]);
436  $this->‪logoff();
437  }
438  // Determine whether we need to skip session update.
439  // This is used mainly for checking session timeout in advance without refreshing the current session's timeout.
440  $skipSessionUpdate = (bool)($request->getQueryParams()['skipSessionUpdate'] ?? false);
441  $isExistingSession = false;
442  $anonymousSession = false;
443  $authenticatedUserFromSession = null;
444  if (!$this->userSession->isNew()) {
445  // Read user data if this is bound to a user
446  // However, if the user data is not valid, or the session has timed out we'll recreate a new anonymous session
447  if ($this->userSession->getUserId() > 0) {
448  $authenticatedUserFromSession = $this->‪fetchValidUserFromSessionOrDestroySession($skipSessionUpdate);
449  }
450  $isExistingSession = !$this->userSession->isNew();
451  $anonymousSession = $isExistingSession && $this->userSession->isAnonymous();
452  }
453 
454  // Active login (eg. with login form).
455  if (‪$loginData['status'] === ‪LoginType::LOGIN) {
456  if (!$isExistingSession) {
457  $activeLogin = true;
458  $this->logger->debug('Active login (eg. with login form)');
459  // check referrer for submitted login values
460  if ($this->formfield_status && ‪$loginData['uident'] && ‪$loginData['uname']) {
461  // Delete old user session if any
462  $this->‪logoff();
463  }
464  // Refuse login for _CLI users, if not processing a CLI request type
465  // (although we shouldn't be here in case of a CLI request type)
466  if (stripos(‪$loginData['uname'], '_CLI_') === 0 && !‪Environment::isCli()) {
467  throw new \RuntimeException('TYPO3 Fatal Error: You have tried to login using a CLI user. Access prohibited!', 1270853931);
468  }
469  }
470  // Cause elevation of privilege, make sure regenerateSessionId is called later on
471  // Note for further research: $anonymousSession actually implies having $isExistingSession = true
472  // allowing to further simplify this concern.
473  if ($anonymousSession) {
474  $activeLogin = true;
475  }
476  }
477 
478  if ($isExistingSession && $authenticatedUserFromSession !== null) {
479  $this->logger->debug('User found in session', [
480  $this->userid_column => $authenticatedUserFromSession[$this->userid_column] ?? null,
481  $this->username_column => $authenticatedUserFromSession[$this->username_column] ?? null,
482  ]);
483  } else {
484  $this->logger->debug('No user session found');
485  }
486 
487  if ($activeLogin) {
488  $context = GeneralUtility::makeInstance(Context::class);
489  $securityAspect = ‪SecurityAspect::provideIn($context);
490  $requestToken = $securityAspect->getReceivedRequestToken();
491 
492  $event = new BeforeRequestTokenProcessedEvent($this, $request, $requestToken);
493  GeneralUtility::makeInstance(EventDispatcherInterface::class)->dispatch($event);
494  $requestToken = $event->getRequestToken();
495 
496  $requestTokenScopeMatches = ($requestToken->scope ?? null) === 'core/user-auth/' . strtolower($this->loginType);
497  if (!$requestTokenScopeMatches) {
498  $this->logger->debug('Missing or invalid request token during login', ['requestToken' => $requestToken]);
499  // important: disable `$activeLogin` state
500  $activeLogin = false;
501  } elseif ($requestToken instanceof RequestToken && $requestToken->getSigningSecretIdentifier() !== null) {
502  $securityAspect->getSigningSecretResolver()->revokeIdentifier(
503  $requestToken->getSigningSecretIdentifier()
504  );
505  }
506  }
507 
508  // Fetch users from the database (or somewhere else)
509  $possibleUsers = $this->‪fetchPossibleUsers(‪$loginData, $activeLogin, $isExistingSession, $authenticatedUserFromSession, $request);
510 
511  // If no new user was set we use the already found user session
512  if (empty($possibleUsers) && $isExistingSession && !$anonymousSession) {
513  // Check if the previous services returned a proper user
514  if (is_array($authenticatedUserFromSession)) {
515  $possibleUsers[] = $authenticatedUserFromSession;
516  $userRecordCandidate = $authenticatedUserFromSession;
517  // User is authenticated because we found a user session
518  $authenticated = true;
519  $this->logger->debug('User session used', [
520  $this->userid_column => $authenticatedUserFromSession[$this->userid_column] ?? '',
521  $this->username_column => $authenticatedUserFromSession[$this->username_column] ?? '',
522  ]);
523  }
524  }
525 
526  // Re-auth user when 'auth'-service option is set
527  if (!empty($authConfiguration[$this->loginType . '_alwaysAuthUser'])) {
528  $authenticated = false;
529  $this->logger->debug('alwaysAuthUser option is enabled');
530  }
531  // Authenticate the user if needed
532  if (!empty($possibleUsers) && !$authenticated) {
533  foreach ($possibleUsers as $userRecordCandidate) {
534  // Use 'auth' service to authenticate the user
535  // If one service returns FALSE then authentication failed
536  // a service might return 100 which means there's no reason to stop but the user can't be authenticated by that service
537  $this->logger->debug('Auth user', $this->‪removeSensitiveLoginDataForLoggingInfo($userRecordCandidate, true));
538  $subType = 'authUser' . ‪$this->loginType;
539 
541  foreach ($this->‪getAuthServices($subType, ‪$loginData, $authenticatedUserFromSession, $request) as $serviceObj) {
542  if (($ret = (int)$serviceObj->authUser($userRecordCandidate)) > 0) {
543  // If the service returns >=200 then no more checking is needed - useful for IP checking without password
544  if ($ret >= 200) {
545  $authenticated = true;
546  break;
547  }
548  if ($ret < 100) {
549  $authenticated = true;
550  }
551  // $ret is between 100 and 199 which means "I'm not responsible, ask others"
552  } else {
553  // $ret is < 0
554  $authenticated = false;
555  break;
556  }
557  }
558 
559  if ($authenticated) {
560  // Leave foreach() because a user is authenticated
561  break;
562  }
563  }
564  // mimic user authentication to mitigate observable timing discrepancies
565  // @link https://cwe.mitre.org/data/definitions/208.html
566  } elseif ($activeLogin) {
567  $subType = 'authUser' . ‪$this->loginType;
568  foreach ($this->‪getAuthServices($subType, ‪$loginData, $authenticatedUserFromSession, $request) as $serviceObj) {
569  if ($serviceObj instanceof MimicServiceInterface && $serviceObj->mimicAuthUser() === false) {
570  break;
571  }
572  }
573  }
574 
575  // If user is authenticated, then a valid user is found in $userRecordCandidate
576  if ($authenticated) {
577  // Insert session record if needed
578  if (!$isExistingSession
579  || $anonymousSession
580  || (int)($userRecordCandidate[$this->userid_column] ?? 0) !== $this->userSession->getUserId()
581  ) {
582  $sessionData = $this->userSession->getData();
583  // Create a new session with a fixated user
584  $this->userSession = $this->‪createUserSession($userRecordCandidate);
585 
586  // Preserve session data on login
587  if ($anonymousSession || $isExistingSession) {
588  $this->userSession->overrideData($sessionData);
589  }
590 
591  $this->user = array_merge($userRecordCandidate, $this->user ?? []);
592 
593  // The login session is started.
594  $this->loginSessionStarted = true;
595  $this->logger->debug('User session finally read', [
596  $this->userid_column => $this->user[$this->userid_column],
597  $this->username_column => $this->user[$this->username_column],
598  ]);
599  } else {
600  // if we come here the current session is for sure not anonymous as this is a pre-condition for $authenticated = true
601  $this->user = $authenticatedUserFromSession;
602  }
603 
604  if ($activeLogin && !$this->userSession->isNew()) {
605  $this->‪regenerateSessionId();
606  }
607 
608  // Since the user is not fully authenticated we need to unpack UC here to be
609  // able to retrieve a possible defined default (preferred) MFA provider.
610  $this->‪unpack_uc();
611 
612  if ($activeLogin) {
613  // User logged in - write that to the log!
614  if ($this->writeStdLog) {
615  $this->‪writelog(SystemLogType::LOGIN, SystemLogLoginAction::LOGIN, SystemLogErrorClassification::MESSAGE, 1, 'User %s logged in from ###IP###', [$userRecordCandidate[$this->username_column]], '', '', '');
616  }
617  $this->logger->info('User {username} logged in from {ip}', [
618  'username' => $userRecordCandidate[$this->username_column],
619  'ip' => GeneralUtility::getIndpEnv('REMOTE_ADDR'),
620  ]);
621  } else {
622  $this->logger->debug('User {username} authenticated from {ip}', [
623  'username' => $userRecordCandidate[$this->username_column],
624  'ip' => GeneralUtility::getIndpEnv('REMOTE_ADDR'),
625  ]);
626  }
627  // Check if multi-factor authentication is required
629  } else {
630  // Mark the current login attempt as failed
631  if (empty($possibleUsers) && $activeLogin) {
632  $this->logger->debug('Login failed', [
634  ]);
635  } elseif (!empty($possibleUsers)) {
636  $this->logger->debug('Login failed', [
637  $this->userid_column => $userRecordCandidate[$this->userid_column],
638  $this->username_column => $userRecordCandidate[$this->username_column],
639  ]);
640  }
641 
642  // If there were a login failure, check to see if a warning email should be sent
643  if ($activeLogin) {
644  GeneralUtility::makeInstance(EventDispatcherInterface::class)->dispatch(
646  );
647  $this->‪handleLoginFailure();
648  }
649  }
650  }
651 
657  protected function ‪fetchPossibleUsers(array ‪$loginData, bool $activeLogin, bool $isExistingSession, ?array $authenticatedUserFromSession, ServerRequestInterface $request): array
658  {
659  $possibleUsers = [];
660  $authConfiguration = $this->‪getAuthServiceConfiguration();
661  $alwaysFetchUsers = !empty($authConfiguration[$this->loginType . '_alwaysFetchUser']);
662  $fetchUsersIfNoSessionIsGiven = !empty($authConfiguration[$this->loginType . '_fetchUserIfNoSession']);
663  if (
664  $activeLogin
665  || $alwaysFetchUsers
666  || (!$isExistingSession && $fetchUsersIfNoSessionIsGiven)
667  ) {
668  // Use 'auth' service to find the user
669  // First found user will be used
670  $subType = 'getUser' . ‪$this->loginType;
672  foreach ($this->‪getAuthServices($subType, ‪$loginData, $authenticatedUserFromSession, $request) as $serviceObj) {
673  $row = $serviceObj->getUser();
674  if (is_array($row)) {
675  $possibleUsers[] = $row;
676  $this->logger->debug('User found', [
677  $this->userid_column => $row[$this->userid_column],
678  $this->username_column => $row[$this->username_column],
679  ]);
680  // User found, just stop to search for more if not configured to go on
681  if (empty($authConfiguration[$this->loginType . '_fetchAllUsers'])) {
682  break;
683  }
684  }
685  }
686 
687  if ($alwaysFetchUsers) {
688  $this->logger->debug($this->loginType . '_alwaysFetchUser option is enabled');
689  }
690  if (empty($possibleUsers)) {
691  $this->logger->debug('No user found by services');
692  } else {
693  $this->logger->debug('{count} user records found by services', ['count' => count($possibleUsers)]);
694  }
695  }
696  return $possibleUsers;
697  }
698 
708  protected function ‪evaluateMfaRequirements(): void
709  {
710  // MFA has been validated already, nothing to do
711  if ($this->‪getSessionData('mfa')) {
712  return;
713  }
714  // If the user session does not contain the 'mfa' key - indicating that MFA is already
715  // passed - get the first provider for authentication, which is either the default provider
716  // or the first active provider (based on the providers configured ordering).
717  $provider = GeneralUtility::makeInstance(MfaProviderRegistry::class)->getFirstAuthenticationAwareProvider($this);
718  // Throw an exception (hopefully caught in a middleware) when an active provider for the user exists
719  if ($provider !== null) {
720  throw new ‪MfaRequiredException($provider, 1613687097);
721  }
722  }
723 
729  public function ‪isMfaSetupRequired(): bool
730  {
731  return false;
732  }
733 
737  protected function ‪handleLoginFailure(): void
738  {
739  if ((‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postLoginFailureProcessing'] ?? []) !== []) {
740  trigger_error(
741  'The hook $TYPO3_CONF_VARS[\'SC_OPTIONS\'][\'t3lib/class.t3lib_userauth.php\'][\'postLoginFailureProcessing\']'
742  . ' will be removed in TYPO3 v13.0. Use the PSR-14 event LoginAttemptFailedEvent.',
743  E_USER_DEPRECATED
744  );
745  }
746  $_params = [];
747  foreach (‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postLoginFailureProcessing'] ?? [] as $hookIdentifier => $_funcRef) {
748  GeneralUtility::callUserFunction($_funcRef, $_params, $this);
749  }
750  }
751 
759  protected function ‪getAuthServices(string $subType, array ‪$loginData, ?array $authenticatedUserFromSession, ServerRequestInterface $request): \Traversable
760  {
761  $serviceChain = [];
762  // The info array provide additional information for auth services
763  $authInfo = $this->‪getAuthInfoArray($request);
764  if ($authenticatedUserFromSession !== null) {
765  $authInfo['user'] = $authenticatedUserFromSession;
766  }
767  while (is_object($serviceObj = GeneralUtility::makeInstanceService('auth', $subType, $serviceChain))) {
768  $serviceChain[] = $serviceObj->getServiceKey();
769  $serviceObj->initAuth($subType, ‪$loginData, $authInfo, $this);
770  yield $serviceObj;
771  }
772  if (!empty($serviceChain)) {
773  $this->logger->debug('{subtype} auth services called: {chain}', [
774  'subtype' => $subType,
775  'chain' => implode(',', $serviceChain),
776  ]);
777  }
778  }
779 
785  protected function ‪regenerateSessionId()
786  {
787  $this->userSession = $this->userSessionManager->regenerateSession($this->userSession->getIdentifier());
788  }
789 
790  /*************************
791  *
792  * User Sessions
793  *
794  *************************/
795 
802  public function ‪createUserSession(array $userRecordCandidate): UserSession
803  {
804  // Needed for testing framework
805  if (!isset($this->userSessionManager)) {
807  }
808  $userRecordCandidateId = (int)($userRecordCandidate[$this->userid_column] ?? 0);
809  $session = $this->userSessionManager->elevateToFixatedUserSession($this->userSession, $userRecordCandidateId);
810  // Updating lastLogin_column carrying information about last login.
811  $this->‪updateLoginTimestamp($userRecordCandidateId);
812  return $session;
813  }
814 
818  protected function ‪updateLoginTimestamp(int $userId)
819  {
820  if ($this->lastLogin_column) {
821  $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->user_table);
822  $connection->update(
823  $this->user_table,
824  [$this->lastLogin_column => ‪$GLOBALS['EXEC_TIME']],
825  [$this->userid_column => $userId]
826  );
827  $this->user[‪$this->lastLogin_column] = ‪$GLOBALS['EXEC_TIME'];
828  }
829  }
830 
840  protected function ‪fetchValidUserFromSessionOrDestroySession(bool $skipSessionUpdate = false): ?array
841  {
842  if ($this->userSession->isAnonymous()) {
843  return null;
844  }
845  // Fetch the user from the DB
846  $userRecord = $this->‪getRawUserByUid($this->userSession->getUserId() ?? 0);
847  if ($userRecord) {
848  // A user was found
849  $userRecord['is_online'] = $this->userSession->getLastUpdated();
850  if (!$this->userSessionManager->hasExpired($this->userSession)) {
851  if (!$skipSessionUpdate) {
852  $this->userSession = $this->userSessionManager->updateSessionTimestamp($this->userSession);
853  }
854  } else {
855  // Delete any user set...
856  $this->‪logoff();
857  $userRecord = false;
858  $this->userSession = $this->userSessionManager->createAnonymousSession();
859  }
860  }
861  return is_array($userRecord) ? $userRecord : null;
862  }
863 
869  public function ‪enforceNewSessionId()
870  {
871  $this->‪regenerateSessionId();
872  $this->‪setSessionCookie();
873  }
874 
880  public function ‪logoff()
881  {
882  $this->logger->debug('logoff: ses_id = {session}', ['session' => sha1($this->userSession->getIdentifier())]);
883 
884  $dispatcher = GeneralUtility::makeInstance(EventDispatcherInterface::class);
885 
886  $event = new BeforeUserLogoutEvent($this);
887  $event = $dispatcher->dispatch($event);
888 
889  if (!empty(‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'] ?? null)) {
890  trigger_error(
891  '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_userauth.php\'][\'logoff_pre_processing\'] will be removed in TYPO3 v13.0. Use the PSR-14 "BeforeUserLogoutEvent" instead.',
892  E_USER_DEPRECATED
893  );
894  }
895 
896  if ($event->shouldLogout()) {
897  $_params = [];
898  foreach (‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'] ?? [] as $_funcRef) {
899  if ($_funcRef) {
900  GeneralUtility::callUserFunction($_funcRef, $_params, $this);
901  }
902  }
903  $this->‪performLogoff();
904  }
905 
906  $dispatcher->dispatch(new ‪AfterUserLoggedOutEvent($this));
907 
908  if (!empty(‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'] ?? null)) {
909  trigger_error(
910  '$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_userauth.php\'][\'logoff_post_processing\'] will be removed in TYPO3 v13.0. Use the PSR-14 "BeforeUserLogoutEvent" instead.',
911  E_USER_DEPRECATED
912  );
913  }
914  foreach (‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_post_processing'] ?? [] as $_funcRef) {
915  if ($_funcRef) {
916  GeneralUtility::callUserFunction($_funcRef, $_params, $this);
917  }
918  }
919  }
920 
926  protected function ‪performLogoff()
927  {
928  if ($this->userSession) {
929  $this->userSessionManager->removeSession($this->userSession);
930  }
931  $this->userSession = $this->userSessionManager->createAnonymousSession();
932  $this->user = null;
933  if ($this->‪isCookieSet()) {
934  $this->‪removeCookie();
935  }
936  }
937 
943  public function ‪removeCookie($cookieName = null)
944  {
945  $cookieName = $cookieName ?? ‪$this->name;
946  $cookieDomain = $this->‪getCookieDomain();
947  // If no cookie domain is set, use the base path
948  $cookiePath = $cookieDomain ? '/' : GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
949  $this->setCookie = new Cookie(
950  $cookieName,
951  '',
952  -1,
953  $cookiePath,
954  $cookieDomain
955  );
956  }
957 
964  public function ‪isCookieSet()
965  {
966  return $this->setCookie instanceof Cookie || isset($_COOKIE[$this->name]);
967  }
968 
969  /*************************
970  *
971  * SQL Functions
972  *
973  *************************/
981  protected function ‪userConstraints(): QueryRestrictionContainerInterface
982  {
983  $restrictionContainer = GeneralUtility::makeInstance(DefaultRestrictionContainer::class);
984 
985  if (empty($this->enablecolumns['disabled'])) {
986  $restrictionContainer->removeByType(HiddenRestriction::class);
987  }
988 
989  if (empty($this->enablecolumns['deleted'])) {
990  $restrictionContainer->removeByType(DeletedRestriction::class);
991  }
992 
993  if (empty($this->enablecolumns['starttime'])) {
994  $restrictionContainer->removeByType(StartTimeRestriction::class);
995  }
996 
997  if (empty($this->enablecolumns['endtime'])) {
998  $restrictionContainer->removeByType(EndTimeRestriction::class);
999  }
1000 
1001  if (!empty($this->enablecolumns['rootLevel'])) {
1002  $restrictionContainer->add(GeneralUtility::makeInstance(RootLevelRestriction::class, [$this->user_table]));
1003  }
1004 
1005  if ($this->checkPid && $this->checkPid_value !== null) {
1006  $restrictionContainer->add(
1007  GeneralUtility::makeInstance(
1008  PageIdListRestriction::class,
1009  [$this->user_table],
1010  ‪GeneralUtility::intExplode(',', (string)$this->checkPid_value, true)
1011  )
1012  );
1013  }
1014 
1015  return $restrictionContainer;
1016  }
1017 
1018  /*************************
1019  *
1020  * Session and Configuration Handling
1021  *
1022  *************************/
1027  public function ‪writeUC()
1028  {
1029  if (is_array($this->user) && $this->user[$this->userid_column]) {
1030  $this->logger->debug('writeUC: {userid_column}={value}', [
1031  'userid_column' => $this->userid_column,
1032  'value' => $this->user[$this->userid_column],
1033  ]);
1034  GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable($this->user_table)->update(
1035  $this->user_table,
1036  ['uc' => serialize($this->uc)],
1037  [$this->userid_column => (int)$this->user[$this->userid_column]],
1038  ['uc' => ‪Connection::PARAM_LOB]
1039  );
1040  }
1041  }
1042 
1046  public function ‪unpack_uc()
1047  {
1048  if (isset($this->user['uc'])) {
1049  $theUC = unserialize($this->user['uc'], ['allowed_classes' => false]);
1050  if (is_array($theUC)) {
1051  $this->uc = $theUC;
1052  }
1053  }
1054  }
1055 
1065  public function ‪pushModuleData(string $module, mixed $data, bool $dontPersistImmediately = false): void
1066  {
1067  $sessionHash = ‪GeneralUtility::hmac(
1068  $this->userSession->getIdentifier(),
1069  'core-session-hash'
1070  );
1071  $this->uc['moduleData'][$module] = $data;
1072  $this->uc['moduleSessionID'][$module] = $sessionHash;
1073  if ($dontPersistImmediately === false) {
1074  $this->‪writeUC();
1075  }
1076  }
1077 
1085  public function ‪getModuleData(string $module, string $type = ''): mixed
1086  {
1087  $sessionHash = ‪GeneralUtility::hmac(
1088  $this->userSession->getIdentifier(),
1089  'core-session-hash'
1090  );
1091  $sessionData = $this->uc['moduleData'][$module] ?? null;
1092  $moduleSessionIdHash = $this->uc['moduleSessionID'][$module] ?? null;
1093  if ($type !== 'ses' || ($sessionData !== null && $moduleSessionIdHash === $sessionHash)) {
1094  return $sessionData;
1095  }
1096  return null;
1097  }
1098 
1106  public function ‪getSessionData($key)
1107  {
1108  return $this->userSession ? $this->userSession->get($key) : '';
1109  }
1110 
1118  public function ‪setSessionData($key, $data)
1119  {
1120  $this->userSession->set($key, $data);
1121  }
1122 
1130  public function ‪setAndSaveSessionData($key, $data)
1131  {
1132  $this->userSession->set($key, $data);
1133  $this->logger->debug('setAndSaveSessionData: ses_id = {session}', ['session' => sha1($this->userSession->getIdentifier())]);
1134  $this->userSession = $this->userSessionManager->updateSession($this->userSession);
1135  }
1136 
1137  /*************************
1138  *
1139  * Misc
1140  *
1141  *************************/
1148  public function ‪getLoginFormData(ServerRequestInterface $request)
1149  {
1150  ‪$loginData = [
1151  'status' => $request->getParsedBody()[‪$this->formfield_status] ?? $request->getQueryParams()[‪$this->formfield_status] ?? null,
1152  'uname' => $request->getParsedBody()[‪$this->formfield_uname] ?? null,
1153  'uident' => $request->getParsedBody()[‪$this->formfield_uident] ?? null,
1154  ];
1155  // Only process the login data if a login is requested
1156  if (‪$loginData['status'] === ‪LoginType::LOGIN) {
1157  ‪$loginData = $this->‪processLoginData($loginData, $request);
1158  }
1159  return ‪$loginData;
1160  }
1161 
1162  public function ‪isActiveLogin(ServerRequestInterface $request): bool
1163  {
1164  $status = $request->getParsedBody()[‪$this->formfield_status] ?? $request->getQueryParams()[‪$this->formfield_status] ?? '';
1165  return $status === ‪LoginType::LOGIN;
1166  }
1167 
1175  public function ‪processLoginData(array ‪$loginData, ServerRequestInterface $request): array
1176  {
1177  $this->logger->debug('Login data before processing', $this->‪removeSensitiveLoginDataForLoggingInfo($loginData));
1178  $subType = 'processLoginData' . ‪$this->loginType;
1179  $isLoginDataProcessed = false;
1180  $processedLoginData = ‪$loginData;
1182  foreach ($this->‪getAuthServices($subType, ‪$loginData, null, $request) as $serviceObject) {
1183  $serviceResult = $serviceObject->processLoginData($processedLoginData, 'normal');
1184  if (!empty($serviceResult)) {
1185  $isLoginDataProcessed = true;
1186  // If the service returns >=200 then no more processing is needed
1187  if ((int)$serviceResult >= 200) {
1188  break;
1189  }
1190  }
1191  }
1192  if ($isLoginDataProcessed) {
1193  ‪$loginData = $processedLoginData;
1194  $this->logger->debug('Processed login data', $this->‪removeSensitiveLoginDataForLoggingInfo($processedLoginData));
1195  }
1196  return ‪$loginData;
1197  }
1198 
1209  protected function ‪removeSensitiveLoginDataForLoggingInfo($data, bool $isUserRecord = false)
1210  {
1211  if ($isUserRecord && is_array($data)) {
1212  $fieldNames = ['uid', 'pid', 'tstamp', 'crdate', 'deleted', 'disabled', 'starttime', 'endtime', 'username', 'admin', 'usergroup', 'db_mountpoints', 'file_mountpoints', 'file_permissions', 'workspace_perms', 'lastlogin', 'workspace_id', 'category_perms'];
1213  $data = array_intersect_key($data, array_combine($fieldNames, $fieldNames));
1214  }
1215  if (isset($data['uident'])) {
1216  $data['uident'] = '********';
1217  }
1218  if (isset($data['uident_text'])) {
1219  $data['uident_text'] = '********';
1220  }
1221  if (isset($data['password'])) {
1222  $data['password'] = '********';
1223  }
1224  return $data;
1225  }
1226 
1233  public function ‪getAuthInfoArray(ServerRequestInterface $request)
1234  {
1235  $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->user_table);
1236  $expressionBuilder = $queryBuilder->expr();
1237  $authInfo = [];
1238  $authInfo['loginType'] = ‪$this->loginType;
1239  $authInfo['request'] = $request;
1240  $authInfo['refInfo'] = parse_url(GeneralUtility::getIndpEnv('HTTP_REFERER'));
1241  $authInfo['HTTP_HOST'] = GeneralUtility::getIndpEnv('HTTP_HOST');
1242  $authInfo['REMOTE_ADDR'] = GeneralUtility::getIndpEnv('REMOTE_ADDR');
1243  $authInfo['REMOTE_HOST'] = GeneralUtility::getIndpEnv('REMOTE_HOST');
1244  // Can be overridden in localconf by SVCONF:
1245  $authInfo['db_user']['table'] = ‪$this->user_table;
1246  $authInfo['db_user']['userid_column'] = ‪$this->userid_column;
1247  $authInfo['db_user']['username_column'] = ‪$this->username_column;
1248  $authInfo['db_user']['userident_column'] = ‪$this->userident_column;
1249  $authInfo['db_user']['enable_clause'] = $this->‪userConstraints()->buildExpression(
1250  [$this->user_table => $this->user_table],
1251  $expressionBuilder
1252  );
1253  return $authInfo;
1254  }
1255 
1269  public function ‪writelog($type, $action, $error, $details_nr, $details, $data, $tablename, $recuid, $recpid)
1270  {
1271  }
1272 
1284  public function ‪setBeUserByUid(‪$uid)
1285  {
1286  $this->user = $this->‪getRawUserByUid(‪$uid);
1287  }
1288 
1296  public function ‪setBeUserByName(‪$name)
1297  {
1298  $this->user = $this->‪getRawUserByName(‪$name) ?: null;
1299  }
1300 
1308  public function ‪getRawUserByUid(‪$uid)
1309  {
1310  $query = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->user_table);
1311  $query->setRestrictions($this->‪userConstraints());
1312  $query->select('*')
1313  ->from($this->user_table)
1314  ->where($query->expr()->eq($this->userid_column, $query->createNamedParameter(‪$uid, ‪Connection::PARAM_INT)));
1315 
1316  return $query->executeQuery()->fetchAssociative();
1317  }
1318 
1327  public function ‪getRawUserByName(‪$name)
1328  {
1329  $query = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($this->user_table);
1330  $query->setRestrictions($this->‪userConstraints());
1331  $query->select('*')
1332  ->from($this->user_table)
1333  ->where($query->expr()->eq($this->username_column, $query->createNamedParameter(‪$name)));
1334 
1335  return $query->executeQuery()->fetchAssociative();
1336  }
1337 
1338  public function ‪getSession(): UserSession
1339  {
1340  return ‪$this->userSession;
1341  }
1342 }
‪TYPO3\CMS\Core\Context\SecurityAspect\provideIn
‪static provideIn(Context $context)
Definition: SecurityAspect.php:41
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\initializeUserSessionManager
‪initializeUserSessionManager(?UserSessionManager $userSessionManager=null)
Definition: AbstractUserAuthentication.php:221
‪TYPO3\CMS\Core\Database\Query\Restriction\PageIdListRestriction
Definition: PageIdListRestriction.php:27
‪TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction
Definition: HiddenRestriction.php:27
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$checkPid
‪bool $checkPid
Definition: AbstractUserAuthentication.php:155
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\fetchPossibleUsers
‪fetchPossibleUsers(array $loginData, bool $activeLogin, bool $isExistingSession, ?array $authenticatedUserFromSession, ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:636
‪TYPO3\CMS\Core\Authentication\Event\AfterUserLoggedOutEvent
Definition: AfterUserLoggedOutEvent.php:26
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\logoff
‪logoff()
Definition: AbstractUserAuthentication.php:859
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\removeSensitiveLoginDataForLoggingInfo
‪mixed removeSensitiveLoginDataForLoggingInfo($data, bool $isUserRecord=false)
Definition: AbstractUserAuthentication.php:1188
‪TYPO3\CMS\Core\Database\Connection\PARAM_INT
‪const PARAM_INT
Definition: Connection.php:47
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$loginType
‪string $loginType
Definition: AbstractUserAuthentication.php:185
‪TYPO3\CMS\Core\Authentication\MimicServiceInterface
Definition: MimicServiceInterface.php:21
‪TYPO3\CMS\Core\Authentication\Event\LoginAttemptFailedEvent
Definition: LoginAttemptFailedEvent.php:28
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\createUserSession
‪UserSession createUserSession(array $userRecordCandidate)
Definition: AbstractUserAuthentication.php:781
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\updateLoginTimestamp
‪updateLoginTimestamp(int $userId)
Definition: AbstractUserAuthentication.php:797
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getCookieDomain
‪string getCookieDomain()
Definition: AbstractUserAuthentication.php:330
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\appendCookieToResponse
‪appendCookieToResponse(ResponseInterface $response)
Definition: AbstractUserAuthentication.php:275
‪TYPO3\CMS\Core\Database\Query\Restriction\EndTimeRestriction
Definition: EndTimeRestriction.php:27
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\fetchValidUserFromSessionOrDestroySession
‪fetchValidUserFromSessionOrDestroySession(bool $skipSessionUpdate=false)
Definition: AbstractUserAuthentication.php:819
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getRawUserByUid
‪array getRawUserByUid($uid)
Definition: AbstractUserAuthentication.php:1287
‪TYPO3\CMS\Core\Exception
Definition: Exception.php:22
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$checkPid_value
‪int string null $checkPid_value
Definition: AbstractUserAuthentication.php:160
‪TYPO3\CMS\Core\Database\Query\Restriction\StartTimeRestriction
Definition: StartTimeRestriction.php:27
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getModuleData
‪mixed getModuleData(string $module, string $type='')
Definition: AbstractUserAuthentication.php:1064
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$userGroups
‪array $userGroups
Definition: AbstractUserAuthentication.php:175
‪TYPO3\CMS\Core\Session\UserSession
Definition: UserSession.php:43
‪TYPO3\CMS\Core\Authentication
Definition: AbstractAuthenticationService.php:16
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$username_column
‪string $username_column
Definition: AbstractUserAuthentication.php:83
‪TYPO3\CMS\Core\Exception
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\pushModuleData
‪pushModuleData(string $module, mixed $data, bool $dontPersistImmediately=false)
Definition: AbstractUserAuthentication.php:1044
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\__construct
‪__construct()
Definition: AbstractUserAuthentication.php:206
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\checkAuthentication
‪checkAuthentication(ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:393
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\writelog
‪writelog($type, $action, $error, $details_nr, $details, $data, $tablename, $recuid, $recpid)
Definition: AbstractUserAuthentication.php:1248
‪TYPO3\CMS\Core\Database\Query\Restriction\QueryRestrictionContainerInterface
Definition: QueryRestrictionContainerInterface.php:25
‪TYPO3\CMS\Core\SysLog\Action\Login
Definition: Login.php:24
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:55
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getAuthServiceConfiguration
‪getAuthServiceConfiguration()
Definition: AbstractUserAuthentication.php:379
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$formfield_uident
‪string $formfield_uident
Definition: AbstractUserAuthentication.php:125
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$enablecolumns
‪array $enablecolumns
Definition: AbstractUserAuthentication.php:108
‪TYPO3\CMS\Core\Authentication\Event\BeforeRequestTokenProcessedEvent
Definition: BeforeRequestTokenProcessedEvent.php:28
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\handleLoginFailure
‪handleLoginFailure()
Definition: AbstractUserAuthentication.php:716
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$userSessionManager
‪UserSessionManager $userSessionManager
Definition: AbstractUserAuthentication.php:194
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$formfield_status
‪string $formfield_status
Definition: AbstractUserAuthentication.php:130
‪TYPO3\CMS\Core\Security\RequestToken
Definition: RequestToken.php:26
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getLoginFormData
‪array getLoginFormData(ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:1127
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\performLogoff
‪performLogoff()
Definition: AbstractUserAuthentication.php:905
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\isMfaSetupRequired
‪isMfaSetupRequired()
Definition: AbstractUserAuthentication.php:708
‪TYPO3\CMS\Core\Context\SecurityAspect
Definition: SecurityAspect.php:30
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\setSessionData
‪setSessionData($key, $data)
Definition: AbstractUserAuthentication.php:1097
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$usergroup_table
‪string $usergroup_table
Definition: AbstractUserAuthentication.php:78
‪TYPO3\CMS\Core\Database\Query\Restriction\RootLevelRestriction
Definition: RootLevelRestriction.php:27
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\unpack_uc
‪unpack_uc()
Definition: AbstractUserAuthentication.php:1025
‪TYPO3\CMS\Webhooks\Message\$loginData
‪identifier readonly UriInterface readonly array $loginData
Definition: LoginErrorOccurredMessage.php:37
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$userSession
‪UserSession $userSession
Definition: AbstractUserAuthentication.php:192
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\isSetSessionCookie
‪bool isSetSessionCookie()
Definition: AbstractUserAuthentication.php:360
‪TYPO3\CMS\Core\Authentication\Mfa\MfaRequiredException
Definition: MfaRequiredException.php:29
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\start
‪start(ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:236
‪TYPO3\CMS\Core\Utility\GeneralUtility\hmac
‪static string hmac($input, $additionalSecret='')
Definition: GeneralUtility.php:584
‪TYPO3\CMS\Core\SysLog\Error
Definition: Error.php:24
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$usergroup_column
‪string $usergroup_column
Definition: AbstractUserAuthentication.php:98
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getSessionData
‪mixed getSessionData($key)
Definition: AbstractUserAuthentication.php:1085
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getSession
‪getSession()
Definition: AbstractUserAuthentication.php:1317
‪TYPO3\CMS\Core\Session\UserSessionManager\create
‪static static create(string $loginType, int $sessionLifetime=null, SessionManager $sessionManager=null, IpLocker $ipLocker=null)
Definition: UserSessionManager.php:358
‪TYPO3\CMS\Core\Authentication\LoginType\LOGOUT
‪const LOGOUT
Definition: LoginType.php:35
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\setAndSaveSessionData
‪setAndSaveSessionData($key, $data)
Definition: AbstractUserAuthentication.php:1109
‪TYPO3\CMS\Core\Core\Environment\isCli
‪static isCli()
Definition: Environment.php:145
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$name
‪string $name
Definition: AbstractUserAuthentication.php:68
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$writeAttemptLog
‪bool $writeAttemptLog
Definition: AbstractUserAuthentication.php:150
‪TYPO3\CMS\Core\Authentication\LoginType\LOGIN
‪const LOGIN
Definition: LoginType.php:30
‪TYPO3\CMS\Core\Security\RequestToken\getSigningSecretIdentifier
‪getSigningSecretIdentifier()
Definition: RequestToken.php:115
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\enforceNewSessionId
‪enforceNewSessionId()
Definition: AbstractUserAuthentication.php:848
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$user
‪array null $user
Definition: AbstractUserAuthentication.php:170
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\evaluateMfaRequirements
‪evaluateMfaRequirements()
Definition: AbstractUserAuthentication.php:687
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getAuthServices
‪Traversable getAuthServices(string $subType, array $loginData, ?array $authenticatedUserFromSession, ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:738
‪TYPO3\CMS\Core\Database\Connection
Definition: Connection.php:36
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$loginSessionStarted
‪bool $loginSessionStarted
Definition: AbstractUserAuthentication.php:165
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$lastLogin_column
‪string $lastLogin_column
Definition: AbstractUserAuthentication.php:103
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$userident_column
‪string $userident_column
Definition: AbstractUserAuthentication.php:88
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\isRefreshTimeBasedCookie
‪bool isRefreshTimeBasedCookie()
Definition: AbstractUserAuthentication.php:371
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\regenerateSessionId
‪regenerateSessionId()
Definition: AbstractUserAuthentication.php:764
‪TYPO3\CMS\Webhooks\Message\$uid
‪identifier readonly int $uid
Definition: PageModificationMessage.php:35
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\userConstraints
‪userConstraints()
Definition: AbstractUserAuthentication.php:960
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction
Definition: DeletedRestriction.php:28
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:41
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\isActiveLogin
‪isActiveLogin(ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:1141
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$userid_column
‪string $userid_column
Definition: AbstractUserAuthentication.php:93
‪TYPO3\CMS\Core\Utility\GeneralUtility\intExplode
‪static int[] intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:842
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\removeCookie
‪removeCookie($cookieName=null)
Definition: AbstractUserAuthentication.php:922
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\isCookieSet
‪bool isCookieSet()
Definition: AbstractUserAuthentication.php:943
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$dontSetCookie
‪bool $dontSetCookie
Definition: AbstractUserAuthentication.php:180
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$setCookie
‪Cookie $setCookie
Definition: AbstractUserAuthentication.php:199
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getAuthInfoArray
‪array getAuthInfoArray(ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:1212
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\setSessionCookie
‪setSessionCookie()
Definition: AbstractUserAuthentication.php:286
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\processLoginData
‪array processLoginData(array $loginData, ServerRequestInterface $request)
Definition: AbstractUserAuthentication.php:1154
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\setBeUserByUid
‪setBeUserByUid($uid)
Definition: AbstractUserAuthentication.php:1263
‪TYPO3\CMS\Core\Database\ConnectionPool
Definition: ConnectionPool.php:51
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\setBeUserByName
‪setBeUserByName($name)
Definition: AbstractUserAuthentication.php:1275
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:51
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$uc
‪array $uc
Definition: AbstractUserAuthentication.php:190
‪TYPO3\CMS\Core\Authentication\MimicServiceInterface\mimicAuthUser
‪bool mimicAuthUser()
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$writeStdLog
‪bool $writeStdLog
Definition: AbstractUserAuthentication.php:145
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$formfield_uname
‪string $formfield_uname
Definition: AbstractUserAuthentication.php:120
‪TYPO3\CMS\Core\Authentication\Event\BeforeUserLogoutEvent
Definition: BeforeUserLogoutEvent.php:28
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$user_table
‪string $user_table
Definition: AbstractUserAuthentication.php:73
‪TYPO3\CMS\Core\Session\UserSessionManager
Definition: UserSessionManager.php:44
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\$lifetime
‪int $lifetime
Definition: AbstractUserAuthentication.php:140
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\getRawUserByName
‪array getRawUserByName($name)
Definition: AbstractUserAuthentication.php:1306
‪TYPO3\CMS\Core\SysLog\Type
Definition: Type.php:28
‪TYPO3\CMS\Core\Database\Query\Restriction\DefaultRestrictionContainer
Definition: DefaultRestrictionContainer.php:24
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication
Definition: AbstractUserAuthentication.php:61
‪TYPO3\CMS\Core\Authentication\Mfa\MfaProviderRegistry
Definition: MfaProviderRegistry.php:28
‪TYPO3\CMS\Core\Database\Connection\PARAM_LOB
‪const PARAM_LOB
Definition: Connection.php:57
‪TYPO3\CMS\Core\Authentication\AbstractUserAuthentication\writeUC
‪writeUC()
Definition: AbstractUserAuthentication.php:1006