aboutsummaryrefslogtreecommitdiff
path: root/ms_specific_connector/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'ms_specific_connector/src/main/java/at')
-rw-r--r--ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java
index 06fb1aba..b18ce89e 100644
--- a/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java
+++ b/ms_specific_connector/src/main/java/at/asitplus/eidas/specific/core/logger/AdvancedStatisticLogger.java
@@ -39,6 +39,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class AdvancedStatisticLogger implements IStatisticLogger {
+ private static final String SUCCES_CODE = "success.00";
+ private static final String SUCCES_MSG = "success";
+
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";
@@ -62,6 +65,8 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
public void logSuccessOperation(IRequest protocolRequest, IAuthData authData, boolean isSsoSession) {
final StatisticLogEntry entry = buildCoreEntry(protocolRequest);
entry.setSuccess(SuccessEntry.builder()
+ .statusCode(SUCCES_CODE)
+ .statusMessage(SUCCES_MSG)
.spSector(protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier())
.spCountry("AT")
.citizenCountryCode(authData.getCiticenCountryCode())
@@ -83,7 +88,14 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
@Override
public void logErrorOperation(Throwable throwable, IRequest errorRequest) {
final StatisticLogEntry entry = buildCoreEntry(errorRequest);
- entry.setError(new ErrorEntry(messageService.getResponseErrorCode(throwable), throwable.getMessage()));
+ entry.setSuccess(SuccessEntry.builder()
+ .statusCode(messageService.getResponseErrorCode(throwable))
+ .statusMessage(throwable.getMessage())
+ .spSector(errorRequest.getServiceProviderConfiguration() != null
+ ? errorRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier()
+ : "")
+ .spCountry("AT")
+ .build());
entry.setMatching(MatchingDetails.builder()
.matchingMethod(extractMatchingState(errorRequest))
.matchingDetails(extractMatchingDetails(errorRequest))
@@ -147,7 +159,7 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
@Getter
@Setter
@RequiredArgsConstructor
- @JsonInclude(Include.NON_NULL)
+ @JsonInclude(Include.ALWAYS)
private static class StatisticLogEntry {
@JsonSerialize(using = LocalDateTimeSerializer.class)
@@ -167,9 +179,6 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
@JsonProperty("result")
private SuccessEntry success;
-
- @JsonProperty("error")
- private ErrorEntry error;
@JsonProperty("identityMatching")
private MatchingDetails matching;
@@ -179,9 +188,15 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
@Getter
@Setter
@Builder
- @JsonInclude(Include.NON_NULL)
+ @JsonInclude(Include.ALWAYS)
private static class SuccessEntry {
+ @JsonProperty("code")
+ private final String statusCode;
+
+ @JsonProperty("msg")
+ private final String statusMessage;
+
@JsonProperty("spSector")
private final String spSector;
@@ -196,7 +211,7 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
@Getter
@Setter
@Builder
- @JsonInclude(Include.NON_NULL)
+ @JsonInclude(Include.ALWAYS)
private static class MatchingDetails {
@JsonProperty("finalMatchingMethod")
@@ -207,17 +222,4 @@ public class AdvancedStatisticLogger implements IStatisticLogger {
}
- @Getter
- @Setter
- @RequiredArgsConstructor
- private static class ErrorEntry {
-
- @JsonProperty("code")
- private final String errorCode;
-
- @JsonProperty("msg")
- private final String errorMessage;
-
- }
-
}