From ad8f667803ce27b35b9b8dc409c94603ae9ff5b7 Mon Sep 17 00:00:00 2001 From: Joep de Jong Date: Wed, 12 Apr 2023 11:50:51 +0200 Subject: [PATCH 1/2] Logging --- .../ExceptionMappingAuthenticationFailureHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java b/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java index 493464a..d453b82 100644 --- a/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java +++ b/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java @@ -39,9 +39,9 @@ public void onAuthenticationFailure(HttpServletRequest request, HttpServletRespo AuthenticationException exception) throws IOException, ServletException { String url = failureUrlMap.get(exception.getClass().getName()); - logger.debug("Exception: " + exception.getClass().getName()); - logger.debug("Message: " + exception.getMessage()); - + logger.info("Exception: " + exception.getClass().getName()); + logger.info("Message: " + exception.getMessage()); + if (url != null) { if (isUseForward()) { logger.debug("Authentication failure, forwarding to " + url); From 2e3a4dec69628012ecba6fcf430bc9b3e72450f0 Mon Sep 17 00:00:00 2001 From: Joep de Jong Date: Wed, 12 Apr 2023 12:11:44 +0200 Subject: [PATCH 2/2] Remove logging --- .../wisv/connect/authentication/CHAuthenticationProvider.java | 4 ++-- .../ExceptionMappingAuthenticationFailureHandler.java | 3 --- .../java/ch/wisv/connect/services/CHUserDetailsService.java | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/ch/wisv/connect/authentication/CHAuthenticationProvider.java b/src/main/java/ch/wisv/connect/authentication/CHAuthenticationProvider.java index 57d8302..08bf559 100644 --- a/src/main/java/ch/wisv/connect/authentication/CHAuthenticationProvider.java +++ b/src/main/java/ch/wisv/connect/authentication/CHAuthenticationProvider.java @@ -63,8 +63,6 @@ public Authentication authenticate(Authentication authentication) throws Authent if (samlCredential.getRemoteEntityID().startsWith(SAML_GOOGLE_ENTITY_ID)) { log.info("Authenticated via Google SAML: email={}", samlCredential.getNameID().getValue()); - log.info("Remote entity ID: {}", samlCredential.getRemoteEntityID()); - log.info("SAML attributes: {}", attributes.stream().map(Attribute::getName).collect(Collectors.joining(", "))); CHUserDetails userDetails = userDetailService.loadUserByGoogleCredential(samlCredential); return CHAuthenticationToken.createAuthenticationToken(authentication, userDetails); } @@ -76,6 +74,8 @@ public Authentication authenticate(Authentication authentication) throws Authent String.format("%s=\"%s\"", n, samlCredential.getAttributeAsString(n))) .collect(Collectors.joining(" ")); log.info("Authenticated via SAML: netid={} {}", netid, attributesString); + } else { + log.info("Authenticated via SAML: netid={}", netid); } CHUserDetails userDetails; diff --git a/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java b/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java index d453b82..bff0dbe 100644 --- a/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java +++ b/src/main/java/ch/wisv/connect/authentication/ExceptionMappingAuthenticationFailureHandler.java @@ -39,9 +39,6 @@ public void onAuthenticationFailure(HttpServletRequest request, HttpServletRespo AuthenticationException exception) throws IOException, ServletException { String url = failureUrlMap.get(exception.getClass().getName()); - logger.info("Exception: " + exception.getClass().getName()); - logger.info("Message: " + exception.getMessage()); - if (url != null) { if (isUseForward()) { logger.debug("Authentication failure, forwarding to " + url); diff --git a/src/main/java/ch/wisv/connect/services/CHUserDetailsService.java b/src/main/java/ch/wisv/connect/services/CHUserDetailsService.java index a4cbd6e..4e318cc 100644 --- a/src/main/java/ch/wisv/connect/services/CHUserDetailsService.java +++ b/src/main/java/ch/wisv/connect/services/CHUserDetailsService.java @@ -214,9 +214,9 @@ private CHUserDetails createUserDetails(Person person, } String googleUsername = person.getGoogleUsername(); - System.out.println("googleUsername: " + googleUsername); Set googleGroups = Collections.emptySet(); if (StringUtils.isNotEmpty(googleUsername)) { + log.info("Retrieving Google groups for {}", googleUsername); googleGroups = dienst2Repository.getGoogleGroups(person.getId()); }