aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-07-05 14:31:19 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-11-03 00:13:01 +0100
commitdc479aae2d055dafddb250a382eb801a68d42afb (patch)
treedba601f780b38207e88b406da723467e87cf1411 /lib/private/Server.php
parent65375320fb94fe3b7d0aaaecc9e66b7458ed6c1a (diff)
downloadnextcloud-server-dc479aae2d055dafddb250a382eb801a68d42afb.tar.gz
nextcloud-server-dc479aae2d055dafddb250a382eb801a68d42afb.zip
Improve CertificateManager to not be user context dependent
* removes the ability for users to import their own certificates (for external storage) * reliably returns the same certificate bundles system wide (and not depending on the user context and available sessions) The user specific certificates were broken in some cases anyways, as they are only loaded if the specific user is logged in and thus causing unexpected behavior for background jobs and other non-user triggered code paths. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php44
1 files changed, 7 insertions, 37 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 5de7808523e..8e2452b2f30 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -178,6 +178,7 @@ use OCP\IAppConfig;
use OCP\IAvatarManager;
use OCP\ICache;
use OCP\ICacheFactory;
+use OCP\ICertificateManager;
use OCP\IDateTimeFormatter;
use OCP\IDateTimeZone;
use OCP\IDBConnection;
@@ -823,23 +824,8 @@ class Server extends ServerContainer implements IServerContainer {
/** @deprecated 19.0.0 */
$this->registerDeprecatedAlias('DatabaseConnection', IDBConnection::class);
-
- $this->registerService(IClientService::class, function (ContainerInterface $c) {
- $user = \OC_User::getUser();
- $uid = $user ? $user : null;
- return new ClientService(
- $c->get(\OCP\IConfig::class),
- $c->get(ILogger::class),
- new \OC\Security\CertificateManager(
- $uid,
- new View(),
- $c->get(\OCP\IConfig::class),
- $c->get(ILogger::class),
- $c->get(ISecureRandom::class)
- )
- );
- });
- /** @deprecated 19.0.0 */
+ $this->registerAlias(ICertificateManager::class, CertificateManager::class);
+ $this->registerAlias(IClientService::class, ClientService::class);
$this->registerDeprecatedAlias('HttpClientService', IClientService::class);
$this->registerService(IEventLogger::class, function (ContainerInterface $c) {
$eventLogger = new EventLogger();
@@ -1840,28 +1826,12 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
- * Get the certificate manager for the user
+ * Get the certificate manager
*
- * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
- * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
- * @deprecated 20.0.0
+ * @return \OCP\ICertificateManager
*/
- public function getCertificateManager($userId = '') {
- if ($userId === '') {
- $userSession = $this->get(IUserSession::class);
- $user = $userSession->getUser();
- if (is_null($user)) {
- return null;
- }
- $userId = $user->getUID();
- }
- return new CertificateManager(
- $userId,
- new View(),
- $this->get(\OCP\IConfig::class),
- $this->get(ILogger::class),
- $this->get(ISecureRandom::class)
- );
+ public function getCertificateManager() {
+ return $this->get(ICertificateManager::class);
}
/**