diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-11-04 16:05:31 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-11-06 15:16:14 +0100 |
commit | 24ca2d858f9cc020b2ca7310977cd4272a6809fb (patch) | |
tree | 9bfc2d8f93206b249f9af8ea0c1c2706fae896d7 /lib/private/server.php | |
parent | 1d6c7e28e9e5df5a3e9590eb22025e2c59c13338 (diff) | |
download | nextcloud-server-24ca2d858f9cc020b2ca7310977cd4272a6809fb.tar.gz nextcloud-server-24ca2d858f9cc020b2ca7310977cd4272a6809fb.zip |
Add OCP\Security\IHasher
Public interface for hashing which also works with legacy ownCloud hashes and supports updating the legacy hash via a passed reference.
Follow-up of https://github.com/owncloud/core/pull/10219#issuecomment-61624662
Requires https://github.com/owncloud/3rdparty/pull/136
Diffstat (limited to 'lib/private/server.php')
-rw-r--r-- | lib/private/server.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index 186714740f7..f43613e8188 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -14,6 +14,7 @@ use OC\DB\ConnectionWrapper; use OC\Files\Node\Root; use OC\Files\View; use OC\Security\Crypto; +use OC\Security\Hasher; use OC\Security\SecureRandom; use OC\Diagnostics\NullEventLogger; use OCP\IServerContainer; @@ -197,6 +198,9 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('Crypto', function (Server $c) { return new Crypto($c->getConfig(), $c->getSecureRandom()); }); + $this->registerService('Hasher', function (Server $c) { + return new Hasher($c->getConfig()); + }); $this->registerService('DatabaseConnection', function (Server $c) { $factory = new \OC\DB\ConnectionFactory(); $type = $c->getConfig()->getSystemValue('dbtype', 'sqlite'); @@ -530,6 +534,15 @@ class Server extends SimpleContainer implements IServerContainer { } /** + * Returns a Hasher instance + * + * @return \OCP\Security\IHasher + */ + function getHasher() { + return $this->query('Hasher'); + } + + /** * Returns an instance of the db facade * * @return \OCP\IDb |