aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-03-20 12:34:59 +0100
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-03-20 12:34:59 +0100
commit72f9629c1c16bc0dacbc9aea45f15bd1af9e7f3f (patch)
tree92278f301341cddf96ef745ee7c1165841f09717 /id/server/idserverlib/src/main/java/at/gv/egovernment/moa
parenteab3194053237391030f8c363ca072766e19faf9 (diff)
parentc54fd74a0ac1c03beb6870abf4710daddfd16a33 (diff)
downloadmoa-id-spss-72f9629c1c16bc0dacbc9aea45f15bd1af9e7f3f.tar.gz
moa-id-spss-72f9629c1c16bc0dacbc9aea45f15bd1af9e7f3f.tar.bz2
moa-id-spss-72f9629c1c16bc0dacbc9aea45f15bd1af9e7f3f.zip
Merge branch 'vidp' of gitlab.iaik.tugraz.at:afitzek/moa-idspss into vidp
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/STORKResponseProcessor.java32
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/VelocityProvider.java2
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java10
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java4
4 files changed, 42 insertions, 6 deletions
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 57843d0f3..ab9decde0 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
@@ -138,7 +138,37 @@ public class STORKResponseProcessor {
String citizenSignature = getAttributeValue("signedDoc", attributeList);
// if we have a signedDoc we test for a representation case
- if(hasAttribute("mandateContent", attributeList) || hasAttribute("representative", attributeList) || hasAttribute("represented", attributeList)) {
+ // - according to stork samlengine and commons
+ if(hasAttribute("mandate", attributeList)) {
+ // we have a representation case
+ String mandate = getAttributeValue("mandate", attributeList);
+
+ if(!hasAttribute("dateOfBirth", attributeList)) {
+ // if we get here, we have a natural person representing a legal person
+ String organizationAddress = getAttributeValue("canonicalRegisteredAddress", attributeList);
+ String organizationType = getAttributeValue("translateableType", attributeList);
+
+ identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(citizenSignature, null, null, mandate, organizationAddress, organizationType, targetType, targetValue, oaFriendlyName, filters);
+ } else {
+ // if we get here, we have a natural person representing another natural person
+ String eIdentifier = getAttributeValue("eIdentifier", attributeList);
+ String givenName = getAttributeValue("givenName", attributeList);
+ String lastName = getAttributeValue("surname", attributeList);
+ String dateOfBirth = getAttributeValue("dateOfBirth", attributeList);
+
+ // gender attribute is mandatory here because of some legal stuff
+ String gender = getAttributeValue("gender", attributeList);
+
+ if (!StringUtils.isEmpty(dateOfBirth))
+ dateOfBirth = DateTimeUtils.formatPEPSDateToMOADate(dateOfBirth);
+
+ identityLinkResponse = AuthenticationServer.getInstance().getIdentityLink(eIdentifier,
+ givenName, lastName, dateOfBirth, gender, citizenSignature, null,
+ null, mandate, targetType, targetValue, oaFriendlyName, filters);
+ }
+ }
+ // - according to stork spec
+ else if(hasAttribute("mandateContent", attributeList) || hasAttribute("representative", attributeList) || hasAttribute("represented", attributeList)) {
// we have a representation case
String representative = getAttributeValue("representative", attributeList);
String represented = getAttributeValue("represented", attributeList);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/VelocityProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/VelocityProvider.java
index b923727f9..534121443 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/VelocityProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/stork/VelocityProvider.java
@@ -103,6 +103,8 @@ public class VelocityProvider {
VelocityEngine velocityEngine = new VelocityEngine();
velocityEngine.setProperty(RuntimeConstants.ENCODING_DEFAULT, "UTF-8");
velocityEngine.setProperty(RuntimeConstants.OUTPUT_ENCODING, "UTF-8");
+ velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
+ "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
return velocityEngine;
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
index e0f14c41d..4bf193e9e 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java
@@ -109,6 +109,7 @@ public class AttributeCollector implements IAction {
if (!responseAttributeList.containsKey(current.getName()))
missingAttributes.add(current);
+ Logger.info("collecting attributes...");
Logger.debug("found " + missingAttributes.size() + " missing attributes");
// Try to get all missing attributes
@@ -135,8 +136,10 @@ public class AttributeCollector implements IAction {
break;
} catch (UnsupportedAttributeException e) {
// ok, try the next attributeprovider
+ Logger.info(currentProvider.getClass().getSimpleName() + " could not handle attribute '" + currentAttribute.getName() + "'");
} catch (MOAIDException e) {
// the current plugin had an error. Try the next one.
+ Logger.info(currentProvider.getClass().getSimpleName() + " could not handle attribute '" + currentAttribute.getName() + "' due to an error");
}
}
@@ -148,6 +151,7 @@ public class AttributeCollector implements IAction {
// else, update any existing attributes
addOrUpdateAll(container.getResponse().getPersonalAttributeList(), aquiredAttributes);
}
+ Logger.info("collecting attributes done");
// ask for consent if necessary
if(oaParam.isRequireConsentForStorkAttributes())
@@ -194,9 +198,9 @@ public class AttributeCollector implements IAction {
* @throws MOAIDException
*/
private void addOrUpdateAll(IPersonalAttributeList target, IPersonalAttributeList source) throws MOAIDException {
- Logger.info("Updating " + source.size() + " attribute(s)...");
+ Logger.debug("Updating " + source.size() + " attributes...");
for (PersonalAttribute current : source) {
- Logger.debug("treating " + current.getName());
+ Logger.trace("treating " + current.getName());
// check if we need to update the current pa
if (target.containsKey(current.getName())) {
@@ -213,7 +217,7 @@ public class AttributeCollector implements IAction {
} else
target.add(current);
- Logger.debug("...successfully treated " + current.getName());
+ Logger.trace("...successfully treated " + current.getName());
}
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java
index 19ec754ee..bcf086b56 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java
@@ -137,6 +137,8 @@ public class ConsentEvaluator implements IAction {
public void generateSTORKResponse(HttpServletResponse httpResp, DataContainer container) throws MOAIDException {
MOASTORKRequest request = container.getRequest();
MOASTORKResponse response = container.getResponse();
+
+ Logger.info("generating stork response...");
try {
//Get SAMLEngine instance
@@ -155,8 +157,6 @@ public class ConsentEvaluator implements IAction {
throw new MOAIDException("stork.05", null);
}
- Logger.info("STORK SAML Response message succesfully generated ");
-
// preparing redirection for the client
try {
VelocityEngine velocityEngine = VelocityProvider.getClassPathVelocityEngine();