diff options
author | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2014-01-31 16:29:15 +0100 |
---|---|---|
committer | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2014-01-31 17:17:31 +0100 |
commit | c2ccb7f48188b369c34cf2116b593a6d7c46b1ac (patch) | |
tree | 79c0534e7fb5e1342c6980287ba1035188677def /id/server/idserverlib/src/main/java/at | |
parent | 9122bf6862fe34881e5454f54c69692b7f5ed083 (diff) | |
download | moa-id-spss-c2ccb7f48188b369c34cf2116b593a6d7c46b1ac.tar.gz moa-id-spss-c2ccb7f48188b369c34cf2116b593a6d7c46b1ac.tar.bz2 moa-id-spss-c2ccb7f48188b369c34cf2116b593a6d7c46b1ac.zip |
refactored gender retrieval
Diffstat (limited to 'id/server/idserverlib/src/main/java/at')
2 files changed, 26 insertions, 29 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 a3c8ebe4d..b1829439a 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 @@ -167,6 +167,30 @@ 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;
}
}
@@ -256,34 +280,6 @@ 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.getMessage().equals("gender not found in response")) {
- // fetch gender
-
- 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.setContentType("text/html");
- 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);
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java index 2534110d5..344e842b2 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java @@ -136,7 +136,8 @@ public class STORKResponseProcessor { String dateOfBirth = getAttributeValue("dateOfBirth", attributeList);
// gender attribute is mandatory here because of some legal stuff
-// String gender = getAttributeValue("gender", attributeList);
+ String gender = getAttributeValue("gender", attributeList);
+
if (!StringUtils.isEmpty(dateOfBirth))
dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth);
|