11require_once(
'./Services/WebAccessChecker/class.ilWACException.php');
 
   12require_once(
'class.ilWACToken.php');
 
   13require_once(
'./Services/WebAccessChecker/classes/class.ilWebAccessChecker.php');
 
   14require_once 
'./Services/WebAccessChecker/interfaces/PathType.php';
 
   15require_once 
'./Services/WebAccessChecker/classes/HttpServiceAware.php';
 
   43    protected $type = PathType::FILE;
 
   76        $this->httpService = $httpState;
 
   87        if ($this->
getType() !== PathType::FILE) {
 
  106        $path = 
$path . 
'&' . self::WAC_TIMESTAMP_ID . 
'=' 
  118        $cookieJar = $this->httpService->cookieJar();
 
  120        $this->
setType(PathType::FOLDER);
 
  122        $name = $plain_token->getHashedId();
 
  124        $tokenCookie = $cookieJar->get(
$name);
 
  125        $timestampCookie = $cookieJar->get(
$name . self::TS_SUFFIX);
 
  126        $ttlCookie = $cookieJar->get(
$name . self::TTL_SUFFIX);
 
  129        $tokenCookieValue = is_null($tokenCookie) ? $defaultToken : is_a($tokenCookie->getValue(), Cookie::class) ? $tokenCookie->getValue() : $defaultToken;
 
  131        $defaultTimestamp = 0;
 
  132        $timestampCookieValue = is_null($timestampCookie) ? $defaultTimestamp : is_a($timestampCookie->getValue(), Cookie::class) ? $timestampCookie->getValue() : $defaultTimestamp;
 
  133        $timestampCookieValue = intval($timestampCookieValue);
 
  136        $ttlCookieValue = is_null($ttlCookie) ? $defaultTtl : is_a($ttlCookie->getValue(), Cookie::class) ? $ttlCookie->getValue() : $defaultTtl;
 
  137        $ttlCookieValue = intval($ttlCookieValue);
 
  170        $expire = time() + $cookie_lifetime;
 
  172        $tokenCookie = $this->cookieFactory->create(
$id, $this->
getTokenInstance()->getToken())->withExpires(time()
 
  174                                                                                                               * 3600)->withPath(
'/')->withSecure(
false)->withDomain(
null)->withSecure(
false)->withHttpOnly(
false);
 
  176        $timestampCookie = $this->cookieFactory->create(
$id 
  177                                                        . self::TS_SUFFIX, time())->withExpires(
$expire)->withPath(
'/')->withDomain(
null)->withSecure(
false)->withHttpOnly(
false);
 
  179        $ttlCookie = $this->cookieFactory->create(
$id 
  180                                                  . self::TTL_SUFFIX, self::getCookieMaxLifetimeInSeconds())->withExpires(
$expire)->withPath(
'/')->withDomain(
null)->withSecure(
false)->withHttpOnly(
false);
 
  182        $cookieJar = $this->httpService->cookieJar();
 
  183        $response = $cookieJar->with($tokenCookie)->with($timestampCookie)->with($ttlCookie)->renderIntoResponseHeader($this->httpService->response());
 
  185        $this->httpService->saveResponse(
$response);
 
  194        if ($this->
getType() !== PathType::FOLDER) {
 
  235        if (!$path_to_file) {
 
  238        $ilWACPath = 
new ilWACPath($path_to_file);
 
  239        if (!$ilWACPath->getClient()) {
 
  240            return $path_to_file;
 
  243        $obj->setType(PathType::FILE);
 
  246        return $obj->getSignedPath();
 
  257        $obj->setType(PathType::FOLDER);
 
  259        $obj->saveFolderToken();
 
  297        assert(is_int(
$type));
 
  330        $current_timestamp = time();
 
  332        $timestamp_valid = ($current_timestamp < ($request_timestamp + $request_ttl));
 
  334        if (!$timestamp_valid) {
 
  340        $simulatedTokenInstance = $this->
buildTokenInstance($request_timestamp, $request_ttl);
 
  341        $token_valid = ($simulatedTokenInstance->getToken() == $request_token);
 
  363        assert(is_int($ttl));
 
  369            case PathType::FOLDER:
 
  398        assert(is_int($ttl));
 
  461        if ($request_ttl > 0) {
 
  465            case PathType::FOLDER:
 
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
static signFile($path_to_file)
static $token_max_lifetime_in_seconds
__construct(ilWACPath $ilWACPath, GlobalHttpState $httpState, CookieFactory $cookieFactory)
ilWACSignedPath constructor.
setTokenInstance(ilWACToken $token_instance)
static getCookieMaxLifetimeInSeconds()
static setCookieMaxLifetimeInSeconds($cookie_max_lifetime_in_seconds)
revalidatingFolderToken()
buildAndSetTokenInstance($timestamp=0, $ttl=0)
setPathObject(ilWACPath $path_object)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
static $cookie_max_lifetime_in_seconds
static signFolderOfStartFile($start_file_path)
buildTokenInstance($timestamp=0, $ttl=0)
static getTokenMaxLifetimeInSeconds()
if(!array_key_exists('StateId', $_REQUEST)) $id
Interface GlobalHttpState.
trait HttpServiceAware
Trait HttpServiceAware.
static http()
Fetches the global http state from ILIAS.
trait HttpServiceAware
Trait HttpServiceAware.