summaryrefslogtreecommitdiffstats
path: root/lib/private/server.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/server.php')
-rw-r--r--lib/private/server.php49
1 files changed, 45 insertions, 4 deletions
diff --git a/lib/private/server.php b/lib/private/server.php
index 89001567219..5a3a6328fae 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -40,6 +40,7 @@ use bantu\IniGetWrapper\IniGetWrapper;
use OC\AppFramework\Http\Request;
use OC\AppFramework\Db\Db;
use OC\AppFramework\Utility\SimpleContainer;
+use OC\AppFramework\Utility\TimeFactory;
use OC\Command\AsyncBus;
use OC\Diagnostics\EventLogger;
use OC\Diagnostics\NullEventLogger;
@@ -56,6 +57,7 @@ use OC\Security\Crypto;
use OC\Security\Hasher;
use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
+use OC\Session\CryptoWrapper;
use OC\Tagging\TagMapper;
use OCP\IServerContainer;
use Symfony\Component\EventDispatcher\EventDispatcher;
@@ -159,7 +161,12 @@ class Server extends SimpleContainer implements IServerContainer {
});
$this->registerService('UserSession', function (Server $c) {
$manager = $c->getUserManager();
- $userSession = new \OC\User\Session($manager, new \OC\Session\Memory(''));
+
+ $session = new \OC\Session\Memory('');
+ $cryptoWrapper = $c->getSessionCryptoWrapper();
+ $session = $cryptoWrapper->wrapSession($session);
+
+ $userSession = new \OC\User\Session($manager, $session);
$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
});
@@ -322,14 +329,14 @@ class Server extends SimpleContainer implements IServerContainer {
);
});
$this->registerService('EventLogger', function (Server $c) {
- if (defined('DEBUG') and DEBUG) {
+ if ($c->getSystemConfig()->getValue('debug', false)) {
return new EventLogger();
} else {
return new NullEventLogger();
}
});
- $this->registerService('QueryLogger', function ($c) {
- if (defined('DEBUG') and DEBUG) {
+ $this->registerService('QueryLogger', function (Server $c) {
+ if ($c->getSystemConfig()->getValue('debug', false)) {
return new QueryLogger();
} else {
return new NullQueryLogger();
@@ -410,6 +417,7 @@ class Server extends SimpleContainer implements IServerContainer {
'requesttoken' => $requestToken,
],
$this->getSecureRandom(),
+ $this->getCrypto(),
$this->getConfig(),
$stream
);
@@ -461,6 +469,32 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('EventDispatcher', function() {
return new EventDispatcher();
});
+ $this->registerService('CryptoWrapper', function (Server $c) {
+ // FIXME: Instantiiated here due to cyclic dependency
+ $request = new Request(
+ [
+ 'get' => $_GET,
+ 'post' => $_POST,
+ 'files' => $_FILES,
+ 'server' => $_SERVER,
+ 'env' => $_ENV,
+ 'cookies' => $_COOKIE,
+ 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
+ ? $_SERVER['REQUEST_METHOD']
+ : null,
+ ],
+ new SecureRandom(),
+ $c->getCrypto(),
+ $c->getConfig()
+ );
+
+ return new CryptoWrapper(
+ $c->getConfig(),
+ $c->getCrypto(),
+ $c->getSecureRandom(),
+ $request
+ );
+ });
}
/**
@@ -976,4 +1010,11 @@ class Server extends SimpleContainer implements IServerContainer {
public function getEventDispatcher() {
return $this->query('EventDispatcher');
}
+
+ /**
+ * @return \OC\Session\CryptoWrapper
+ */
+ public function getSessionCryptoWrapper() {
+ return $this->query('CryptoWrapper');
+ }
}