diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6da6c7b..3c12ae5e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ # Changelog All notable changes to this project will be documented in this file. +## 8.1.2 + +### Fixed + +* fix: Using user_saml at the same time as the guest application + ## 8.1.1 ### Fixed diff --git a/appinfo/info.xml b/appinfo/info.xml index fb47f1fad..fe8130a1a 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -21,7 +21,7 @@ The following providers are supported and tested at the moment: * Any other provider that authenticates using the environment variable While theoretically any other authentication provider implementing either one of those standards is compatible, we like to note that they are not part of any internal test matrix.]]> - 8.1.1 + 8.1.2 AGPL-3.0-or-later Lukas Reschke User_SAML diff --git a/lib/Controller/SAMLController.php b/lib/Controller/SAMLController.php index fd8d77bfd..41bc6e533 100644 --- a/lib/Controller/SAMLController.php +++ b/lib/Controller/SAMLController.php @@ -29,7 +29,6 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\Attribute\UseSession; use OCP\AppFramework\Services\IAppConfig; -use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; @@ -39,7 +38,6 @@ use OCP\Security\ICrypto; use OCP\Security\ITrustedDomainHelper; use OCP\Server; -use OCP\User\Events\UserLoggedInEvent; use OneLogin\Saml2\Auth; use OneLogin\Saml2\Error; use OneLogin\Saml2\Settings; @@ -68,7 +66,6 @@ public function __construct( private ICrypto $crypto, private ITrustedDomainHelper $trustedDomainHelper, private SessionService $sessionService, - private IEventDispatcher $eventDispatcher, ) { parent::__construct($appName, $request); } @@ -394,7 +391,6 @@ public function assertionConsumerService(): Http\RedirectResponse { if ($firstLogin) { $this->userBackend->initializeHomeDir($user->getUID()); } - $this->eventDispatcher->dispatchTyped(new UserLoggedInEvent($user, $user->getUID(), null, true)); } catch (NoUserFoundException $e) { throw new \InvalidArgumentException('User "' . $this->userBackend->getCurrentUserId() . '" is not valid.', previous: $e); } catch (Exception $e) { diff --git a/tests/unit/Controller/SAMLControllerTest.php b/tests/unit/Controller/SAMLControllerTest.php index a9100677e..fd2a3e143 100644 --- a/tests/unit/Controller/SAMLControllerTest.php +++ b/tests/unit/Controller/SAMLControllerTest.php @@ -19,7 +19,6 @@ use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IAppConfig; -use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; use OCP\IL10N; use OCP\IRequest; @@ -50,9 +49,8 @@ class SAMLControllerTest extends TestCase { private IL10N&MockObject $l; private ICrypto&MockObject $crypto; private SAMLController $samlController; - private ITrustedDomainHelper&MockObject $trustedDomainController; - private SessionService&MockObject $sessionService; - private IEventDispatcher&MockObject $eventDispatcher; + private ITrustedDomainHelper|MockObject $trustedDomainController; + private SessionService|MockObject $sessionService; #[Override] protected function setUp(): void { @@ -73,7 +71,6 @@ protected function setUp(): void { $this->crypto = $this->createMock(ICrypto::class); $this->trustedDomainController = $this->createMock(ITrustedDomainHelper::class); $this->sessionService = $this->createMock(SessionService::class); - $this->eventDispatcher = $this->createMock(IEventDispatcher::class); $this->l->expects($this->any())->method('t')->willReturnCallback( static fn (string $param): string => $param @@ -98,8 +95,7 @@ protected function setUp(): void { $this->userData, $this->crypto, $this->trustedDomainController, - $this->sessionService, - $this->eventDispatcher, + $this->sessionService ); } @@ -267,7 +263,6 @@ public function testLoginWithEnvVariable(array $samlUserData, string $redirect, if (isset($samlUserData['uid']) && !($userState === 0 && $autoProvision === 0)) { $user = $this->createMock(IUser::class); - $user->method('getUID')->willReturn('MyUid'); $im = $this->userResolver ->expects($this->once()) ->method('findExistingUser')