• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/liveid.php
  • Класс: WindowsLiveLogin
  • Вызов: WindowsLiveLogin::decodeAndValidateToken
function decodeAndValidateToken($token, $cryptkey=null, $signkey=null,
$internal_allow_recursion=true)
{
	if (!$cryptkey) {
		$cryptkey = $this->_cryptkey;
	}
	if (!$signkey) {
		$signkey = $this->_signkey;
	}

	$haveoldsecret = false;
	$oldsecretexpiry = $this->getOldSecretExpiry();
	$oldcryptkey = $this->_oldcryptkey;
	$oldsignkey = $this->_oldsignkey;

	if ($oldsecretexpiry and (time() < $oldsecretexpiry)) {
		if ($oldcryptkey and $oldsignkey) {
			$haveoldsecret = true;
		}
	}
	$haveoldsecret = ($haveoldsecret and $internal_allow_recursion);

	$stoken = $this->decodeToken($token, $cryptkey);

	if ($stoken) {
		$stoken = $this->validateToken($stoken, $signkey);
	}

	if (!$stoken and $haveoldsecret) {
		$this->debug("Warning: Failed to validate token with current secret, attempting old secret.");
		$stoken =
		$this->decodeAndValidateToken($token, $oldcryptkey, $oldsignkey, false);
	}

	return $stoken;
}