From bc41be7e1478e4b213c0357135a24572fce5f21d Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 20 Apr 2015 13:52:25 +0200 Subject: update STORK authentication module --- .../modules/stork/tasks/CreateStorkAuthRequestFormTask.java | 8 +++++--- .../tasks/PepsConnectorHandleLocalSignResponseTask.java | 12 +++++++----- .../PepsConnectorHandleResponseWithoutSignatureTask.java | 12 +++++++----- .../moa/id/auth/modules/stork/tasks/PepsConnectorTask.java | 8 +++++--- 4 files changed, 24 insertions(+), 16 deletions(-) (limited to 'id') 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 f8cc17b93..021ee62cf 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 @@ -15,6 +15,7 @@ import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.exception.WrongParametersException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; +import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider; import at.gv.egovernment.moa.id.config.stork.CPEPS; @@ -63,7 +64,7 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { @Override public void execute(ExecutionContext executionContext, HttpServletRequest req, HttpServletResponse resp) - throws Exception { + throws TaskExecutionException { String pendingRequestID = null; String sessionID = null; @@ -97,11 +98,12 @@ public class CreateStorkAuthRequestFormTask extends AbstractAuthServletTask { AuthenticationServer.startSTORKAuthentication(req, resp, moasession); } catch (MOAIDException ex) { - handleError(null, ex, req, resp, pendingRequestID); + throw new TaskExecutionException(ex.getMessage(), ex); } catch (Exception e) { Logger.error("CreateStorkAuthRequestFormTask has an interal Error.", e); - throw new MOAIDException("Internal error.", new Object[] { sessionID }, e); + throw new TaskExecutionException("CreateStorkAuthRequestFormTask has an interal Error.", e); + } finally { 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 077bb2dee..1ae66f24e 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 @@ -22,6 +22,7 @@ import at.gv.egovernment.moa.id.auth.builder.DataURLBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; 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.commons.db.ConfigurationDBUtils; import at.gv.egovernment.moa.id.moduls.ModulUtils; @@ -79,7 +80,7 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec @Override public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws TaskExecutionException { String moaSessionID = request.getParameter("moaSessionID"); String signResponse = request.getParameter("signresponse"); Logger.info("moaSessionID:" + moaSessionID); @@ -90,13 +91,13 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec handleSignResponse(executionContext, request, response); } else { // should not occur - throw new IOException("should not occur"); + throw new TaskExecutionException("Parsing mulitpart/form-data request parameters failed", null); } return; } private void handleSignResponse(ExecutionContext executionContext, HttpServletRequest request, - HttpServletResponse response) { + HttpServletResponse response) throws TaskExecutionException { Logger.info("handleSignResponse started"); String moaSessionID = request.getParameter("moaSessionID"); String signResponse = request.getParameter("signresponse"); @@ -199,13 +200,14 @@ public class PepsConnectorHandleLocalSignResponseTask extends AbstractPepsConnec Logger.info("REDIRECT TO: " + redirectURL); } catch (AuthenticationException e) { - handleError(null, e, request, response, pendingRequestID); + throw new TaskExecutionException(e.getMessage(), e); } catch (MOAIDException e) { - handleError(null, e, request, response, pendingRequestID); + throw new TaskExecutionException(e.getMessage(), e); } catch (Exception e) { Logger.error("PEPSConnector has an interal Error.", e); + throw new TaskExecutionException(e.getMessage(), e); } finally { diff --git a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java index e2c3880ac..08da21460 100644 --- a/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java +++ b/id/server/modules/module-stork/src/main/java/at/gv/egovernment/moa/id/auth/modules/stork/tasks/PepsConnectorHandleResponseWithoutSignatureTask.java @@ -25,6 +25,7 @@ import at.gv.egovernment.moa.id.auth.builder.DataURLBuilder; import at.gv.egovernment.moa.id.auth.data.AuthenticationSession; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; 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.servlet.PEPSConnectorWithLocalSigningServlet; import at.gv.egovernment.moa.id.auth.stork.STORKException; import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor; @@ -83,7 +84,7 @@ public class PepsConnectorHandleResponseWithoutSignatureTask extends AbstractPep @Override public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws TaskExecutionException { String moaSessionID = request.getParameter("moaSessionID"); String signResponse = request.getParameter("signresponse"); Logger.info("moaSessionID:" + moaSessionID); @@ -95,13 +96,13 @@ public class PepsConnectorHandleResponseWithoutSignatureTask extends AbstractPep } else { // should not occur - throw new IOException("should not occur"); + throw new TaskExecutionException("Parsing mulitpart/form-data request parameters failed", null); } return; } private void handleSAMLResponse(ExecutionContext executionContext, HttpServletRequest request, - HttpServletResponse response) { + HttpServletResponse response) throws TaskExecutionException { Logger.info("handleSAMLResponse started"); String pendingRequestID = null; @@ -399,13 +400,14 @@ public class PepsConnectorHandleResponseWithoutSignatureTask extends AbstractPep Logger.info("REDIRECT TO: " + redirectURL); } catch (AuthenticationException e) { - handleError(null, e, request, response, pendingRequestID); + throw new TaskExecutionException(e.getMessage(), e); } catch (MOAIDException e) { - handleError(null, e, request, response, pendingRequestID); + throw new TaskExecutionException(e.getMessage(), e); } catch (Exception e) { Logger.error("PEPSConnector has an interal Error.", e); + throw new TaskExecutionException(e.getMessage(), e); } finally { 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 9df0ff37b..81c7c3a7b 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 @@ -41,6 +41,7 @@ import at.gv.egovernment.moa.id.auth.data.IdentityLink; import at.gv.egovernment.moa.id.auth.exception.AuthenticationException; import at.gv.egovernment.moa.id.auth.exception.MOAIDException; import at.gv.egovernment.moa.id.auth.modules.AbstractAuthServletTask; +import at.gv.egovernment.moa.id.auth.modules.TaskExecutionException; import at.gv.egovernment.moa.id.auth.parser.IdentityLinkAssertionParser; import at.gv.egovernment.moa.id.auth.servlet.PEPSConnectorServlet; import at.gv.egovernment.moa.id.auth.stork.STORKException; @@ -128,7 +129,7 @@ public class PepsConnectorTask extends AbstractAuthServletTask { @Override public void execute(ExecutionContext executionContext, HttpServletRequest request, HttpServletResponse response) - throws Exception { + throws TaskExecutionException { String pendingRequestID = null; setNoCachingHeaders(response); @@ -613,13 +614,14 @@ public class PepsConnectorTask extends AbstractAuthServletTask { Logger.info("REDIRECT TO: " + redirectURL); } catch (AuthenticationException e) { - handleError(null, e, request, response, pendingRequestID); + throw new TaskExecutionException(e.getMessage(), e); } catch (MOAIDException e) { - handleError(null, e, request, response, pendingRequestID); + throw new TaskExecutionException(e.getMessage(), e); } catch (Exception e) { Logger.error("PEPSConnector has an interal Error.", e); + throw new TaskExecutionException(e.getMessage(), e); } finally { -- cgit v1.2.3