2require_once(
'./Services/WebAccessChecker/class.ilWACException.php');
3require_once(
'class.ilWACToken.php');
4require_once(
'./Services/WebAccessChecker/classes/class.ilWebAccessChecker.php');
5require_once(
'./Services/WebAccessChecker/classes/class.ilWACCookie.php');
60 $this->cookie = ($ilWACCookieInterface ? $ilWACCookieInterface :
new ilWACCookie());
70 if ($this->
getType() !== self::TYPE_FILE) {
97 $this->
setType(self::TYPE_FOLDER);
99 $name = $plain_token->getId();
101 $this->
getPathObject()->setTimestamp($this->cookie->get($name . self::TS_SUFFIX));
102 $this->
getPathObject()->setTTL($this->cookie->get($name . self::TTL_SUFFIX));
124 $str =
'save folder token for folder: ' . $this->
getPathObject()->getDirName() .
', valid for ' . $cookie_lifetime .
's';
128 $expire = time() + $cookie_lifetime;
129 $this->cookie->set($id, $this->
getTokenInstance()->getToken(), time() + 24 * 3600,
'/',
null,
false,
false);
130 $this->cookie->set($id . self::TS_SUFFIX, time(), $expire,
'/',
'',
false,
false);
131 $this->cookie->set($id . self::TTL_SUFFIX, self::getCookieMaxLifetimeInSeconds(), $expire,
'/',
'',
false,
false);
139 if ($this->
getType() !== self::TYPE_FOLDER) {
176 if (!$path_to_file) {
179 $ilWACPath =
new ilWACPath($path_to_file);
180 if (!$ilWACPath->getClient()) {
181 return $path_to_file;
183 $obj =
new self($ilWACPath);
184 $obj->setType(self::TYPE_FILE);
187 return $obj->getSignedPath();
196 $obj =
new self(
new ilWACPath($start_file_path), $ilWACCookieInterface);
197 $obj->setType(self::TYPE_FOLDER);
199 $obj->saveFolderToken();
261 $current_timestamp = time();
263 ilWACLog::getInstance()->write(
'Checking Token: ' . $request_token .
', ts: ' . $request_timestamp .
"\n\n\n\n\n\n");
265 $timestamp_valid = ($current_timestamp < ($request_timestamp + $request_ttl));
267 if (!$timestamp_valid) {
274 $simulatedTokenInstance = $this->
buildTokenInstance($request_timestamp, $request_ttl);
275 $token_valid = ($simulatedTokenInstance->getToken() == $request_token);
375 if ($request_ttl > 0) {
foreach($mandatory_scripts as $file) $timestamp
static signFile($path_to_file)
static $token_max_lifetime_in_seconds
setTokenInstance(ilWACToken $token_instance)
static signFolderOfStartFile($start_file_path, ilWACCookieInterface $ilWACCookieInterface=null)
setPathObject($path_object)
static getCookieMaxLifetimeInSeconds()
static setCookieMaxLifetimeInSeconds($cookie_max_lifetime_in_seconds)
revalidatingFolderToken()
buildAndSetTokenInstance($timestamp=null, $ttl=null)
static setTokenMaxLifetimeInSeconds($token_max_lifetime_in_seconds)
__construct(ilWACPath $ilWACPath, ilWACCookieInterface $ilWACCookieInterface=null)
ilWACSignedPath constructor.
buildTokenInstance($timestamp=null, $ttl=null)
static $cookie_max_lifetime_in_seconds
static getTokenMaxLifetimeInSeconds()
Class ilWACCookieInterface.