crypto = $crypto; $this->config = $config; $this->random = $random; if (!is_null($request->getCookie(self::COOKIE_NAME))) { $this->passphrase = $request->getCookie(self::COOKIE_NAME); } else { $this->passphrase = $this->random->generate(128); $secureCookie = $request->getServerProtocol() === 'https'; // FIXME: Required for CI if (!defined('PHPUNIT_RUN')) { $webRoot = \OC::$WEBROOT; if ($webRoot === '') { $webRoot = '/'; } setcookie( self::COOKIE_NAME, $this->passphrase, [ 'expires' => 0, 'path' => $webRoot, 'domain' => '', 'secure' => $secureCookie, 'httponly' => true, 'samesite' => 'Lax', ] ); } } } /** * @param ISession $session * @return ISession */ public function wrapSession(ISession $session) { if (!($session instanceof CryptoSessionData)) { return new CryptoSessionData($session, $this->crypto, $this->passphrase); } return $session; } }