11<?php
2+
3+ declare (strict_types=1 );
4+
25/**
36 * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
47 *
2124
2225namespace OCA \User_SAML \AppInfo ;
2326
24- use OC ;
2527use OC \Security \CSRF \CsrfTokenManager ;
2628use OC_User ;
2729use OCA \User_SAML \DavPlugin ;
4749use OCP \IUserManager ;
4850use OCP \IUserSession ;
4951use OCP \L10N \IFactory ;
50- use OCP \SabrePluginEvent ;
51- use OCP \Server ;
5252use Psr \Container \ContainerInterface ;
5353use Psr \Log \LoggerInterface ;
5454use 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