24 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
25 require_once(
'./Services/WebAccessChecker/classes/class.ilWACPath.php');
26 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSecurePath.php');
27 require_once(
'./Services/Init/classes/class.ilInitialisation.php');
28 require_once(
'./Services/FileDelivery/classes/class.ilFileDelivery.php');
100 $this->
http = $httpState;
117 if ($ilWACSignedPath->isSignedPath()) {
119 if ($ilWACSignedPath->isSignedPathValid()) {
128 if ($ilWACSignedPath->isFolderSigned()) {
130 if ($ilWACSignedPath->isFolderTokenValid()) {
132 $ilWACSignedPath->revalidatingFolderToken();
135 $this->
sendHeader(
'checked using secure folder');
146 $path = realpath($this->
getPathObject()->getCleanURLdecodedPath());
147 $data_dir = realpath(CLIENT_WEB_DIR);
148 if (strpos($path, $data_dir) !== 0) {
151 if (dirname($path) === $data_dir && is_file($path)) {
158 $checkingInstance = ilWACSecurePath::getCheckingInstance($this->
getPathObject());
160 $canBeDelivered = $checkingInstance->canBeDelivered($this->
getPathObject());
161 if ($canBeDelivered) {
164 $ilWACSignedPath->revalidatingFolderToken();
214 $cookie = $this->cookieFactory->create(
'ilClientId', $this->
getPathObject()->getClient())
220 ->renderIntoResponseHeader($this->
http->response());
234 if (($e instanceof
Exception && $e->getMessage() ==
'Authentication failed.')
236 $this->initAnonymousSession();
253 $is_anonymous = ((int) $DIC->user()->getId() === (int) ANONYMOUS_USER_ID);
254 $is_null_user = ($DIC->user()->getId() === 0);
255 $pub_section_activated = (bool) $DIC[
'ilSetting']->
get(
'pub_section');
256 $isset = isset($DIC[
'ilSetting']);
257 $instanceof = $DIC[
'ilSetting'] instanceof
ilSetting;
259 if (!$isset || !$instanceof) {
263 if ($on_login_page && ($is_null_user || $is_anonymous)) {
268 if ($pub_section_activated && ($is_null_user || $is_anonymous)) {
273 if ($is_anonymous || $is_null_user) {
283 $is_user = $DIC->user() instanceof
ilObjUser;
284 $user_id_is_zero = ((int) $DIC->user()->getId() === 0);
286 if (!$is_user || ($user_id_is_zero && $not_on_login_page)) {
441 return (
bool) self::$use_seperate_logfile;
484 assert(is_int($method));
485 $this->applied_checking_methods[] = $method;
489 protected function initAnonymousSession()
492 include_once
'./Services/Context/classes/class.ilContext.php';
495 require_once(
"Services/Init/classes/class.ilInitialisation.php");
500 $ilAuthSession = $DIC[
'ilAuthSession'];
501 $ilAuthSession->init();
502 $ilAuthSession->regenerateId();
503 $a_id = (int) ANONYMOUS_USER_ID;
504 $ilAuthSession->setUserId($a_id);
505 $ilAuthSession->setAuthenticated(
false, $a_id);
506 $DIC->user()->setId($a_id);
515 $referrer = (string) (
$_SERVER[
'HTTP_REFERER'] ??
'');
516 $not_on_login_page = (strpos($referrer,
'login.php') ===
false 517 && strpos($referrer,
'&baseClass=ilStartUpGUI') ===
false);
519 if ($not_on_login_page && $referrer !==
'') {
521 $referrer_url_parts = parse_url($referrer);
524 $ilias_url_parts[
'host'] === $referrer_url_parts[
'host'] &&
526 !isset($referrer_url_parts[
'path']) ||
527 strpos($referrer_url_parts[
'path'],
'.php') ===
false 530 $not_on_login_page =
false;
534 return $not_on_login_page;
setPathObject(ilWACPath $path_object)
static setUseSeperateLogfile($use_seperate_logfile)
Interface GlobalHttpState.
getAppliedCheckingMethods()
static $use_seperate_logfile
request()
Returns the current psr-7 server request.
setInitialized($initialized)
setDisposition($disposition)
setAppliedCheckingMethods(array $applied_checking_methods)
const CM_CHECKINGINSTANCE
const ACCESS_DENIED_NO_LOGIN
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRevalidateFolderTokens($revalidate_folder_tokens)
isRequestNotFromLoginPage()
__construct(GlobalHttpState $httpState, CookieFactory $cookieFactory)
ilWebAccessChecker constructor.
static initILIAS()
ilias initialisation
static http()
Fetches the global http state from ILIAS.
isRevalidateFolderTokens()
Class ilWebAccessChecker.
setSendStatusCode($send_status_code)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
static isUseSeperateLogfile()
setOverrideMimetype($override_mimetype)
static init($a_type)
Init context by type.
$applied_checking_methods
static hasCheckingInstanceRegistered(ilWACPath $ilWACPath)
Searches a checking instance for the given wac path.
$revalidate_folder_tokens
const ACCESS_DENIED_NO_PUB
addAppliedCheckingMethod($method)