From 5ce285aff585338e397c6d76c7c98ad472ea8812 Mon Sep 17 00:00:00 2001
From: Francisco Barros <francisco.borges.aurindo.barros@cern.ch>
Date: Mon, 12 Jul 2021 18:41:30 +0200
Subject: [PATCH] new patch test

---
 composer.json               |  4 +++-
 patches/new_autologin.patch | 31 +++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 patches/new_autologin.patch

diff --git a/composer.json b/composer.json
index 91bc0ed85..05c540154 100644
--- a/composer.json
+++ b/composer.json
@@ -361,7 +361,9 @@
       },
       "drupal/openid_connect": {
         "OIDC roles mapping from JWT https://www.drupal.org/project/openid_connect/issues/3166508": "patches/openid_connect-3166508-role-mapping.patch",
-        "OIDC autologin (skip Drupal login page) https://www.drupal.org/project/openid_connect/issues/3011413": "patches/openid_connect-3011413-autologin.patch"
+        "OIDC autologin (skip Drupal login page) https://www.drupal.org/project/openid_connect/issues/3011413": "patches/openid_connect-3011413-autologin.patch",
+        "OIDC redirect URL after login": "patches/openid_connect-redirect-url.2921477-25.patch",
+        "OIDC repatch ": "patches/new_autologin.patch"
       },
       "__comments__": {
       }
diff --git a/patches/new_autologin.patch b/patches/new_autologin.patch
new file mode 100644
index 000000000..44ae6a253
--- /dev/null
+++ b/patches/new_autologin.patch
@@ -0,0 +1,31 @@
+--- openid_connect_orig/src/EventSubscriber/OpenIDConnectAutoLogin.php  2021-07-12 17:35:12.000000001 +0200
++++ openid_connect/src/EventSubscriber/OpenIDConnectAutoLogin.php       2021-07-12 18:12:14.000000001 +0200
+@@ -91,17 +91,21 @@
+    */
+   public function login(GetResponseEvent $event) {
+     // Get current request.
++    Drupal::logger('oidc_debug')->warning("Starting Login AutoLogin...");
+     $request = $event->getRequest();
+     // Check if user is anonymous and login or register page was requested.
+     if ($this->isAutostartEnabled() && $this->currentUser->isAnonymous() && $this->isLoginRequested($request)) {
++      Drupal::logger('oidc_debug')->warning("Login Autologin, user anonymous and login is requested");
+       // If there is no login errors and login process is not in progress
+       // and openid_connect_bypass is not provided, then start login process.
+       if (!$this->hasErrors() && !$this->bypassAutoLogin($request)) {
++        Drupal::logger('oidc_debug')->warning("Login Autologin, no errors and no bypassAutoLogin");
+         // Start OpenID Connect login process.
+         Drupal::service('openid_connect.session')->saveDestination();
+         $_SESSION['openid_connect_op'] = 'login';
+         $client = $this->getClient();
+         if ($client) {
++          Drupal::logger('oidc_debug')->warning("Login Autologin, client exists");
+           $response = $client->authorize();
+           // Redirect to given response.
+           $event->setResponse($response);
+@@ -229,6 +233,7 @@
+    *   TRUE if regular Drupal login process should start, FALSE otherwise.
+    */
+   protected function bypassAutoLogin(Request $request) {
++    Drupal::logger('oidc_debug')->warning("bypassAutoLogin : " . $request->query->has('showcore'));
+     return $request->query->has('showcore');
+   }
-- 
GitLab