Skip to content

Commit 44c49f4

Browse files
committed
fixup! Cleanup app bootstrap
1 parent 4728d65 commit 44c49f4

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

appinfo/info.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ While theoretically any other authentication provider implementing either one of
2222
<namespace>User_SAML</namespace>
2323
<types>
2424
<authentication/>
25+
<dav/>
2526
</types>
2627
<documentation>
2728
<admin>https://portal.nextcloud.com/article/configuring-single-sign-on-10.html</admin>

lib/AppInfo/Application.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/**
36
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
47
*
@@ -21,7 +24,6 @@
2124

2225
namespace OCA\User_SAML\AppInfo;
2326

24-
use OC;
2527
use OC\Security\CSRF\CsrfTokenManager;
2628
use OC_User;
2729
use OCA\User_SAML\DavPlugin;
@@ -47,8 +49,6 @@
4749
use OCP\IUserManager;
4850
use OCP\IUserSession;
4951
use OCP\L10N\IFactory;
50-
use OCP\SabrePluginEvent;
51-
use OCP\Server;
5252
use Psr\Container\ContainerInterface;
5353
use Psr\Log\LoggerInterface;
5454
use Throwable;
@@ -60,14 +60,6 @@ public function __construct(array $urlParams = []) {
6060
parent::__construct('user_saml', $urlParams);
6161
}
6262

63-
public function registerDavAuth(): void {
64-
$dispatcher = Server::get(IEventDispatcher::class);
65-
$dispatcher->addListener('OCA\DAV\Connector\Sabre::addPlugin', function (SabrePluginEvent $event) {
66-
$event->getServer()->addPlugin(Server::get(DavPlugin::class));
67-
});
68-
}
69-
70-
7163
public function register(IRegistrationContext $context): void {
7264
$context->registerMiddleware(OnlyLoggedInMiddleware::class);
7365
$context->registerEventListener(BeforeTemplateRenderedEvent::class, LoadAdditionalScriptsListener::class);
@@ -190,7 +182,7 @@ public function boot(IBootContext $context): void {
190182
// SAML at the moment.
191183
$useSamlForDesktopClients = $config->getAppValue('user_saml', 'general-use_saml_auth_for_desktop', '0');
192184
if ($useSamlForDesktopClients === '1') {
193-
$currentUrl = substr(explode('?', $request->getRequestUri(), 2)[0], strlen(\OC::$WEBROOT));
185+
$currentUrl = substr(explode('?', $request->getRequestUri(), 2)[0], strlen($urlGenerator->getWebroot()));
194186
if (substr($currentUrl, 0, 12) === '/remote.php/' || substr($currentUrl, 0, 5) === '/ocs/') {
195187
if (!$userSession->isLoggedIn() && $request->isUserAgent([\OCP\IRequest::USER_AGENT_CLIENT_DESKTOP])) {
196188
$redirectSituation = true;

0 commit comments

Comments
 (0)