aboutsummaryrefslogtreecommitdiff
path: root/ms_specific_connector
diff options
context:
space:
mode:
authorThomas <>2023-03-23 17:24:53 +0100
committerThomas <>2023-06-05 17:05:35 +0200
commitd39f2b7b7b4e2fea2a5402c63c10d3ce83097129 (patch)
tree969204495c98ac53b6e43e6bc98b5b1184eef52d /ms_specific_connector
parentaf37413f909cd9a65c260d04e7921003336ed143 (diff)
downloadNational_eIDAS_Gateway-d39f2b7b7b4e2fea2a5402c63c10d3ce83097129.tar.gz
National_eIDAS_Gateway-d39f2b7b7b4e2fea2a5402c63c10d3ce83097129.tar.bz2
National_eIDAS_Gateway-d39f2b7b7b4e2fea2a5402c63c10d3ce83097129.zip
chore(core): update statistic logger as requested by the BM.I
Diffstat (limited to 'ms_specific_connector')
-rw-r--r--ms_specific_connector/pom.xml4
-rw-r--r--ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java (renamed from ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisicLogger.java)24
-rw-r--r--ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java4
3 files changed, 21 insertions, 11 deletions
diff --git a/ms_specific_connector/pom.xml b/ms_specific_connector/pom.xml
index 253768ca..b618e3d9 100644
--- a/ms_specific_connector/pom.xml
+++ b/ms_specific_connector/pom.xml
@@ -127,6 +127,10 @@
<artifactId>cxf-rt-transports-http</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-properties</artifactId>
+ </dependency>
<!-- Testing -->
<dependency>
diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisicLogger.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java
index cfa93286..06fb1aba 100644
--- a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisicLogger.java
+++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java
@@ -1,5 +1,6 @@
package at.asitplus.eidas.specific.core.logger;
+import java.io.IOException;
import java.time.LocalDateTime;
import org.apache.commons.lang3.StringUtils;
@@ -8,10 +9,10 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.javaprop.JavaPropsMapper;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
@@ -36,13 +37,14 @@ import lombok.extern.slf4j.Slf4j;
*
*/
@Slf4j
-public class AdvancedStatisicLogger implements IStatisticLogger {
+public class AdvancedStatisticLogger implements IStatisticLogger {
- private static final String DATEFORMATER = "yyyy.MM.dd-HH:mm:ss";
+ private static final String DATEFORMATER = "yyyy.MM.dd-HH:mm:ss,SSS";
private static final String DEFAULT_NO_IDP_ID = "no idpId available";
private static final String DEFAULT_NO_SP_ID = "no appId available";
private static final ObjectMapper mapper = new ObjectMapper();
+ private static final JavaPropsMapper propsMapper = new JavaPropsMapper();
private final IStatusMessenger messageService;
@@ -51,7 +53,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger {
*
* @param source i18n message source
*/
- public AdvancedStatisicLogger(IStatusMessenger source) {
+ public AdvancedStatisticLogger(IStatusMessenger source) {
this.messageService = source;
}
@@ -61,6 +63,7 @@ public class AdvancedStatisicLogger implements IStatisticLogger {
final StatisticLogEntry entry = buildCoreEntry(protocolRequest);
entry.setSuccess(SuccessEntry.builder()
.spSector(protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier())
+ .spCountry("AT")
.citizenCountryCode(authData.getCiticenCountryCode())
.build());
entry.setMatching(MatchingDetails.builder()
@@ -132,9 +135,9 @@ public class AdvancedStatisicLogger implements IStatisticLogger {
private void writeEntryToLog(StatisticLogEntry entry) {
try {
- log.info(mapper.writeValueAsString(entry));
+ log.info(mapper.writeValueAsString(propsMapper.writeValueAsProperties(entry)));
- } catch (final JsonProcessingException e) {
+ } catch (final IOException e) {
log.error("Can NOT generate statistic entry for logging", e);
}
@@ -162,13 +165,13 @@ public class AdvancedStatisicLogger implements IStatisticLogger {
@JsonProperty("unique-sp-id")
private final String uniqueId;
- @JsonProperty("success")
+ @JsonProperty("result")
private SuccessEntry success;
@JsonProperty("error")
private ErrorEntry error;
- @JsonProperty("idenityMatching")
+ @JsonProperty("identityMatching")
private MatchingDetails matching;
}
@@ -182,7 +185,10 @@ public class AdvancedStatisicLogger implements IStatisticLogger {
@JsonProperty("spSector")
private final String spSector;
- @JsonProperty("ccc")
+ @JsonProperty("spCountry")
+ private final String spCountry;
+
+ @JsonProperty("citizenCountryCode")
private final String citizenCountryCode;
}
diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java
index 008a5691..723da3ba 100644
--- a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java
+++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/MultipleStatisticLogger.java
@@ -23,7 +23,7 @@ public class MultipleStatisticLogger implements IStatisticLogger {
private final Set<IStatisticLogger> internalLoggers;
/**
- * Build a statistic logger that logs into {@link StatisticLogger} and {@link AdvancedStatisicLogger}.
+ * Build a statistic logger that logs into {@link StatisticLogger} and {@link AdvancedStatisticLogger}.
*
* @param messageService i18n message-source implementation.
*/
@@ -31,7 +31,7 @@ public class MultipleStatisticLogger implements IStatisticLogger {
internalLoggers = Collections.unmodifiableSet(
Sets.newHashSet(
new StatisticLogger(),
- new AdvancedStatisicLogger(messageService)));
+ new AdvancedStatisticLogger(messageService)));
}