diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-07-20 12:59:04 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-08-21 17:59:23 +0200 |
commit | 36eef2ddabd77ff6279f3bd6896ced4959f1c370 (patch) | |
tree | 82f28ac58905ed449d5678ffb505eec4d3ec7fde /lib/private/server.php | |
parent | 510010e774c4019b7fc616c90085649abb7afac3 (diff) | |
download | nextcloud-server-36eef2ddabd77ff6279f3bd6896ced4959f1c370.tar.gz nextcloud-server-36eef2ddabd77ff6279f3bd6896ced4959f1c370.zip |
Add a session wrapper to encrypt the data before storing it on disk
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index 89001567219..61eb3c736bf 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -56,6 +56,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 +160,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)); }); @@ -461,6 +467,13 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('EventDispatcher', function() { return new EventDispatcher(); }); + $this->registerService('CryptoWrapper', function (Server $c) { + return new CryptoWrapper( + $c->getConfig(), + $c->getCrypto(), + $c->getSecureRandom() + ); + }); } /** @@ -949,31 +962,4 @@ class Server extends SimpleContainer implements IServerContainer { return $this->query('MountManager'); } - /* - * Get the MimeTypeDetector - * - * @return \OCP\Files\IMimeTypeDetector - */ - public function getMimeTypeDetector() { - return $this->query('MimeTypeDetector'); - } - - /** - * Get the manager of all the capabilities - * - * @return \OC\CapabilitiesManager - */ - public function getCapabilitiesManager() { - return $this->query('CapabilitiesManager'); - } - - /** - * Get the EventDispatcher - * - * @return EventDispatcherInterface - * @since 8.2.0 - */ - public function getEventDispatcher() { - return $this->query('EventDispatcher'); - } } |