aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-02-03 08:33:42 +0100
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-02-03 08:33:42 +0100
commit4333fd60c637f2a739e3db17d00f61c68c465a8e (patch)
treebd2e3c41bb3a16d68bfce5b72f6ecf0bd2d8cdde /id/server/idserverlib/src/main/java
parent24029880580770543d788d95b39526853ff5e6dd (diff)
parentff390ac6c2f0ca181075218ee16bf292e47a299c (diff)
downloadmoa-id-spss-4333fd60c637f2a739e3db17d00f61c68c465a8e.tar.gz
moa-id-spss-4333fd60c637f2a739e3db17d00f61c68c465a8e.tar.bz2
moa-id-spss-4333fd60c637f2a739e3db17d00f61c68c465a8e.zip
Merge remote-tracking branch 'remotes/origin/outgoingstork' into moa2_0_tlenz
Diffstat (limited to 'id/server/idserverlib/src/main/java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java51
1 files changed, 26 insertions, 25 deletions
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
index 1e6821912..23eb138d9 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/servlet/PEPSConnectorServlet.java
@@ -54,7 +54,6 @@ import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.stork.STORKException;
import at.gv.egovernment.moa.id.auth.stork.STORKResponseProcessor;
import at.gv.egovernment.moa.id.auth.stork.VelocityProvider;
-import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.moduls.ModulUtils;
@@ -189,30 +188,6 @@ public class PEPSConnectorServlet extends AuthServlet {
gender.setValue(tmp);
authnResponse.getPersonalAttributeList().add(gender);
- } else {
- // this is really nasty but we work against the system here. We are supposed to get the gender attribute from
- // stork. If we do not, we cannot register the person in the ERnP - we have to have the
- // gender for the represented person. So here comes the dirty hack.
- try {
- Logger.trace("Initialize VelocityEngine...");
-
- VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine();
- Template template = velocityEngine.getTemplate("/resources/templates/fetchGender.html");
- VelocityContext context = new VelocityContext();
- context.put("SAMLResponse", request.getParameter("SAMLResponse"));
- context.put("action", request.getRequestURL());
-
- StringWriter writer = new StringWriter();
- template.merge(context, writer);
-
- response.getOutputStream().write(writer.toString().getBytes());
- } catch (Exception e1) {
- Logger.error("Error sending gender retrival form.", e1);
- httpSession.invalidate();
- throw new MOAIDException("stork.10", null);
- }
-
- return;
}
}
@@ -302,6 +277,32 @@ public class PEPSConnectorServlet extends AuthServlet {
targetType, targetValue,
oaParam.getMandateProfiles());
} catch (STORKException e) {
+ // this is really nasty but we work against the system here. We are supposed to get the gender attribute from
+ // stork. If we do not, we cannot register the person in the ERnP - we have to have the
+ // gender for the represented person. So here comes the dirty hack.
+ if(e.getCause() instanceof STORKException && e.getCause().getMessage().equals("gender not found in response")) {
+ try {
+ Logger.trace("Initialize VelocityEngine...");
+
+ VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine();
+ Template template = velocityEngine.getTemplate("/resources/templates/fetchGender.html");
+ VelocityContext context = new VelocityContext();
+ context.put("SAMLResponse", request.getParameter("SAMLResponse"));
+ context.put("action", request.getRequestURL());
+
+ StringWriter writer = new StringWriter();
+ template.merge(context, writer);
+
+ response.getOutputStream().write(writer.toString().getBytes());
+ } catch (Exception e1) {
+ Logger.error("Error sending gender retrival form.", e1);
+ httpSession.invalidate();
+ throw new MOAIDException("stork.10", null);
+ }
+
+ return;
+ }
+
Logger.error("Error connecting SZR Gateway", e);
throw new MOAIDException("stork.10", null);
}