From 1e6a8b4a634ff5c6cb1d88df0fdf8ad7c3078866 Mon Sep 17 00:00:00 2001 From: Antonio Cerciello Date: Sat, 12 Oct 2024 22:53:19 +0200 Subject: [PATCH] Error print --- ...nIdOAuth2AuthorizationRequestResolver.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/fao/geonet/kernel/security/openidconnect/HardcodedRegistrationIdOAuth2AuthorizationRequestResolver.java b/core/src/main/java/org/fao/geonet/kernel/security/openidconnect/HardcodedRegistrationIdOAuth2AuthorizationRequestResolver.java index 818f5409941..bfd9c5ef845 100644 --- a/core/src/main/java/org/fao/geonet/kernel/security/openidconnect/HardcodedRegistrationIdOAuth2AuthorizationRequestResolver.java +++ b/core/src/main/java/org/fao/geonet/kernel/security/openidconnect/HardcodedRegistrationIdOAuth2AuthorizationRequestResolver.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletRequestWrapper; import static org.fao.geonet.kernel.security.openidconnect.GeonetworkClientRegistrationProvider.CLIENTREGISTRATION_NAME; - +import java.util.Map; /** * This is to make things work well in Geonetwork. * Spring's oauth allows for multiple oauth providers - and the /signin/... path would normally indicate which one @@ -83,7 +83,14 @@ public String getParameter(String name) { } }; try { - return wrappedResolver.resolve(wrappedRequest, CLIENTREGISTRATION_NAME); + OAuth2AuthorizationRequest out = wrappedResolver.resolve(wrappedRequest, CLIENTREGISTRATION_NAME); + System.out.printf("DEBUG HOME MADE clientid %s!", out.getClientId()); + for (Map.Entry entry : out.getAttributes().entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + System.out.println("DEBUG HOME MADE Key: " + key + ", Value: " + (value != null ? value.toString() : "null")); + } + return out; } catch (Exception e) { e.printStackTrace(); throw e; @@ -109,7 +116,14 @@ public String getParameter(String name) { } }; try { - return wrappedResolver.resolve(wrappedRequest, CLIENTREGISTRATION_NAME); + OAuth2AuthorizationRequest out = wrappedResolver.resolve(wrappedRequest, CLIENTREGISTRATION_NAME); + System.out.printf("DEBUG HOME MADE clientid %s!", out.getClientId()); + for (Map.Entry entry : out.getAttributes().entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + System.out.println("DEBUG HOME MADE Key: " + key + ", Value: " + (value != null ? value.toString() : "null")); + } + return out; } catch (Exception e) { e.printStackTrace(); throw e;