From 2e67bfacc4c1827bcdc37eac04a2a8d870ee20cd Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 23 Jul 2015 13:07:22 +0200 Subject: update revisions-log functionality --- .../stork/tasks/CreateStorkAuthRequestFormTask.java | 16 ++++++++++++---- .../tasks/PepsConnectorHandleLocalSignResponseTask.java | 9 +++++++++ .../id/auth/modules/stork/tasks/PepsConnectorTask.java | 11 ++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) (limited to 'id/server/modules/module-stork') diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java index 32915f5e6..06dfc95d3 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/CreateStorkAuthRequestFormTask.java @@ -62,7 +62,9 @@ import at.gv.egovernment.moa.id.config.stork.STORKConfig; import at.gv.egovernment.moa.id.config.stork.StorkAttribute; import at.gv.egovernment.moa.id.advancedlogging.MOAIDEventConstants; +import at.gv.egovernment.moa.id.advancedlogging.MOAIDEventLog; import at.gv.egovernment.moa.id.advancedlogging.MOAReversionLogger; +import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.moduls.RequestStorage; import at.gv.egovernment.moa.id.process.api.ExecutionContext; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; @@ -123,11 +125,15 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { } AuthenticationSession moasession = AuthenticationServer.getSession(sessionID); pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(sessionID); - + IRequest pendingReq = RequestStorage.getPendingRequest(pendingRequestID); + if (StringUtils.isEmpty(moasession.getCcc())) { // illegal state; task should not have been executed without a selected country throw new AuthenticationException("stork.22", new Object[] { sessionID }); + } + MOAReversionLogger.getInstance().logEvent(pendingReq, MOAIDEventConstants.AUTHPROCESS_STORK_REQUESTED); + STORKConfig storkConfig = AuthConfigurationProviderFactory.getInstance().getStorkConfig(); if (!storkConfig.isSTORKAuthentication(moasession.getCcc())) { throw new AuthenticationException("stork.23", new Object[] { moasession.getCcc(), sessionID }); @@ -140,7 +146,7 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { executionContext.put(PROCESS_CTX_KEY_CPEPS_ISXMLSIGSUPPORTED, cpeps.isXMLSignatureSupported()); Logger.info("Starting STORK authentication for a citizen of country: " + moasession.getCcc()); - startSTORKAuthentication(req, resp, moasession); + startSTORKAuthentication(req, resp, moasession, pendingReq); } catch (MOAIDException ex) { throw new TaskExecutionException(ex.getMessage(), ex); @@ -161,6 +167,7 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { * * @param req HttpServletRequest * @param resp HttpServletResponse + * @param pendingReq * @param ccc Citizen country code * @param oaURL URL of the online application * @param target Target parameter @@ -175,7 +182,7 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { public void startSTORKAuthentication( HttpServletRequest req, HttpServletResponse resp, - AuthenticationSession moasession) throws MOAIDException, AuthenticationException, WrongParametersException, ConfigurationException { + AuthenticationSession moasession, IRequest pendingReq) throws MOAIDException, AuthenticationException, WrongParametersException, ConfigurationException { if (moasession == null) { throw new AuthenticationException("auth.18", new Object[]{}); @@ -378,7 +385,8 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { } Logger.info("STORK AuthnRequest successfully successfully prepared for client with target location: " + authnRequest.getDestination()); - + MOAReversionLogger.getInstance().logEvent(pendingReq, MOAIDEventConstants.AUTHPROCESS_PEPS_REQUESTED, authnRequest.getDestination()); + // do PEPS-conform logging for easier evaluation try { // 2015-03-12 16:44:27.144#S-PEPS generates request to C-PEPS#spepsurl#cpepsurl#spapp#spdomain#citizen country#qaa#msghash#msg_id id1#id2# diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java index 10eeea97a..a631489be 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleLocalSignResponseTask.java @@ -17,6 +17,8 @@ import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; +import at.gv.egovernment.moa.id.advancedlogging.MOAIDEventConstants; +import at.gv.egovernment.moa.id.advancedlogging.MOAReversionLogger; import at.gv.egovernment.moa.id.auth.AuthenticationServer; import at.gv.egovernment.moa.id.auth.builder.DataURLBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; @@ -25,7 +27,9 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.auth.stork.STORKException; +import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.moduls.ModulUtils; +import at.gv.egovernment.moa.id.moduls.RequestStorage; import at.gv.egovernment.moa.id.process.api.ExecutionContext; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; import at.gv.egovernment.moa.id.util.VelocityProvider; @@ -113,6 +117,8 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec moaSessionID = AuthenticationSessionStoreage.changeSessionID(moaSession); pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(moaSessionID); + IRequest pendingReq = RequestStorage.getPendingRequest(pendingRequestID); + Logger.info("pendingRequestID:" + pendingRequestID); String signResponseString = new String(Base64Utils.decode(signResponse, false), "UTF8"); Logger.info("RECEIVED signresponse:" + signResponseString); @@ -183,6 +189,9 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec Logger.debug("Add full STORK AuthnResponse to MOA session"); moaSession.setStorkAuthnResponse(request.getParameter("SAMLResponse"));// TODO ask Florian/Thomas // authnResponse? + + MOAReversionLogger.getInstance().logEvent(pendingReq, MOAIDEventConstants.AUTHPROCESS_PEPS_RECEIVED); + moaSession.setForeigner(true); // session is implicit stored in changeSessionID!!!! diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java index fa1b0472c..01dad4ebb 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorTask.java @@ -33,6 +33,8 @@ import org.opensaml.saml2.core.StatusCode; import org.w3c.dom.Element; import org.w3c.dom.Node; +import at.gv.egovernment.moa.id.advancedlogging.MOAIDEventConstants; +import at.gv.egovernment.moa.id.advancedlogging.MOAReversionLogger; import at.gv.egovernment.moa.id.auth.AuthenticationServer; import at.gv.egovernment.moa.id.auth.builder.DataURLBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; @@ -48,7 +50,9 @@ import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; import at.gv.egovernment.moa.id.config.auth.AuthConfiguration; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProviderFactory; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; +import at.gv.egovernment.moa.id.moduls.IRequest; import at.gv.egovernment.moa.id.moduls.ModulUtils; +import at.gv.egovernment.moa.id.moduls.RequestStorage; import at.gv.egovernment.moa.id.process.api.ExecutionContext; import at.gv.egovernment.moa.id.protocols.pvp2x.PVPConstants; import at.gv.egovernment.moa.id.storage.AuthenticationSessionStoreage; @@ -218,7 +222,8 @@ public class PepsConnectorTask extends AbstractAuthServletTask { // throw new WrongParametersException("VerifyAuthenticationBlock", PARAM_SESSIONID, "auth.12"); pendingRequestID = AuthenticationSessionStoreage.getPendingRequestID(moaSessionID); - + IRequest pendingReq = RequestStorage.getPendingRequest(pendingRequestID); + // load MOASession from database AuthenticationSession moaSession = AuthenticationServer.getSession(moaSessionID); // change MOASessionID @@ -340,6 +345,8 @@ public class PepsConnectorTask extends AbstractAuthServletTask { // //////////////////////////////////////////////////////////////////////// + MOAReversionLogger.getInstance().logEvent(pendingReq, MOAIDEventConstants.AUTHPROCESS_PEPS_RECEIVED); + AuthConfiguration config = AuthConfigurationProviderFactory.getInstance(); String citizenSignature = null; if(config.isStorkFakeIdLActive() && config.getStorkNoSignatureCountries().contains(storkAuthnRequest.getCitizenCountryCode()) && config.getStorkFakeIdLCountries().contains(storkAuthnRequest.getCitizenCountryCode())) { @@ -558,6 +565,8 @@ public class PepsConnectorTask extends AbstractAuthServletTask { Logger.error("SZR Gateway did not return an identity link."); throw new MOAIDException("stork.10", null); } + + MOAReversionLogger.getInstance().logEvent(pendingReq, MOAIDEventConstants.AUTHPROCESS_PEPS_IDL_RECEIVED); moaSession.setForeigner(true); Logger.info("Received Identity Link from SZR Gateway"); -- cgit v1.2.3