24 private const SALT_FILE_PATH = __DIR__ .
'/../../../../public/data/wacsalt.php';
25 protected static string $SALT =
'';
28 protected string $ip =
'';
32 protected string $id =
'';
50 if (isset(
$_SERVER[
'REMOTE_ADDR'])) {
64 $token = implode(
'-', [
78 if (self::getSALT() !==
'' && self::getSALT() !==
'0') {
82 if (is_file(self::SALT_FILE_PATH)) {
88 if (strcmp($salt,
'') === 0) {
100 if (is_file(self::SALT_FILE_PATH)) {
101 unlink(self::SALT_FILE_PATH);
103 $template = file_get_contents(__DIR__ .
'/../wacsalt.php.template');
104 $random = new \Random\Randomizer();
105 $salt = md5(time() * $random->getInt(1000, 9999) . self::SALT_FILE_PATH);
107 $template = str_replace(
'INSERT_SALT', $salt, $template);
108 if (is_writable(dirname(self::SALT_FILE_PATH))) {
109 file_put_contents(self::SALT_FILE_PATH, $template);
184 return md5($this->
id);
188 public function setId(
string $id): void
200 public static function setSALT(
string $salt): void
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const DATA_DIR_NON_WRITEABLE
static getTokenMaxLifetimeInSeconds()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(string $path, string $client, int $timestamp=0, int $ttl=0)
ilWACToken constructor.
setRawToken(string $raw_token)
static setSALT(string $salt)
setSessionId(string $session_id)
setTimestamp(int $timestamp)
setClient(string $client)