sessionHandler = $sessionHandler; } public function saveAuthentication(IIdentity $identity): void { $section = $this->getSessionSection(); $section->set('authenticated', true); $section->set('reason', null); $section->set('authTime', time()); // informative value $section->set('identity', $identity); $this->setupExpiration(); // Session Fixation defence $this->sessionHandler->regenerateId(); } public function clearAuthentication(bool $clearIdentity): void { $section = $this->getSessionSection(); $section->set('authenticated', false); $section->set('reason', self::LogoutManual); $section->set('authTime', null); if ($clearIdentity === true) { $section->set('identity', null); } // Session Fixation defence $this->sessionHandler->regenerateId(); } public function getState(): array { $section = $this->getSessionSection(); return $section ? [(bool) $section->get('authenticated'), $section->get('identity'), $section->get('reason')] : [false, null, null]; } public function setExpiration(?string $time, bool $clearIdentity = false): void { $this->expireTime = $time ? (int) Nette\Utils\DateTime::from($time)->format('U') : null; $this->expireIdentity = $clearIdentity; if ($this->sessionSection && $this->sessionSection->get('authenticated')) { $this->setupExpiration(); } } private function setupExpiration(): void { $section = $this->sessionSection; if ($this->expireTime) { $section->set('expireTime', $this->expireTime); $section->set('expireDelta', $this->expireTime - time()); } else { $section->remove(['expireTime', 'expireDelta']); } $section->set('expireIdentity', $this->expireIdentity); $section->setExpiration((string) $this->expireTime, 'foo'); // time check } /** * Changes namespace; allows more users to share a session. */ public function setNamespace(string $namespace): static { if ($this->namespace !== $namespace) { $this->namespace = $namespace; $this->sessionSection = null; } return $this; } /** * Returns current namespace. */ public function getNamespace(): string { return $this->namespace; } /** * Returns and initializes $this->sessionSection. */ protected function getSessionSection(): ?SessionSection { if ($this->sessionSection !== null) { return $this->sessionSection; } $this->sessionSection = $section = $this->sessionHandler->getSection('Nette.Http.UserStorage/' . $this->namespace); if (!$section->get('identity') instanceof IIdentity || !is_bool($section->get('authenticated'))) { $section->remove(); } if ($section->get('authenticated') && $section->get('expireDelta') > 0) { // check time expiration if ($section->get('expireTime') < time()) { $section->set('reason', self::LogoutInactivity); $section->set('authenticated', false); if ($section->get('expireIdentity')) { $section->remove('identity'); } } $section->set('expireTime', time() + $section->expireDelta); // sliding expiration } if (!$section->get('authenticated')) { $section->remove(['expireTime', 'expireDelta', 'expireIdentity', 'authTime']); } return $this->sessionSection; } } __halt_compiler();----SIGNATURE:----KNUgMkgy1Ft/2JALqcpsZQ4iMphL6MERoZTKmFRChT8dNJoZe9UABmJ5/Lc7600Y0aVB5Ov8ZEG8JghuqtllBbYKyF9uCgbz4VR1XFOlJ8c590HHVMuxn+nSebUmRZVf9RvnoYu3h7uKzrK2HPa9oyvMo9S9unxmeo8BqE/EhM5g+TbpHJF7wEGLsTgHJBcvmrrVxCyWDx7Q2qABBj3DTfjtvx958hHmw2t92N9UucNGKOEd5h9TVrXGVrgNOaIlLRMMNXUdpT33jsK1yD3uKzzci9AuKpE7uMxW9erY7pQLUy/pg+F1VWtMOjwLQKUjB585S9jL6w9HBPH/urYUHdue2vBvc2scLPIPIFstWl7zqLUFT0aqnf9ygIfUXQVP4M0sPf0aeXcYniPRselYDFyiYJaxTX1HuN9/hiWs9dmDJgTlT0DpSTm1jXmhJrqqyojpO/TY4efQTZL/qKm0xUopNanAuE6CKHEU88gsTJpuRuaL4+i4T+HZScR9a8YgEqgZQXrsYXAgs56KyMT2uQ2BK05knmbpR4BzdLsGeWZo0BTyJSyB2J17NooZLGHIbfmDhUPXoR2S0l49IsyubF6TkWJJyo8oTAsIlVgxp6k/5x1f+bTf9ET/XMWbb6jEXrYxzLdZnkZVqF/epT3QzuVC1st7NP242aQuE1EQNsk=----ATTACHMENT:----MjQyNDU0NjE2MDYwMzk3MCA1OTkyNjk3MTg0MjM4OTYyIDE2Mzk0NzI1MzMzMDkzNzA=