26 $externalAuthId = $USER->GetParam(
'EXTERNAL_AUTH_ID');
28 if ($USER->IsAdmin() || $externalAuthId ===
"__controller")
34 $blackList = UserTable::getExternalUserTypes();
35 if (in_array($externalAuthId, $blackList,
true))
45 if (\
Bitrix\Intranet\Util::isIntranetUser())
50 if (\
Bitrix\Intranet\Util::isExtranetUser())
63 foreach(static::$authQueryParams as $key)
65 if(array_key_exists($key, $query))
67 $authKey = $query[$key];
72 if($authKey !==
null ||
Context::getCurrent()->getRequest()->getHeader(
'X-Bitrix-Csrf-Token') !==
null)
74 static::checkHttpAuth();
75 static::checkCookieAuth();
77 if(!$USER->isAuthorized())
80 $res = array(
'error' =>
'access_denied',
'error_description' =>
'User not authorized',
'additional' => array(
'sessid' => bitrix_sessid(),
'extended_error' =>
'user_not_authorized'));
82 else if(check_bitrix_sessid() || $authKey === bitrix_sessid())
84 if (self::isAccessAllowed())
88 'user_id' => $USER->GetID(),
89 'scope' => implode(
',', \CRestUtil::getScopeList()),
90 'parameters_clear' => static::$authQueryParams,
91 'auth_type' => static::AUTH_TYPE,
94 self::setLastActivityDate($USER->GetID(), $query);
96 if ($query[
'BX_SESSION_LOCK'] ??
null !==
'Y')
98 session_write_close();
104 $res = array(
'error' =>
'access_denied',
'error_description' =>
'Access denied for this type of user',
'additional' => array(
'type' => $USER->GetParam(
'EXTERNAL_AUTH_ID')));
110 $res = array(
'error' =>
'session_failed',
'error_description' =>
'Sessid check failed',
'additional' => array(
'sessid' => bitrix_sessid()));