diff --git a/build.gradle b/build.gradle index e6eee89..f14d023 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = 'com.flexcodelabs' -version = '0.0.27' +version = '0.0.28' description = 'Flextuma App' java { diff --git a/src/main/java/com/flexcodelabs/flextuma/core/config/RequestLoggingFilter.java b/src/main/java/com/flexcodelabs/flextuma/core/config/RequestLoggingFilter.java index 5f9f756..be380f6 100644 --- a/src/main/java/com/flexcodelabs/flextuma/core/config/RequestLoggingFilter.java +++ b/src/main/java/com/flexcodelabs/flextuma/core/config/RequestLoggingFilter.java @@ -99,12 +99,14 @@ private String getUsername() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); // Debug logging to understand the authentication context + log.debug("Authentication found: {}", auth != null); if (auth != null) { log.debug("Auth class: {}", auth.getClass().getSimpleName()); log.debug("Auth authenticated: {}", auth.isAuthenticated()); log.debug("Auth principal: {}", auth.getPrincipal()); log.debug("Auth name: {}", auth.getName()); log.debug("Auth details: {}", auth.getDetails()); + log.debug("Auth authorities: {}", auth.getAuthorities()); } else { log.debug("Authentication is null"); } @@ -113,6 +115,7 @@ private String getUsername() { String username = auth.getName(); // Don't return "SYSTEM" for actual authenticated users if (username != null && !username.trim().isEmpty() && !"SYSTEM".equalsIgnoreCase(username)) { + log.debug("Returning username: {}", username); return username; } } @@ -126,11 +129,11 @@ private String getUsername() { } } + log.debug("Returning SYSTEM as fallback"); return "SYSTEM"; } private HttpServletRequest getCurrentRequest() { - // Try to get current request from RequestContextHolder try { org.springframework.web.context.request.RequestAttributes attrs = org.springframework.web.context.request.RequestContextHolder .getRequestAttributes(); @@ -138,7 +141,7 @@ private HttpServletRequest getCurrentRequest() { return servletRequestAttributes.getRequest(); } } catch (Exception e) { - // Ignore - can't get current request + log.debug("❌❌❌❌ [RequestLoggingFilter] Could not get current request: {} ❌❌❌❌", e.getMessage()); } return null; } diff --git a/src/main/java/com/flexcodelabs/flextuma/core/entities/metadata/AbstractMetadataEntity.java b/src/main/java/com/flexcodelabs/flextuma/core/entities/metadata/AbstractMetadataEntity.java index 8c51c2e..8cca0a2 100644 --- a/src/main/java/com/flexcodelabs/flextuma/core/entities/metadata/AbstractMetadataEntity.java +++ b/src/main/java/com/flexcodelabs/flextuma/core/entities/metadata/AbstractMetadataEntity.java @@ -1,5 +1,6 @@ package com.flexcodelabs.flextuma.core.entities.metadata; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.flexcodelabs.flextuma.core.entities.base.Owner; import com.flexcodelabs.flextuma.core.entities.contact.Contact; @@ -23,6 +24,7 @@ public abstract class AbstractMetadataEntity extends Owner { private String description; @ManyToMany + @JsonIgnore @JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" }) private List contacts = new ArrayList<>(); } \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 44cdcea..190222a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -11,6 +11,7 @@ spring.devtools.restart.enabled=true # Enable INFO logging to see startup and seeding logging.level.com.flexcodelabs.flextuma=INFO logging.level.org.springframework.boot.autoconfigure=INFO +logging.level.com.flexcodelabs.flextuma.core.config.RequestLoggingFilter=DEBUG spring.data.redis.host=${REDIS_HOST:redis} spring.data.redis.port=${REDIS_PORT:6379}