• Модуль: socialservices
  • Путь к файлу: ~/bitrix/modules/socialservices/classes/general/googleproxy.php
  • Класс: CSocServGoogleProxyOAuth
  • Вызов: CSocServGoogleProxyOAuth::checkUserToken
private function checkUserToken(string $userToken = null): bool
{
	if (!$userToken)
	{
		return false;
	}

	$configuration = Configuration::getInstance();
	$cipherKey = $configuration->get('crypto')['crypto_key'] ?? null;
	if (!$cipherKey)
	{
		throw new SystemException('There is no crypto[crypto_key] in .settings.php. Generate it.');
	}

	$cipher = new Cipher();
	$data = explode('_', $cipher->decrypt(base64_decode($userToken), $cipherKey));
	if (
		empty($data[1])
		|| (($data[0] + 3600) < time())
		|| $data[2] !== self::PROXY_CONST
	)
	{
		return false;
	}

	$user = BitrixMainUserTable::query()
		->where('ID', (int)$data[1])
		->setSelect(['*'])
		->exec()
		->fetchObject()
	;

	if (!$user)
	{
		return false;
	}

	$this->user = $user;
	$this->userId = $data[1];

	return true;
}