当前位置: 首页>>代码示例>>PHP>>正文


PHP CHTTP::ParseAuthRequest方法代码示例

本文整理汇总了PHP中CHTTP::ParseAuthRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP CHTTP::ParseAuthRequest方法的具体用法?PHP CHTTP::ParseAuthRequest怎么用?PHP CHTTP::ParseAuthRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CHTTP的用法示例。


在下文中一共展示了CHTTP::ParseAuthRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: LoginByHttpAuth

 function LoginByHttpAuth()
 {
     global $USER;
     $arAuth = CHTTP::ParseAuthRequest();
     foreach (GetModuleEvents("main", "onBeforeUserLoginByHttpAuth", true) as $arEvent) {
         $res = ExecuteModuleEventEx($arEvent, array(&$arAuth));
         if ($res !== null) {
             return $res;
         }
     }
     if (isset($arAuth["basic"]) && $arAuth["basic"]["username"] != '' && $arAuth["basic"]["password"] != '') {
         // Authorize user, if it is http basic authorization, with no remembering
         if (!$USER->IsAuthorized() || $USER->GetLogin() != $arAuth["basic"]["username"]) {
             return $USER->Login($arAuth["basic"]["username"], $arAuth["basic"]["password"], "N");
         }
     } elseif (isset($arAuth["digest"]) && $arAuth["digest"]["username"] != '' && COption::GetOptionString('main', 'use_digest_auth', 'N') == 'Y') {
         // Authorize user by http digest authorization
         if (!$USER->IsAuthorized() || $USER->GetLogin() != $arAuth["digest"]["username"]) {
             return $USER->LoginByDigest($arAuth["digest"]);
         }
     }
     return null;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:23,代码来源:user.php

示例2: header

 * @var $USER CUser
 */
global $APPLICATION, $USER;
use Bitrix\Main;
use Bitrix\Main\Authentication\ApplicationPasswordTable;
if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") {
    header('Access-Control-Allow-Methods: POST, OPTIONS');
    header('Access-Control-Max-Age: 60');
    header('Access-Control-Allow-Headers: X-Requested-With, Content-Type, Accept');
    die('');
}
if (!IsModuleInstalled('bitrix24')) {
    header('Access-Control-Allow-Origin: *');
}
$data = array("status" => "failed", "bitrix_sessid" => bitrix_sessid());
$userData = CHTTP::ParseAuthRequest();
$APPLICATION->RestartBuffer();
$login = $userData["basic"]["username"];
$isAlreadyAuthorized = $USER->IsAuthorized();
if (!$isAlreadyAuthorized) {
    if ($isAlreadyAuthorized) {
        $USER->Logout();
    }
    if (IsModuleInstalled('bitrix24')) {
        header('Access-Control-Allow-Origin: *');
    }
    if ($login) {
        if (CModule::IncludeModule('bitrix24') && ($captchaInfo = CBitrix24::getStoredCaptcha())) {
            $data["captchaCode"] = $captchaInfo["captchaCode"];
            $data["captchaURL"] = $captchaInfo["captchaURL"];
        } elseif ($APPLICATION->NeedCAPTHAForLogin($login)) {
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:checkout.php

示例3: OnAfterUserAuthorize

	public static function OnAfterUserAuthorize($arParams)
	{
		$arAuth = CHTTP::ParseAuthRequest();
		if(isset($arAuth["basic"]) && $arAuth["basic"]["username"] <> '' && $arAuth["basic"]["password"] <> ''
			&& strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'bitrix') === false)
		{
			return false;
		}

		if (isset($arParams['update']) && $arParams['update'] === false)
			return false;

		if ($arParams['user_fields']['ID'] <= 0)
			return false;

		$arParams['user_fields']['ID'] = intval($arParams['user_fields']['ID']);

		if (isset($_SESSION['USER_LAST_AUTH_'.$arParams['user_fields']['ID']])
			&& intval($_SESSION['USER_LAST_AUTH_'.$arParams['user_fields']['ID']])+100 > time())
			return false;

		$_SESSION['USER_LAST_AUTH_'.$arParams['user_fields']['ID']] = time();
		unset($_SESSION['USER_LAST_LOGOUT_'.$arParams['user_fields']['ID']]);

		$userStatus = 'online';
		if (CModule::IncludeModule('im'))
		{
			$res = Bitrix\Im\StatusTable::getById($arParams['user_fields']['ID']);
			if ($status = $res->fetch())
			{
				$userStatus = $status['STATUS'];
			}
		}

		CPullStack::AddShared(Array(
			'module_id' => 'online',
			'command' => 'user_online',
			'params' => Array(
				'USER_ID' => $arParams['user_fields']['ID'],
				'STATUS' => $userStatus
			),
		));

		return true;
	}
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:45,代码来源:pull_channel.php

示例4: OnAfterUserAuthorize

	public static function OnAfterUserAuthorize($arParams)
	{
		$arAuth = CHTTP::ParseAuthRequest();
		if(isset($arAuth["basic"]) && $arAuth["basic"]["username"] <> '' && $arAuth["basic"]["password"] <> ''
			&& strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'bitrix') === false)
		{
			return false;
		}

		if (isset($arParams['update']) && $arParams['update'] === false)
			return false;

		if ($arParams['user_fields']['ID'] <= 0)
			return false;

		$arParams['user_fields']['ID'] = intval($arParams['user_fields']['ID']);

		if (isset($_SESSION['USER_LAST_AUTH_'.$arParams['user_fields']['ID']])
			&& intval($_SESSION['USER_LAST_AUTH_'.$arParams['user_fields']['ID']])+100 > time())
			return false;

		$_SESSION['USER_LAST_AUTH_'.$arParams['user_fields']['ID']] = time();
		unset($_SESSION['USER_LAST_LOGOUT_'.$arParams['user_fields']['ID']]);

		CPullStack::AddShared(Array(
			'module_id' => 'main',
			'command' => 'user_authorize',
			'params' => Array(
				'USER_ID' => $arParams['user_fields']['ID']
			),
		));
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:32,代码来源:pull_channel.php


注:本文中的CHTTP::ParseAuthRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。