From e43a4439a523a21210ae7fd4aea7de3a7e838250 Mon Sep 17 00:00:00 2001 From: tuutti Date: Wed, 20 Mar 2024 16:38:42 +0200 Subject: [PATCH 1/2] UHF-9857: Removed overridden ::authorize() method --- src/Plugin/OpenIDConnectClient/Tunnistamo.php | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/Plugin/OpenIDConnectClient/Tunnistamo.php b/src/Plugin/OpenIDConnectClient/Tunnistamo.php index ced5ba2..d8baa2c 100644 --- a/src/Plugin/OpenIDConnectClient/Tunnistamo.php +++ b/src/Plugin/OpenIDConnectClient/Tunnistamo.php @@ -113,34 +113,6 @@ protected function getRedirectUrl( return $urlEvent->getRedirectUrl(); } - /** - * {@inheritdoc} - */ - public function authorize(string $scope = 'openid email', array $additional_params = []): Response { - // @todo Remove this override once https://www.drupal.org/project/openid_connect/issues/3317308 - // is merged. - $redirect_uri = $this->getRedirectUrl()->toString(TRUE); - $url_options = $this->getUrlOptions($scope, $redirect_uri); - - if (!empty($additional_params)) { - $url_options['query'] = array_merge($url_options['query'], $additional_params); - } - - $endpoints = $this->getEndpoints(); - // Clear _GET['destination'] because we need to override it. - $this->requestStack->getCurrentRequest()->query->remove('destination'); - $authorization_endpoint = Url::fromUri($endpoints['authorization'], $url_options)->toString(TRUE); - - $this->loggerFactory->get('openid_connect_' . $this->pluginId)->debug('Send authorize request to @url', ['@url' => $authorization_endpoint->getGeneratedUrl()]); - $response = new TrustedRedirectResponse($authorization_endpoint->getGeneratedUrl()); - // We can't cache the response, since this will prevent the state to be - // added to the session. The kill switch will prevent the page getting - // cached for anonymous users when page cache is active. - $this->pageCacheKillSwitch->trigger(); - - return $response; - } - /** * {@inheritdoc} */ From 21e0eac88f751b13865c72e49920eb4988bb1998 Mon Sep 17 00:00:00 2001 From: tuutti Date: Thu, 21 Mar 2024 09:16:54 +0200 Subject: [PATCH 2/2] UHF-9857: PHPCS fixes --- helfi_tunnistamo.install | 2 +- helfi_tunnistamo.module | 2 +- src/Event/RedirectUrlEvent.php | 2 +- src/EventSubscriber/HttpExceptionSubscriber.php | 2 +- src/Plugin/DebugDataItem/Tunnistamo.php | 2 +- src/Plugin/OpenIDConnectClient/Tunnistamo.php | 2 -- tests/src/Functional/LoginFormTest.php | 2 +- tests/src/Kernel/HttpExceptionSubscriberTest.php | 2 +- tests/src/Kernel/KernelTestBase.php | 2 +- tests/src/Kernel/RedirectUrlEventTest.php | 2 +- tests/src/Kernel/RoleMapTest.php | 2 +- tests/src/Kernel/TunnistamoClientTest.php | 2 +- tests/src/Kernel/TunnistamoDebugDataPluginTest.php | 2 +- tests/src/Kernel/UserInfoAlterTest.php | 2 +- 14 files changed, 13 insertions(+), 15 deletions(-) diff --git a/helfi_tunnistamo.install b/helfi_tunnistamo.install index 6788dc1..c55253b 100644 --- a/helfi_tunnistamo.install +++ b/helfi_tunnistamo.install @@ -5,7 +5,7 @@ * Contains installation tasks for 'helfi_tunnistamo' module. */ -declare(strict_types = 1); +declare(strict_types=1); use Drupal\user\Entity\User; diff --git a/helfi_tunnistamo.module b/helfi_tunnistamo.module index 896d875..9dee38c 100644 --- a/helfi_tunnistamo.module +++ b/helfi_tunnistamo.module @@ -5,7 +5,7 @@ * Contains alterations for the Hel.fi tunnistamo module. */ -declare(strict_types = 1); +declare(strict_types=1); use Drupal\Component\Uuid\Uuid; use Drupal\Core\Form\FormStateInterface; diff --git a/src/Event/RedirectUrlEvent.php b/src/Event/RedirectUrlEvent.php index 86ae0b5..3e35c49 100644 --- a/src/Event/RedirectUrlEvent.php +++ b/src/Event/RedirectUrlEvent.php @@ -1,6 +1,6 @@