• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/http.php
  • Класс: CHTTP
  • Вызов: CHTTP::SetAuthHeader
static function SetAuthHeader($bDigestEnabled=true)
{
	self::SetStatus('401 Unauthorized');

	if(defined('BX_HTTP_AUTH_REALM'))
		$realm = BX_HTTP_AUTH_REALM;
	else
		$realm = "Bitrix Site Manager";

	header('WWW-Authenticate: Basic realm="'.$realm.'"');

	if($bDigestEnabled !== false && COption::GetOptionString("main", "use_digest_auth", "N") == "Y")
	{
		// On first try we found that we don't know user digest hash. Let ask only Basic auth first.
		if(BitrixMainApplication::getInstance()->getKernelSession()->get("BX_HTTP_DIGEST_ABSENT") !== true)
			header('WWW-Authenticate: Digest realm="'.$realm.'", nonce="'.uniqid().'"');
	}
}