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 @@ 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} */ diff --git a/tests/src/Functional/LoginFormTest.php b/tests/src/Functional/LoginFormTest.php index 2d41fc3..683a13f 100644 --- a/tests/src/Functional/LoginFormTest.php +++ b/tests/src/Functional/LoginFormTest.php @@ -1,6 +1,6 @@