From a1c75d5ab188968900800cfe6e9a712f05d9b592 Mon Sep 17 00:00:00 2001 From: dvasunin Date: Tue, 23 Apr 2024 11:05:46 +0300 Subject: [PATCH] fix: remove Insertion of sensitive information into log files; add logging the status code and url on error --- .../selfdescriptionfactory/config/DefaultFeignConfig.java | 2 ++ .../service/clearinghouse/ClearingHouse.java | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/config/DefaultFeignConfig.java b/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/config/DefaultFeignConfig.java index 370b2d49..1f62678a 100644 --- a/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/config/DefaultFeignConfig.java +++ b/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/config/DefaultFeignConfig.java @@ -70,6 +70,8 @@ public ErrorDecoder getErrorDecoder(ObjectMapper mapper) { .getOrElse(responseStr); var statusCode = HttpStatusCode.valueOf(response.status()); log.error("Error in Feign client: {}", msg); + log.error("Status code: {}", statusCode); + log.error("URL: {}", response.request().url()); if (response.request().body() != null) { log.error("Original payload: {}", new String(response.request().body(), response.request().charset())); } diff --git a/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/service/clearinghouse/ClearingHouse.java b/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/service/clearinghouse/ClearingHouse.java index f1d797e4..da8b1fd2 100644 --- a/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/service/clearinghouse/ClearingHouse.java +++ b/src/main/java/org/eclipse/tractusx/selfdescriptionfactory/service/clearinghouse/ClearingHouse.java @@ -27,7 +27,6 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.eclipse.tractusx.selfdescriptionfactory.config.TechnicalUsersDetails; -import org.eclipse.tractusx.selfdescriptionfactory.service.keycloak.KeycloakManager; import org.springframework.beans.factory.InitializingBean; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.core.env.Environment; @@ -41,7 +40,6 @@ @RequiredArgsConstructor public class ClearingHouse implements InitializingBean { - private final KeycloakManager keycloakManager; private final TechnicalUsersDetails technicalUsersDetails; private final ClearingHouseClient clearingHouseClient; private final ObjectMapper objectMapper = new ObjectMapper(); @@ -60,7 +58,6 @@ protected void debug(VerifiableCredential payload, String externalId) { var annotation = ClearingHouseClient.class.getAnnotation(FeignClient.class); var name = annotation.name(); Optional.ofNullable(technicalUsersDetails.getUsersDetails().get(name)).map(TechnicalUsersDetails.UserDetail::uri).ifPresent(uri -> log.debug("URL: {}", uri)); - Optional.of(name).map(keycloakManager::getToken).ifPresent(token -> log.debug("Authorization: {}", token)); log.debug("ExternalId: {}", externalId); log.debug("payload: {}", objectMapper.writeValueAsString(payload)); }