9require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
10require_once(
'./Services/WebAccessChecker/classes/class.ilWACPath.php');
11require_once(
'./Services/WebAccessChecker/classes/class.ilWACSecurePath.php');
12require_once(
'./Services/Init/classes/class.ilInitialisation.php');
13require_once(
'./Services/FileDelivery/classes/class.ilFileDelivery.php');
85 $this->
http = $httpState;
102 if ($ilWACSignedPath->isSignedPath()) {
104 if ($ilWACSignedPath->isSignedPathValid()) {
113 if ($ilWACSignedPath->isFolderSigned()) {
115 if ($ilWACSignedPath->isFolderTokenValid()) {
117 $ilWACSignedPath->revalidatingFolderToken();
120 $this->
sendHeader(
'checked using secure folder');
131 $checkingInstance = ilWACSecurePath::getCheckingInstance($this->
getPathObject());
133 $canBeDelivered = $checkingInstance->canBeDelivered($this->
getPathObject());
134 if ($canBeDelivered) {
136 if ($ilWACSignedPath->isFolderSigned() && $this->isRevalidateFolderTokens()) {
137 $ilWACSignedPath->revalidatingFolderToken();
187 $cookie = $this->cookieFactory->create(
'ilClientId', $this->
getPathObject()->getClient())
193 ->renderIntoResponseHeader($this->
http->response());
202 }
catch (Exception $e) {
207 if (($e instanceof Exception && $e->getMessage() ==
'Authentication failed.')
209 $this->initAnonymousSession();
226 $is_anonymous = ((int)
$DIC->user()->getId() === (int) ANONYMOUS_USER_ID);
227 $is_null_user = (
$DIC->user()->getId() === 0);
228 $pub_section_activated = (bool)
$DIC[
'ilSetting']->
get(
'pub_section');
229 $isset = isset(
$DIC[
'ilSetting']);
232 if (!$isset || !$instanceof) {
236 if ($on_login_page && ($is_null_user || $is_anonymous)) {
241 if ($pub_section_activated && ($is_null_user || $is_anonymous)) {
246 if ($is_anonymous || $is_null_user) {
257 $user_id_is_zero = ((int)
$DIC->user()->getId() === 0);
259 if (!$is_user || ($user_id_is_zero && $not_on_login_page)) {
457 assert(is_int($method));
458 $this->applied_checking_methods[] = $method;
462 protected function initAnonymousSession()
465 include_once
'./Services/Context/classes/class.ilContext.php';
467 require_once(
"Services/Init/classes/class.ilInitialisation.php");
472 $ilAuthSession =
$DIC[
'ilAuthSession'];
473 $ilAuthSession->init();
474 $ilAuthSession->regenerateId();
475 $a_id = (int) ANONYMOUS_USER_ID;
476 $ilAuthSession->setUserId($a_id);
477 $ilAuthSession->setAuthenticated(
false, $a_id);
478 $DIC->user()->setId($a_id);
487 $referrer = (string) (
$_SERVER[
'HTTP_REFERER'] ??
'');
488 $not_on_login_page = (strpos($referrer,
'login.php') ===
false
489 && strpos($referrer,
'&baseClass=ilStartUpGUI') ===
false);
491 if ($not_on_login_page && $referrer !==
'') {
493 $referrer_url_parts = parse_url($referrer);
496 $ilias_url_parts[
'host'] === $referrer_url_parts[
'host'] &&
498 !isset($referrer_url_parts[
'path']) ||
499 strpos($referrer_url_parts[
'path'],
'.php') ===
false
502 $not_on_login_page =
false;
506 return $not_on_login_page;
An exception for terminatinating execution or to throw for unit testing.
static init($a_type)
Init context by type.
static initILIAS()
ilias initialisation
const ACCESS_DENIED_NO_LOGIN
const ACCESS_DENIED_NO_PUB
static hasCheckingInstanceRegistered(ilWACPath $ilWACPath)
Searches a checking instance for the given wac path.
Class ilWebAccessChecker.
const CM_CHECKINGINSTANCE
setDisposition($disposition)
__construct(GlobalHttpState $httpState, CookieFactory $cookieFactory)
ilWebAccessChecker constructor.
static $use_seperate_logfile
$applied_checking_methods
static setUseSeperateLogfile($use_seperate_logfile)
setSendStatusCode($send_status_code)
$revalidate_folder_tokens
setRevalidateFolderTokens($revalidate_folder_tokens)
setAppliedCheckingMethods(array $applied_checking_methods)
isRequestNotFromLoginPage()
isRevalidateFolderTokens()
addAppliedCheckingMethod($method)
setInitialized($initialized)
setPathObject(ilWACPath $path_object)
static isUseSeperateLogfile()
setOverrideMimetype($override_mimetype)
getAppliedCheckingMethods()
Interface GlobalHttpState.
request()
Returns the current psr-7 server request.
Value object representing a URI.
catch(Exception $e) $message
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static http()
Fetches the global http state from ILIAS.
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']