diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/core_common_webapp/src/main/java/at/asitplus/eidas/specific/core/logger/StatisticLogger.java | 20 |
1 files changed, 19 insertions, 1 deletions
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 22cace10..fd2be89b 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 @@ -31,6 +31,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.data.EaafConstants; 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,8 @@ public class StatisticLogger implements IStatisticLogger { protocolRequest.getSpEntityId(), protocolRequest.getRawData(MsEidasNodeConstants.DATA_REQUESTERID), protocolRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier(), + extractSpCountryCode(protocolRequest.getServiceProviderConfiguration() + .getAreaSpecificTargetIdentifier()), authData.getCiticenCountryCode(), extractMatchingState(protocolRequest.getRawData(MsEidasNodeConstants.DATA_MATCHING_STATE)), STATUS_SUCCESS, @@ -72,6 +75,7 @@ public class StatisticLogger implements IStatisticLogger { StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, + StringUtils.EMPTY, STATUS_ERROR, errorId, throwable.getMessage())); @@ -91,6 +95,8 @@ public class StatisticLogger implements IStatisticLogger { errorRequest.getSpEntityId(), errorRequest.getRawData(MsEidasNodeConstants.DATA_REQUESTERID), errorRequest.getServiceProviderConfiguration().getAreaSpecificTargetIdentifier(), + extractSpCountryCode(errorRequest.getServiceProviderConfiguration() + .getAreaSpecificTargetIdentifier()), StringUtils.EMPTY, extractMatchingState(errorRequest.getRawData(MsEidasNodeConstants.DATA_MATCHING_STATE)), STATUS_ERROR, @@ -104,6 +110,7 @@ public class StatisticLogger implements IStatisticLogger { StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, + StringUtils.EMPTY, STATUS_ERROR, errorId, throwable.getMessage())); @@ -117,13 +124,23 @@ public class StatisticLogger implements IStatisticLogger { } + private String extractSpCountryCode(String target) { + if (target.startsWith(EaafConstants.URN_PREFIX_EIDAS)) { + return target.split("\\+")[2]; + + } else { + return "AT"; + + } + } + private String extractMatchingState(Object state) { return state != null ? state.toString() : MsEidasNodeConstants.MatchingStates.NO_REQUIRED.toString(); } private String buildLogMessage(String transId, String entityId, Object requesterId, String target, - String cc, String matchingState, + String spCountry, String cc, String matchingState, String status, String errorCode, String errorMsg) { String logMsg = StringUtils.EMPTY; @@ -140,6 +157,7 @@ public class StatisticLogger implements IStatisticLogger { } logMsg += target + ","; + logMsg += spCountry + ","; logMsg += cc + ","; logMsg += matchingState + ","; |