From 40e2aa80025083f017ae521704d853e4a4ac9267 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 13 Sep 2018 09:13:17 +0200 Subject: update RevisionLogger.java to make IP address logging optional --- .../specific/connector/logger/RevisionLogger.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/connector/src/main/java/at/asitplus/eidas/specific/connector/logger/RevisionLogger.java b/connector/src/main/java/at/asitplus/eidas/specific/connector/logger/RevisionLogger.java index 1d29d96b..22e31fa8 100644 --- a/connector/src/main/java/at/asitplus/eidas/specific/connector/logger/RevisionLogger.java +++ b/connector/src/main/java/at/asitplus/eidas/specific/connector/logger/RevisionLogger.java @@ -4,17 +4,23 @@ import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants; import at.gv.egiz.components.eventlog.api.Event; +import at.gv.egiz.components.eventlog.api.EventConstants; import at.gv.egiz.components.eventlog.api.EventLogFactory; import at.gv.egiz.components.eventlog.api.EventLoggingException; import at.gv.egiz.eaaf.core.api.IRequest; +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; import at.gv.egiz.eaaf.core.api.idp.ISPConfiguration; import at.gv.egiz.eaaf.core.api.logging.IRevisionLogger; public class RevisionLogger extends EventLogFactory implements IRevisionLogger { private static final Logger log = LoggerFactory.getLogger(RevisionLogger.class); - + + @Autowired private IConfiguration basicConfig; + @Override public void logEvent(ISPConfiguration oaConfig, int eventCode, String message) { logEvent(createNewEvent(new Date().getTime(), eventCode, message)); @@ -55,9 +61,18 @@ public class RevisionLogger extends EventLogFactory implements IRevisionLogger { private void logEvent(Event event) { try { - if (event.getEventCode() >= 1100) + if (event.getEventCode() >= 1100) { + if ( (event.getEventCode() == EventConstants.TRANSACTION_IP) + && !basicConfig.getBasicMOAIDConfigurationBoolean( + MSeIDASNodeConstants.PROP_CONFIG_REVISIONLOG_LOG_IP_ADDRESS_OF_USER, true) ) { + log.trace("Ignore Event: " + event.getEventCode() + " because IP adresse logging prohibited"); + return; + + } + getEventLog().logEvent(event); - else + + } else log.trace("Ignore Event: " + event.getEventCode() + " because session functionallity is not implemented"); } catch (EventLoggingException e) { -- cgit v1.2.3