From e3afbc7442ad3893e7615d50747c03f600eb1a1b Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 1 Jul 2022 16:41:00 +0200 Subject: feat(core): update statistic-logger to include matching results --- .../eidas/specific/core/logger/StatisticLogger.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'modules/core_common_webapp/src') diff --git a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java index bdaf83f6..c2c8d368 100644 --- a/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java +++ b/modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.IStatusMessenger; import at.gv.egiz.eaaf.core.api.idp.IAuthData; import at.gv.egiz.eaaf.core.api.logging.IStatisticLogger; import at.gv.egiz.eaaf.core.exceptions.EaafException; @@ -50,6 +51,7 @@ public class StatisticLogger implements IStatisticLogger { protocolRequest.getRawData(MsEidasNodeConstants.DATA_REQUESTERID), protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier(), authData.getCiticenCountryCode(), + extractMatchingState(protocolRequest.getRawData(MsEidasNodeConstants.DATA_MATCHING_STATE)), STATUS_SUCCESS, StringUtils.EMPTY, StringUtils.EMPTY)); @@ -58,7 +60,7 @@ public class StatisticLogger implements IStatisticLogger { @Override public void logErrorOperation(Throwable throwable) { - String errorId = "TODO"; + String errorId = IStatusMessenger.CODES_INTERNAL_ERROR_GENERIC; if (throwable instanceof EaafException) { errorId = ((EaafException) throwable).getErrorId(); } @@ -69,6 +71,7 @@ public class StatisticLogger implements IStatisticLogger { StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, + StringUtils.EMPTY, STATUS_ERROR, errorId, throwable.getMessage())); @@ -89,6 +92,7 @@ public class StatisticLogger implements IStatisticLogger { errorRequest.getRawData(MsEidasNodeConstants.DATA_REQUESTERID), errorRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier(), StringUtils.EMPTY, + extractMatchingState(errorRequest.getRawData(MsEidasNodeConstants.DATA_MATCHING_STATE)), STATUS_ERROR, errorId, throwable.getMessage())); @@ -99,6 +103,7 @@ public class StatisticLogger implements IStatisticLogger { StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, + StringUtils.EMPTY, STATUS_ERROR, errorId, throwable.getMessage())); @@ -112,8 +117,13 @@ public class StatisticLogger implements IStatisticLogger { } + private String extractMatchingState(Object state) { + return state != null ? state.toString() : MsEidasNodeConstants.MATCHING_STATES.NO_REQUIRED.toString(); + + } + private String buildLogMessage(String transId, String entityId, Object requesterId, String target, - String cc, + String cc, String matchingState, String status, String errorCode, String errorMsg) { String logMsg = StringUtils.EMPTY; @@ -131,7 +141,9 @@ public class StatisticLogger implements IStatisticLogger { logMsg += target + ","; logMsg += cc + ","; - + + logMsg += matchingState + ","; + logMsg += status + ","; logMsg += errorCode + ","; logMsg += errorMsg; -- cgit v1.2.3