TYPO3 CMS  TYPO3_8-7
AbstractAuthenticationService.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Sv;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 
24 {
30  public $pObj;
31 
37  public $mode;
38 
44  public $login = [];
45 
51  public $authInfo = [];
52 
58  public $db_user = [];
59 
65  public $db_groups = [];
66 
72  public $writeAttemptLog = false;
73 
79  public $writeDevLog = false;
80 
89  public function initAuth($mode, $loginData, $authInfo, $pObj)
90  {
91  $this->pObj = $pObj;
92  // Sub type
93  $this->mode = $mode;
94  $this->login = $loginData;
95  $this->authInfo = $authInfo;
96  $this->db_user = $this->getServiceOption('db_user', $authInfo['db_user'], false);
97  $this->db_groups = $this->getServiceOption('db_groups', $authInfo['db_groups'], false);
98  $this->writeAttemptLog = $this->pObj->writeAttemptLog;
99  $this->writeDevLog = $this->pObj->writeDevLog;
100  }
101 
110  public function compareUident(array $user, array $loginData, $passwordCompareStrategy = '')
111  {
112  return $this->pObj->compareUident($user, $loginData, $passwordCompareStrategy);
113  }
114 
128  public function writelog($type, $action, $error, $details_nr, $details, $data, $tablename = '', $recuid = '', $recpid = '')
129  {
130  if ($this->writeAttemptLog) {
131  $this->pObj->writelog($type, $action, $error, $details_nr, $details, $data, $tablename, $recuid, $recpid);
132  }
133  }
134 
143  public function fetchUserRecord($username, $extraWhere = '', $dbUserSetup = '')
144  {
145  $dbUser = is_array($dbUserSetup) ? $dbUserSetup : $this->db_user;
146  $user = $this->pObj->fetchUserRecord($dbUser, $username, $extraWhere);
147  return $user;
148  }
149 }
writelog($type, $action, $error, $details_nr, $details, $data, $tablename='', $recuid='', $recpid='')
getServiceOption($optionName, $defaultValue='', $includeDefaultConfig=true)
fetchUserRecord($username, $extraWhere='', $dbUserSetup='')
compareUident(array $user, array $loginData, $passwordCompareStrategy='')