17 use Symfony\Component\HttpFoundation\Cookie;
37 if (session_id() ===
'') {
39 'cookie_httponly' =>
true,
40 'cookie_secure' => GeneralUtility::getIndpEnv(
'TYPO3_SSL'),
43 $options[
'cookie_samesite'] = Cookie::SAMESITE_STRICT;
45 session_start($options);
61 list($keyId, $keyPart1) = $_SESSION[
'tx_rsaauth_key'];
66 $keyValue = GeneralUtility::makeInstance(ConnectionPool::class)
67 ->getConnectionForTable(
'tx_rsaauth_keys')
68 ->select([
'key_value'],
'tx_rsaauth_keys', [
'uid' => $keyId])
71 if ($keyValue !==
false) {
72 $result = $keyPart1 . $keyValue;
85 public function put($key)
87 $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(
'tx_rsaauth_keys');
90 list($keyId) = $_SESSION[
'tx_rsaauth_key'];
96 unset($_SESSION[
'tx_rsaauth_key']);
97 if (empty($_SESSION)) {
98 $sessionName = session_name();
99 $sessionCookie = session_get_cookie_params();
106 $sessionCookie[
'path'],
107 $sessionCookie[
'domain'],
108 $sessionCookie[
'secure']
116 $keyLength = strlen($key);
117 $splitPoint = rand((
int)($keyLength / 10), (
int)($keyLength / 2));
119 $keyPart1 = substr($key, 0, $splitPoint);
120 $keyPart2 = substr($key, $splitPoint);
131 'key_value' => $keyPart2
134 $keyId = $connection->lastInsertId(
'tx_rsaauth_keys');
136 $_SESSION[
'tx_rsaauth_key'] = [$keyId, $keyPart1];
149 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'tx_rsaauth_keys');
150 $count = $queryBuilder->delete(
'tx_rsaauth_keys')
152 $queryBuilder->expr()->lt(
154 $queryBuilder->createNamedParameter(
$GLOBALS[
'EXEC_TIME'] - 30 * 60, \PDO::PARAM_INT)