diff --git a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/GeodeAuthenticationProvider.java b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/GeodeAuthenticationProvider.java
index e61bf931a7e1..a5e562e8676b 100644
--- a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/GeodeAuthenticationProvider.java
+++ b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/GeodeAuthenticationProvider.java
@@ -74,18 +74,6 @@
*
*
*
- * Debug Logging Enhancements:
- *
- *
- * - Added comprehensive logging throughout authentication process for troubleshooting
- * - Logs authentication mode (token vs username/password)
- * - Logs credential extraction and SecurityService interaction
- * - Logs success/failure outcomes with error details
- * - Logs servlet context initialization (SecurityService and authTokenEnabled flag
- * retrieval)
- *
- *
- *
* ServletContextAware Implementation:
*
*
@@ -109,25 +97,17 @@ public SecurityService getSecurityService() {
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
- logger.info("authenticate() called - principal: {}, credentials type: {}, authTokenEnabled: {}",
- authentication.getName(),
- authentication.getCredentials() != null
- ? authentication.getCredentials().getClass().getSimpleName() : "null",
- authTokenEnabled);
-
Properties credentials = new Properties();
String username = authentication.getName();
String password = authentication.getCredentials().toString();
- logger.info("Extracted - username: {}, password: {}", username, password);
-
if (authTokenEnabled) {
- logger.info("Auth token mode - setting TOKEN property with value: {}", password);
+ logger.debug("Authenticating with a token.");
if (password != null) {
credentials.setProperty(ResourceConstants.TOKEN, password);
}
} else {
- logger.info("Username/password mode - setting USER_NAME and PASSWORD properties");
+ logger.debug("Authenticating with a user name and password.");
if (username != null) {
credentials.put(ResourceConstants.USER_NAME, username);
}
@@ -136,14 +116,12 @@ public Authentication authenticate(Authentication authentication) throws Authent
}
}
- logger.info("Calling securityService.login() with credentials: {}", credentials);
try {
securityService.login(credentials);
- logger.info("Login successful - creating UsernamePasswordAuthenticationToken");
return new UsernamePasswordAuthenticationToken(username, password,
AuthorityUtils.NO_AUTHORITIES);
} catch (GemFireSecurityException e) {
- logger.error("Login failed with GemFireSecurityException: {}", e.getMessage(), e);
+ logger.debug("Authentication was not successful.", e);
throw new BadCredentialsException(e.getLocalizedMessage(), e);
}
}
@@ -159,14 +137,11 @@ public boolean isAuthTokenEnabled() {
@Override
public void setServletContext(ServletContext servletContext) {
- logger.info("setServletContext() called");
-
securityService = (SecurityService) servletContext
.getAttribute(HttpService.SECURITY_SERVICE_SERVLET_CONTEXT_PARAM);
- logger.info("SecurityService from servlet context: {}", securityService);
authTokenEnabled =
(Boolean) servletContext.getAttribute(HttpService.AUTH_TOKEN_ENABLED_PARAM);
- logger.info("authTokenEnabled from servlet context: {}", authTokenEnabled);
+ logger.debug("Authentication token mode enabled: {}", authTokenEnabled);
}
}
diff --git a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/JwtAuthenticationFilter.java b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/JwtAuthenticationFilter.java
index 78d335a297d1..10b267fd12d4 100644
--- a/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/JwtAuthenticationFilter.java
+++ b/geode-web-management/src/main/java/org/apache/geode/management/internal/rest/security/JwtAuthenticationFilter.java
@@ -70,32 +70,19 @@
* properly
* log authentication failures. This helps diagnose JWT authentication issues in production.
*
- *
- *
- * Debug Logging:
- *
- *
- * - Added comprehensive logging throughout authentication flow for troubleshooting
- * - Logs: filter initialization, authentication requirements check, token parsing, authentication
- * attempts, success/failure outcomes
- *
*/
public class JwtAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
private static final Logger logger = LogManager.getLogger();
public JwtAuthenticationFilter() {
super("/**");
- logger.info("JwtAuthenticationFilter initialized");
}
@Override
protected boolean requiresAuthentication(HttpServletRequest request,
HttpServletResponse response) {
String header = request.getHeader("Authorization");
- boolean requires = header != null && header.startsWith("Bearer ");
- logger.info("requiresAuthentication() - URI: {}, Authorization header: {}, requires: {}",
- request.getRequestURI(), header, requires);
- return requires;
+ return header != null && header.startsWith("Bearer ");
}
@Override
@@ -103,33 +90,24 @@ public Authentication attemptAuthentication(HttpServletRequest request,
HttpServletResponse response) throws AuthenticationException {
String header = request.getHeader("Authorization");
- logger.info("attemptAuthentication() - URI: {}, Authorization header: {}",
- request.getRequestURI(), header);
if (header == null || !header.startsWith("Bearer ")) {
- logger.error("No JWT token found - header: {}", header);
- throw new BadCredentialsException("No JWT token found in request headers, header: " + header);
+ throw new BadCredentialsException("No JWT token found in request headers");
}
String[] tokens = header.split(" ", 2);
- logger.info("Split token - length: {}, token[0]: {}, token[1]: {}",
- tokens.length, tokens[0], tokens.length > 1 ? tokens[1] : "N/A");
if (tokens.length != 2) {
- logger.error("Wrong authentication header format: {}", header);
- throw new BadCredentialsException("Wrong authentication header format: " + header);
+ throw new BadCredentialsException("Wrong authentication header format");
}
// FIX: Pass the token as credentials (password), not "Bearer" as username
// GeodeAuthenticationProvider expects the token in the credentials/password field
UsernamePasswordAuthenticationToken authToken =
new UsernamePasswordAuthenticationToken(tokens[1], tokens[1]);
- logger.info("Created UsernamePasswordAuthenticationToken - principal: {}, credentials: {}",
- authToken.getPrincipal(), authToken.getCredentials());
// CRITICAL: Call AuthenticationManager to actually authenticate the token
// AbstractAuthenticationProcessingFilter expects us to return an authenticated token
- logger.info("Calling getAuthenticationManager().authenticate()");
return getAuthenticationManager().authenticate(authToken);
}
@@ -137,8 +115,6 @@ public Authentication attemptAuthentication(HttpServletRequest request,
protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
FilterChain chain, Authentication authResult)
throws IOException, ServletException {
- logger.info("successfulAuthentication() - authResult: {}, principal: {}",
- authResult, authResult != null ? authResult.getPrincipal() : "null");
super.successfulAuthentication(request, response, chain, authResult);
// As this authentication is in HTTP header, after success we need to continue the request
@@ -150,8 +126,7 @@ protected void successfulAuthentication(HttpServletRequest request, HttpServletR
protected void unsuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response, AuthenticationException failed)
throws IOException, ServletException {
- logger.error("unsuccessfulAuthentication() - URI: {}, exception: {}",
- request.getRequestURI(), failed.getMessage(), failed);
+ logger.debug("Authentication was not successful for {}.", request.getRequestURI(), failed);
super.unsuccessfulAuthentication(request, response, failed);
}
}