17 require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(
'openid') .
'lib/php-openid/Auth/OpenID/Interface.php';
54 $this->databaseConnection->sql_query(
'START TRANSACTION');
60 $this->databaseConnection->sql_query(
'COMMIT');
69 $where = sprintf(
'expires<=%d', time());
70 $this->databaseConnection->exec_DELETEquery(self::ASSOCIATION_TABLE_NAME, $where);
71 return $this->databaseConnection->sql_affected_rows();
83 $where = sprintf(
'server_url=%s AND expires>%d', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), time());
84 if ($handle != NULL) {
85 $where .= sprintf(
' AND assoc_handle=%s', $this->databaseConnection->fullQuoteStr($handle, self::ASSOCIATION_TABLE_NAME));
88 $sort =
'tstamp DESC';
90 $row = $this->databaseConnection->exec_SELECTgetSingleRow(
'uid, content', self::ASSOCIATION_TABLE_NAME, $where,
'', $sort);
93 $result = @unserialize(base64_decode($row[
'content']));
111 $where = sprintf(
'server_url=%s AND assoc_handle=%s', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), $this->databaseConnection->fullQuoteStr($handle, self::ASSOCIATION_TABLE_NAME));
112 $this->databaseConnection->exec_DELETEquery(self::ASSOCIATION_TABLE_NAME, $where);
113 $deletedCount = $this->databaseConnection->sql_affected_rows();
114 return $deletedCount > 0;
123 $where = sprintf(
'crdate<%d', time() - self::NONCE_STORAGE_TIME);
124 $this->databaseConnection->exec_DELETEquery(self::NONCE_TABLE_NAME, $where);
135 public function useNonce($serverUrl, $timestamp, $salt) {
137 if (abs($timestamp - time()) <
$GLOBALS[
'Auth_OpenID_SKEW']) {
141 'server_url' => $serverUrl,
142 'tstamp' => $timestamp
144 $this->databaseConnection->exec_INSERTquery(self::NONCE_TABLE_NAME, $values);
145 $affectedRows = $this->databaseConnection->sql_affected_rows();
157 $this->databaseConnection->exec_TRUNCATEquery(self::ASSOCIATION_TABLE_NAME);
158 $this->databaseConnection->exec_TRUNCATEquery(self::NONCE_TABLE_NAME);
169 $where = sprintf(
'server_url=%s AND assoc_handle=%s AND expires>%d', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME), time());
170 $row = $this->databaseConnection->exec_SELECTgetSingleRow(
'COUNT(*) as assocCount', self::ASSOCIATION_TABLE_NAME, $where);
171 return $row[
'assocCount'] > 0;
182 $where = sprintf(
'server_url=%s AND assoc_handle=%s AND expires>%d', $this->databaseConnection->fullQuoteStr($serverUrl, self::ASSOCIATION_TABLE_NAME), $this->databaseConnection->fullQuoteStr($association->handle, self::ASSOCIATION_TABLE_NAME), time());
183 $serializedAssociation = serialize($association);
185 'content' => base64_encode($serializedAssociation),
188 $this->databaseConnection->exec_UPDATEquery(self::ASSOCIATION_TABLE_NAME, $where, $values);
199 $serializedAssociation = serialize($association);
201 'assoc_handle' => $association->handle,
202 'content' => base64_encode($serializedAssociation),
203 'crdate' => $association->issued,
205 'expires' => $association->issued + $association->lifetime - self::ASSOCIATION_EXPIRATION_SAFETY_INTERVAL,
206 'server_url' => $serverUrl
210 $this->databaseConnection->exec_INSERTquery(self::ASSOCIATION_TABLE_NAME, $values);
220 $where = sprintf(
'uid=%d', $recordId);
224 $this->databaseConnection->exec_UPDATEquery(self::ASSOCIATION_TABLE_NAME, $where, $values);
__construct($databaseConnection=NULL)
useNonce($serverUrl, $timestamp, $salt)
storeNewAssociation($serverUrl, $association)
storeAssociation($serverUrl, $association)
doesAssociationExist($serverUrl, $association)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
removeAssociation($serverUrl, $handle)
const ASSOCIATION_EXPIRATION_SAFETY_INTERVAL
getAssociation($serverUrl, $handle=NULL)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
updateExistingAssociation($serverUrl, \Auth_OpenID_Association $association)
const ASSOCIATION_TABLE_NAME
updateAssociationTimeStamp($recordId)