blob: 514a893fb398161b48b81ceea083653d9407dac5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Federation\Listener;
use OCA\DAV\Events\SabrePluginAuthInitEvent;
use OCA\Federation\DAV\FedAuth;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use Sabre\DAV\Auth\Plugin;
/**
* @since 20.0.0
* @template-implements IEventListener<SabrePluginAuthInitEvent>
*/
class SabrePluginAuthInitListener implements IEventListener {
public function __construct(
private FedAuth $fedAuth,
) {
}
public function handle(Event $event): void {
if (!($event instanceof SabrePluginAuthInitEvent)) {
return;
}
$server = $event->getServer();
$authPlugin = $server->getPlugin('auth');
if ($authPlugin instanceof Plugin) {
$authPlugin->addBackend($this->fedAuth);
}
}
}
|