43 protected int $type = PathType::FILE;
56 $this->httpService = $httpState;
65 if ($this->
getType() !== PathType::FILE) {
85 return $path .
'&' . self::WAC_TIMESTAMP_ID .
'='
91 $this->httpService->cookieJar();
93 $this->
setType(PathType::FOLDER);
95 $name = $plain_token->getHashedId();
99 $token_cookie_value = $this->httpService->request()->getCookieParams()[
$name] ?? $default_token;
101 $default_timestamp = 0;
102 $timestamp_cookie_value = $this->httpService->request()->getCookieParams()[
$name .
self::TS_SUFFIX] ?? $default_timestamp;
103 $timestamp_cookie_value = (
int) $timestamp_cookie_value;
106 $ttl_cookie_value = $this->httpService->request()->getCookieParams()[
$name .
self::TTL_SUFFIX] ?? $default_ttl;
107 $ttl_cookie_value = (
int) $ttl_cookie_value;
110 $this->
getPathObject()->setTimestamp($timestamp_cookie_value);
134 $expire = time() + $cookie_lifetime + 3600;
141 ->withExpires($expire)
143 ->withSecure($secure)
144 ->withDomain($domain)
145 ->withHttpOnly($http_only);
147 $timestampCookie = $this->cookieFactory->create(
$id . self::TS_SUFFIX, time())
148 ->withExpires($expire)
150 ->withDomain($domain)
151 ->withSecure($secure)
152 ->withHttpOnly($http_only);
154 $ttlCookie = $this->cookieFactory->create(
$id . self::TTL_SUFFIX, $cookie_lifetime)
155 ->withExpires($expire)
157 ->withDomain($domain)
158 ->withSecure($secure)
159 ->withHttpOnly($http_only);
161 $jar = $this->httpService->cookieJar()->with($tokenCookie)
162 ->with($timestampCookie)
166 foreach ($jar->getAll() as $cookie) {
170 $cookie->getExpires(),
172 $cookie->getDomain(),
173 $cookie->getSecure(),
174 $cookie->getHttpOnly()
181 if ($this->
getType() !== PathType::FOLDER) {
215 public static function signFile(
string $path_to_file): string
218 if ($path_to_file ===
'' || $path_to_file ===
'0') {
221 $ilWACPath =
new ilWACPath($path_to_file,
false);
222 if ($ilWACPath->getClient() ===
'' || $ilWACPath->getClient() ===
'0') {
223 return $path_to_file;
226 $obj->setType(PathType::FILE);
229 return $obj->getSignedPath();
236 $obj->setType(PathType::FOLDER);
238 $obj->saveFolderToken();
279 $current_timestamp = time();
281 $timestamp_valid = ($current_timestamp < ($request_timestamp + $request_ttl));
283 if (!$timestamp_valid) {
290 $simulated_token_string = $simulated_token->getToken();
291 $token_valid = ($simulated_token_string === $request_token_string);
313 case PathType::FOLDER:
375 if ($request_ttl > 0) {
379 case PathType::FOLDER:
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
foreach($mandatory_scripts as $file) $timestamp
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilWACToken $token_instance
static setCookieMaxLifetimeInSeconds(int $cookie_max_lifetime_in_seconds)
static setTokenMaxLifetimeInSeconds(int $token_max_lifetime_in_seconds)
CookieFactory $cookieFactory
static int $cookie_max_lifetime_in_seconds
GlobalHttpState $httpService
__construct(ilWACPath $ilWACPath, GlobalHttpState $httpState, CookieFactory $cookieFactory)
ilWACSignedPath constructor.
setChecked(bool $checked)
setTokenInstance(ilWACToken $token_instance)
static signFolderOfStartFile(string $start_file_path)
static signFile(string $path_to_file)
static getCookieMaxLifetimeInSeconds()
revalidatingFolderToken()
setPathObject(ilWACPath $path_object)
buildTokenInstance(int $timestamp=0, int $ttl=0)
static int $token_max_lifetime_in_seconds
static getTokenMaxLifetimeInSeconds()
buildAndSetTokenInstance(int $timestamp=0, int $ttl=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface GlobalHttpState.