TYPO3 CMS  TYPO3_6-2
AbstractAuthenticationService.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Sv;
3 
23 
30  public $pObj;
31 
32  // Subtype of the service which is used to call the service.
36  public $mode;
37 
38  // Submitted login form data
42  public $login = array();
43 
44  // Various data
48  public $authInfo = array();
49 
50  // User db table definition
54  public $db_user = array();
55 
56  // Usergroups db table definition
60  public $db_groups = array();
61 
62  // If the writelog() functions is called if a login-attempt has be tried without success
66  public $writeAttemptLog = FALSE;
67 
68  // If the \TYPO3\CMS\Core\Utility\GeneralUtility::devLog() function should be used
72  public $writeDevLog = FALSE;
73 
84  public function initAuth($mode, $loginData, $authInfo, $pObj) {
85  $this->pObj = $pObj;
86  // Sub type
87  $this->mode = $mode;
88  $this->login = $loginData;
89  $this->authInfo = $authInfo;
90  $this->db_user = $this->getServiceOption('db_user', $authInfo['db_user'], FALSE);
91  $this->db_groups = $this->getServiceOption('db_groups', $authInfo['db_groups'], FALSE);
92  $this->writeAttemptLog = $this->pObj->writeAttemptLog;
93  $this->writeDevLog = $this->pObj->writeDevLog;
94  }
95 
105  public function compareUident(array $user, array $loginData, $passwordCompareStrategy = '') {
106  if ($this->authInfo['loginType'] === 'BE') {
107  // Challenge is only stored in session during BE login with the superchallenged login type.
108  // In the frontend context the challenge is never stored in the session.
109  if ($passwordCompareStrategy !== 'superchallenged') {
110  $this->pObj->challengeStoredInCookie = FALSE;
111  }
112  // The TYPO3 standard login service relies on $passwordCompareStrategy being set
113  // to 'superchallenged' because of the password in the database is stored as md5 hash
114  $passwordCompareStrategy = 'superchallenged';
115  }
116  return $this->pObj->compareUident($user, $loginData, $passwordCompareStrategy);
117  }
118 
134  public function writelog($type, $action, $error, $details_nr, $details, $data, $tablename = '', $recuid = '', $recpid = '') {
135  if ($this->writeAttemptLog) {
136  $this->pObj->writelog($type, $action, $error, $details_nr, $details, $data, $tablename, $recuid, $recpid);
137  }
138  }
139 
140  /*************************
141  *
142  * create/update user - EXPERIMENTAL
143  *
144  *************************/
154  public function fetchUserRecord($username, $extraWhere = '', $dbUserSetup = '') {
155  $dbUser = is_array($dbUserSetup) ? $dbUserSetup : $this->db_user;
156  $user = $this->pObj->fetchUserRecord($dbUser, $username, $extraWhere);
157  return $user;
158  }
159 
160 }
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='')