From 251944d01396502f977391d0defa0a5608a0c96d Mon Sep 17 00:00:00 2001 From: Julien Sabatier Date: Fri, 13 Sep 2024 14:43:36 +0200 Subject: [PATCH 1/2] Direct redirect if single oauth2 provider --- .../gateway/app/GeorchestraGatewayApplication.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java b/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java index 555f90d1..04359a82 100644 --- a/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java +++ b/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java @@ -121,6 +121,11 @@ public String loginPage(@RequestParam Map allRequestParams, Mode oauth2LoginLinks.put("/oauth2/authorization/" + k, clientName); }); } + + if (oauth2LoginLinks.size() == 1) { + return "redirect:"+oauth2LoginLinks.keySet().stream().findFirst().get(); + } + mdl.addAttribute("header_enabled", headerEnabled); mdl.addAttribute("header_script", headerScript); mdl.addAttribute("ldapEnabled", ldapEnabled); From e4ee6fd654d940ce5aee17bd29c6ab3af5cacaf7 Mon Sep 17 00:00:00 2001 From: Julien Sabatier Date: Fri, 13 Sep 2024 15:00:45 +0200 Subject: [PATCH 2/2] Redirect only if ldapEnabled is false --- .../georchestra/gateway/app/GeorchestraGatewayApplication.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java b/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java index 04359a82..1088db1f 100644 --- a/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java +++ b/gateway/src/main/java/org/georchestra/gateway/app/GeorchestraGatewayApplication.java @@ -122,7 +122,7 @@ public String loginPage(@RequestParam Map allRequestParams, Mode }); } - if (oauth2LoginLinks.size() == 1) { + if (oauth2LoginLinks.size() == 1 && !ldapEnabled ) { return "redirect:"+oauth2LoginLinks.keySet().stream().findFirst().get(); }