Skip to content

Commit

Permalink
Log header names
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 28, 2025
1 parent 123736e commit 520cf38
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package myconext.shibboleth;


import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import myconext.manage.Manage;
import myconext.model.User;
import myconext.repository.UserRepository;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
import org.springframework.util.StringUtils;

import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
Expand Down Expand Up @@ -52,6 +53,13 @@ public ShibbolethPreAuthenticatedProcessingFilter(AuthenticationManager authenti

@Override
protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) {
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null && !request.getRequestURI().endsWith("health") && !request.getRequestURI().endsWith("ico")) {
Collections.list(headerNames).forEach(s -> {
LOG.info(String.format("Header %s, value: %s", s, request.getHeader(s)));
});
}

String uid = getHeader(SHIB_UID, request);
String schacHomeOrganization = getHeader(SHIB_SCHAC_HOME_ORGANIZATION, request);
String email = getHeader(SHIB_EMAIL, request);
Expand Down

0 comments on commit 520cf38

Please sign in to comment.