Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ While theoretically any other authentication provider implementing either one of
<namespace>User_SAML</namespace>
<types>
<authentication/>
<dav/>
</types>
<documentation>
<admin>https://portal.nextcloud.com/article/configuring-single-sign-on-10.html</admin>
Expand Down Expand Up @@ -61,9 +60,4 @@ While theoretically any other authentication provider implementing either one of
<admin>OCA\User_SAML\Settings\Admin</admin>
<admin-section>OCA\User_SAML\Settings\Section</admin-section>
</settings>
<sabre>
<plugins>
<plugin>OCA\User_SAML\DavPlugin</plugin>
</plugins>
</sabre>
</info>
3 changes: 3 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
use OC\Security\CSRF\CsrfTokenManager;
use OC\User\LoginException;
use OC_User;
use OCA\DAV\Events\SabrePluginAddEvent;
use OCA\User_SAML\DavPlugin;
use OCA\User_SAML\GroupBackend;
use OCA\User_SAML\GroupManager;
use OCA\User_SAML\Listener\LoadAdditionalScriptsListener;
use OCA\User_SAML\Listener\SabrePluginEventListener;
use OCA\User_SAML\Middleware\OnlyLoggedInMiddleware;
use OCA\User_SAML\SAMLSettings;
use OCA\User_SAML\UserBackend;
Expand Down Expand Up @@ -50,6 +52,7 @@ public function __construct(array $urlParams = []) {
public function register(IRegistrationContext $context): void {
$context->registerMiddleware(OnlyLoggedInMiddleware::class);
$context->registerEventListener(BeforeTemplateRenderedEvent::class, LoadAdditionalScriptsListener::class);
$context->registerEventListener(SabrePluginAddEvent::class, SabrePluginEventListener::class);
$context->registerService(DavPlugin::class, function (ContainerInterface $c) {
return new DavPlugin(
$c->get(ISession::class),
Expand Down
26 changes: 26 additions & 0 deletions lib/Listener/SabrePluginEventListener.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\User_SAML\Listener;

use OCA\DAV\Events\SabrePluginAddEvent;
use OCA\User_SAML\DavPlugin;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\Server;

/** @template-implements IEventListener<SabrePluginAddEvent|Event> */
class SabrePluginEventListener implements IEventListener {
public function handle(Event $event): void {
if (!$event instanceof SabrePluginAddEvent) {
return;
}
$event->getServer()->addPlugin(Server::get(DavPlugin::class));
}
}
11 changes: 0 additions & 11 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
- SPDX-License-Identifier: AGPL-3.0-or-later
-->
<files psalm-version="5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0">
<file src="lib/AppInfo/Application.php">
<MissingDependency>
<code><![CDATA[DavPlugin]]></code>
<code><![CDATA[DavPlugin]]></code>
</MissingDependency>
</file>
<file src="lib/Controller/SAMLController.php">
<RedundantCondition>
<code><![CDATA[!$userExists]]></code>
Expand All @@ -29,11 +23,6 @@
<code><![CDATA[ClientFlowLoginV2Controller]]></code>
</UndefinedClass>
</file>
<file src="lib/DavPlugin.php">
<UndefinedClass>
<code><![CDATA[ServerPlugin]]></code>
</UndefinedClass>
</file>
<file src="lib/Db/ConfigurationsMapper.php">
<MissingTemplateParam>
<code><![CDATA[ConfigurationsMapper]]></code>
Expand Down
14 changes: 14 additions & 0 deletions tests/stub.phpstub
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ namespace OC\User {
}
}

namespace OCA\DAV\Connector\Sabre {
class Auth {
public const DAV_AUTHENTICATED = 'AUTHENTICATED_TO_DAV_BACKEND';
}
}

namespace OCA\DAV\Events {
use OCP\EventDispatcher\Event;
use Sabre\DAV\Server;
class SabrePluginAddEvent extends Event {
public function getServer(): Server;
}
}

class OC_User {
public static function useBackend($userBackend): void;
public static function handleApacheAuth(): void;
Expand Down
3 changes: 2 additions & 1 deletion vendor-bin/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"require-dev": {
"nextcloud/ocp": "dev-stable28",
"vimeo/psalm": "^5.26"
"vimeo/psalm": "^5.26",
"sabre/dav": "4.7.0"
},
"config": {
"platform": {
Expand Down
Loading
Loading