summaryrefslogtreecommitdiffstats
path: root/apps/federation/appinfo/application.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/federation/appinfo/application.php')
-rw-r--r--apps/federation/appinfo/application.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/federation/appinfo/application.php b/apps/federation/appinfo/application.php
index 45d88548b70..0214d73d900 100644
--- a/apps/federation/appinfo/application.php
+++ b/apps/federation/appinfo/application.php
@@ -23,6 +23,7 @@ namespace OCA\Federation\AppInfo;
use OCA\Federation\API\OCSAuthAPI;
use OCA\Federation\Controller\SettingsController;
+use OCA\Federation\DAV\FedAuth;
use OCA\Federation\DbHandler;
use OCA\Federation\Hooks;
use OCA\Federation\Middleware\AddServerMiddleware;
@@ -30,7 +31,9 @@ use OCA\Federation\TrustedServers;
use OCP\API;
use OCP\App;
use OCP\AppFramework\IAppContainer;
+use OCP\SabrePluginEvent;
use OCP\Util;
+use Sabre\DAV\Auth\Plugin;
class Application extends \OCP\AppFramework\App {
@@ -144,6 +147,19 @@ class Application extends \OCP\AppFramework\App {
$hooksManager,
'addServerHook'
);
+
+ $dispatcher = $this->getContainer()->getServer()->getEventDispatcher();
+ $dispatcher->addListener('OCA\DAV\Connector\Sabre::authInit', function($event) use($container) {
+ if ($event instanceof SabrePluginEvent) {
+ $authPlugin = $event->getServer()->getPlugin('auth');
+ if ($authPlugin instanceof Plugin) {
+ $h = new DbHandler($container->getServer()->getDatabaseConnection(),
+ $container->getServer()->getL10N('federation')
+ );
+ $authPlugin->addBackend(new FedAuth($h));
+ }
+ }
+ });
}
}