Feature #59532
closedSession renewal: Add signal/hook when renewing session
0%
Description
In TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::fetchUserSession
, there is a part dedicated to update session update time (used for expiration date).
It could be great to have an entry point to add some additional code during the session renewal.
Updated by Clément MICHELET over 10 years ago
Add skeleton for this hook. I will try to push it on gerrit next week. I'm a bit in a hurry right now.
/** * Read the user session from db. * * @param boolean $skipSessionUpdate * @return array User session data * @todo Define visibility */ public function fetchUserSession($skipSessionUpdate = FALSE) { $user = FALSE; if ($this->writeDevLog) { GeneralUtility::devLog('Fetch session ses_id = ' . $this->id, 'TYPO3\\CMS\\Core\\Authentication\\AbstractUserAuthentication'); } // Fetch the user session from the DB $statement = $this->fetchUserSessionFromDB(); if ($statement) { $statement->execute(); $user = $statement->fetch(); $statement->free(); } if ($user) { // A user was found if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->auth_timeout_field)) { // Get timeout from object $timeout = (int)$this->auth_timeout_field; } else { // Get timeout-time from usertable $timeout = (int)$user[$this->auth_timeout_field]; } // If timeout > 0 (TRUE) and current time has not exceeded the latest sessions-time plus the timeout in seconds then accept user // Option later on: We could check that last update was at least x seconds ago in order not to update twice in a row if one script redirects to another... if ($timeout > 0 && $GLOBALS['EXEC_TIME'] < $user['ses_tstamp'] + $timeout) { if (!$skipSessionUpdate) { $this->db->exec_UPDATEquery($this->session_table, 'ses_id=' . $this->db->fullQuoteStr($this->id, $this->session_table) . ' AND ses_name=' . $this->db->fullQuoteStr($this->name, $this->session_table), array('ses_tstamp' => $GLOBALS['EXEC_TIME'])); // Make sure that the timestamp is also updated in the array $user['ses_tstamp'] = $GLOBALS['EXEC_TIME']; if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['fetchUserSession_postRenewSession'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['fetchUserSession_postRenewSession'] as $_funcRef) { if ($_funcRef) { GeneralUtility::callUserFunction($_funcRef, $user, $this); } } } } } else { // Delete any user set... $this->logoff(); } } return $user; }
Updated by Mathias Schreiber almost 10 years ago
- Target version changed from 7.0 to 7.1 (Cleanup)
Updated by Benni Mack over 9 years ago
- Target version changed from 7.1 (Cleanup) to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Benni Mack about 9 years ago
- Target version changed from 7.5 to 8 LTS
Updated by Alexander Opitz about 8 years ago
- Status changed from New to Needs Feedback
This issue is 2 years old. :-)
You wrote you want contribute code to gerrit, what is the state of this code?
Updated by Alexander Opitz almost 8 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.