aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2014-06-17 13:36:14 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2014-06-17 13:36:14 +0200
commit8b51a5eef55764746eebdeaa19b31e7eda3813e3 (patch)
treedaf6d9c8f126611fb0c36e3a9249e873db8a8483
parent395d0e55c049bb93536f9281c8acfcca552740d5 (diff)
parent01a5b6d2e226f1b6c25fbc71eb90a00adc086f40 (diff)
downloadmoa-id-spss-8b51a5eef55764746eebdeaa19b31e7eda3813e3.tar.gz
moa-id-spss-8b51a5eef55764746eebdeaa19b31e7eda3813e3.tar.bz2
moa-id-spss-8b51a5eef55764746eebdeaa19b31e7eda3813e3.zip
Merge branch 'moa-2.1-Snapshot' of gitlab.iaik.tugraz.at:afitzek/moa-idspss into moa-2.1-Snapshot
-rw-r--r--id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml4
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java15
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeCollector.java3
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java3
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/CorporateBodyMandateContainer.java2
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java291
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java5
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java5
8 files changed, 211 insertions, 117 deletions
diff --git a/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml b/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml
index 688ff0f19..ef5dc23d2 100644
--- a/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml
+++ b/id/server/data/deploy/conf/moa-id/stork/StorkSamlEngine_VIDP.xml
@@ -113,4 +113,8 @@
<entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry>
<entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry>
+ <entry key="mandateContent">http://www.stork.gov.eu/1.0/mandateContent</entry>
+ <entry key="representative">http://www.stork.gov.eu/1.0/representative</entry>
+ <entry key="represented">http://www.stork.gov.eu/1.0/represented</entry>
+
</properties>
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java
index 7039a1fe0..20641ca7c 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java
@@ -148,6 +148,21 @@ public class BPKBuilder {
return buildStorkbPK(identityLink, "AT", destinationCountry);
}
+ /**
+ * Builds the storkeid from the given parameters.
+ *
+ * @param identityLink identity link
+ * @param destinationCountry destination country code (2 chars)
+ * @return storkid in a BASE64 encoding
+ * @throws BuildException if an error occurs on building the wbPK
+ */
+ public String buildStorkeIdentifier(String identificationType, String identificationValue, String destinationCountry)
+ throws BuildException {
+ IdentityLink tempIdentity = new IdentityLink();
+ tempIdentity.setIdentificationType(identificationType);
+ tempIdentity.setIdentificationValue(identificationValue);
+ return buildStorkbPK(tempIdentity, "AT", destinationCountry);
+ }
/**
* Builds the storkeid from the given parameters.
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 fce2a01cf..456baf49f 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
@@ -44,6 +44,7 @@ import at.gv.egovernment.moa.id.storage.AssertionStorage;
import at.gv.egovernment.moa.logging.Logger;
import eu.stork.peps.auth.commons.*;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.complex.attributes.AttributeStatusType;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
@@ -197,7 +198,7 @@ public class AttributeCollector implements IAction {
* This way, there is no error case in which an attribute is left unanswered.
*/
IPersonalAttributeList aquiredAttributes = new PersonalAttributeList();
- currentAttribute.setStatus("notAvailable");
+ currentAttribute.setStatus(AttributeStatusType.NOT_AVAILABLE.value());
aquiredAttributes.add((PersonalAttribute) currentAttribute.clone());
addOrUpdateAll(container.getResponse().getPersonalAttributeList(), aquiredAttributes);
// - check if we can find a suitable AttributeProvider Plugin
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 edbe0b58c..2b00f15e2 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
@@ -41,6 +41,7 @@ import eu.stork.peps.auth.commons.PEPSUtil;
import eu.stork.peps.auth.commons.PersonalAttribute;
import eu.stork.peps.auth.commons.STORKAuthnResponse;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.complex.attributes.AttributeStatusType;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
@@ -79,7 +80,7 @@ public class ConsentEvaluator implements IAction {
// evaluate response
for(PersonalAttribute current : container.getResponse().getPersonalAttributeList()) {
if(null == httpReq.getParameter(current.getName())) {
- current.setStatus("notAvailable");
+ current.setStatus(AttributeStatusType.NOT_AVAILABLE.value());
current.setValue(new ArrayList<String>());
current.setComplexValue(new HashMap<String, String>());
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/CorporateBodyMandateContainer.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/CorporateBodyMandateContainer.java
index eb0f2975c..b358436ae 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/CorporateBodyMandateContainer.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/CorporateBodyMandateContainer.java
@@ -97,7 +97,7 @@ public class CorporateBodyMandateContainer extends MandateContainer {
}
public void setCorpMandatorIdentificationValue(String corpMandatorIdentificationValue) {
- this.corpMandatorIdentificationValue = corpMandatorIdentificationValue;
+ this.corpMandatorIdentificationValue = "AT/" + corpMandatorIdentificationValue;
}
public String getCorpMandatorIdentificationType() {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java
index 8aa5c2d1d..139c438f9 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java
@@ -22,7 +22,10 @@
*******************************************************************************/
package at.gv.egovernment.moa.id.protocols.stork2;
+import at.gv.egovernment.moa.id.auth.builder.BPKBuilder;
+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.BuildException;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.config.auth.AuthConfigurationProvider;
import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
@@ -31,6 +34,7 @@ import at.gv.egovernment.moa.id.data.SLOInformationInterface;
import at.gv.egovernment.moa.id.moduls.IAction;
import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.logging.Logger;
+import at.gv.egovernment.moa.util.Constants;
import eu.stork.peps.auth.commons.IPersonalAttributeList;
import eu.stork.peps.auth.commons.PersonalAttribute;
import eu.stork.peps.auth.commons.PersonalAttributeList;
@@ -60,10 +64,13 @@ public class MandateRetrievalRequest implements IAction {
private IAuthData authData;
private MOASTORKRequest moaStorkRequest;
+ private IdentityLink representingIdentityLink;
public SLOInformationInterface processRequest(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp, IAuthData authData) throws MOAIDException {
Logger.debug("Entering AttributeRequest for MandateProvider");
httpResp.reset();
+ this.representingIdentityLink = authData.getIdentityLink();
+
OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(req.getOAURL());
if (oaParam == null)
throw new AuthenticationException("stork.12", new Object[]{req.getOAURL()});
@@ -75,142 +82,134 @@ public class MandateRetrievalRequest implements IAction {
if ((req instanceof MOASTORKRequest)) {
this.moaStorkRequest = (MOASTORKRequest) req;
-
} else {
- return null; // TODO
+ Logger.error("Internal error - did not receive MOASTORKRequest as expected");
+ throw new MOAIDException("stork.16", new Object[]{}); // TODO
}
- if (moaStorkRequest.isAttrRequest() && moaStorkRequest.getStorkAttrQueryRequest() != null) {
- MandateContainer mandateContainer = null;
-
- try {
- mandateContainer = new CorporateBodyMandateContainer(new String(authData.getMISMandate().getMandate(), "UTF-8"));
- } catch (Exception ex) {
- try {
- mandateContainer = new PhyPersonMandateContainer(new String(authData.getMISMandate().getMandate(), "UTF-8"));
- } catch (Exception ex2) {
- Logger.error("Could not extract data and create mandate container.");
- throw new MOAIDException("stork.16", new Object[]{}); // TODO
- }
- }
-
- if (mandateContainer instanceof CorporateBodyMandateContainer) {
+ if (!(moaStorkRequest.isAttrRequest() || moaStorkRequest.getStorkAttrQueryRequest() == null)) {
+ Logger.error("Did not receive attribute request as expected");
+ throw new MOAIDException("stork.16", new Object[]{}); // TODO
+ }
- } else if (mandateContainer instanceof PhyPersonMandateContainer) {
+ MandateContainer mandateContainer = null;
+ try {
+ mandateContainer = new CorporateBodyMandateContainer(new String(authData.getMISMandate().getMandate(), "UTF-8"));
+ } catch (Exception ex) {
+ try {
+ mandateContainer = new PhyPersonMandateContainer(new String(authData.getMISMandate().getMandate(), "UTF-8"));
+ } catch (Exception ex2) {
+ Logger.error("Could not extract data and create mandate container.");
+ throw new MOAIDException("stork.16", new Object[]{}); // TODO
}
+ }
-
-// moaStorkResponse.setPersonalAttributeList(populateAttributes());
-
- //moaStorkResponse.setCountry(moaStorkRequest.getSpCountry());
-
- IPersonalAttributeList sourceAttributeList = moaStorkRequest.getStorkAttrQueryRequest().getPersonalAttributeList();
-
- IPersonalAttributeList attributeList = new PersonalAttributeList();
-
- for (PersonalAttribute currentAttribute : sourceAttributeList) {
- Logger.debug("Evaluating currentattribute " + currentAttribute.getName());
- if (currentAttribute.getName().equals("mandateContent")) {
- MandateContentType mandateContent = getMandateContent(mandateContainer, currentAttribute);
- attributeList.add(marshallComplexAttribute(currentAttribute, mandateContent));
- } else if (currentAttribute.getName().equals("representative")) { // TODO CHECK IN DETAIL
- RepresentationPersonType representative = getRepresentative(mandateContainer, currentAttribute);
- attributeList.add(marshallComplexAttribute(currentAttribute, representative));
-
- //attributeList.add(getRepresentative(mandateContainer, currentAttribute));
- } else if (currentAttribute.getName().equals("represented")) {
- //attributeList.add(getRepresented(mandateContainer, currentAttribute));
- RepresentationPersonType represented = getRepresented(mandateContainer, currentAttribute);
- attributeList.add(marshallComplexAttribute(currentAttribute, represented));
-
- } else if (currentAttribute.getName().equals("mandate")) {
- //attributeList.add(getMandateType(mandateContainer, currentAttribute));
- MandateType mandateType = getMandateType(mandateContainer, currentAttribute);
- attributeList.add(marshallComplexAttribute(currentAttribute, mandateType));
-
- } else if (currentAttribute.getName().equals("legalName")) {
- String legalName = getLegalName(mandateContainer, currentAttribute);
- if (legalName.length() > 0) {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(legalName), AttributeStatusType.AVAILABLE.value()));
- } else {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(legalName), AttributeStatusType.NOT_AVAILABLE.value()));
- }
- } else if (currentAttribute.getName().equals("eLPIdentifier")) {
- String eLPIdentifier = geteLPIdentifier(mandateContainer, currentAttribute);
- if (eLPIdentifier.length() > 0) {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(eLPIdentifier), AttributeStatusType.AVAILABLE.value()));
- } else {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(eLPIdentifier), AttributeStatusType.NOT_AVAILABLE.value()));
- }
- } else if (currentAttribute.getName().equals("type")) {
- String type = getCompanyType(mandateContainer, currentAttribute);
- if (type.length() > 0) {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(type), AttributeStatusType.AVAILABLE.value()));
- } else {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(type), AttributeStatusType.NOT_AVAILABLE.value()));
- }
- } else if (currentAttribute.getName().equals("status")) {
- String status = getCompanyStatus(mandateContainer, currentAttribute);
- if (status.length() > 0) {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(status), AttributeStatusType.AVAILABLE.value()));
- } else {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(status), AttributeStatusType.NOT_AVAILABLE.value()));
- }
- } else if (currentAttribute.getName().equals("translatableType")) {
- String translatableType = getCompanyTranslatableType(mandateContainer, currentAttribute);
- if (translatableType.length() > 0) {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(translatableType), AttributeStatusType.AVAILABLE.value()));
- } else {
- attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(translatableType), AttributeStatusType.NOT_AVAILABLE.value()));
- }
+ IPersonalAttributeList sourceAttributeList = moaStorkRequest.getStorkAttrQueryRequest().getPersonalAttributeList();
+
+ IPersonalAttributeList attributeList = new PersonalAttributeList();
+
+ for (PersonalAttribute currentAttribute : sourceAttributeList) {
+ Logger.debug("Evaluating currentattribute " + currentAttribute.getName());
+ if (currentAttribute.getName().equals("mandateContent")) {
+ MandateContentType mandateContent = getMandateContent(mandateContainer, currentAttribute);
+ attributeList.add(marshallComplexAttribute(currentAttribute, mandateContent));
+ } else if (currentAttribute.getName().equals("representative")) { // TODO CHECK IN DETAIL
+ RepresentationPersonType representative = getRepresentative(mandateContainer, currentAttribute);
+ attributeList.add(marshallComplexAttribute(currentAttribute, representative));
+
+ //attributeList.add(getRepresentative(mandateContainer, currentAttribute));
+ } else if (currentAttribute.getName().equals("represented")) {
+ //attributeList.add(getRepresented(mandateContainer, currentAttribute));
+ RepresentationPersonType represented = getRepresented(mandateContainer, currentAttribute);
+ attributeList.add(marshallComplexAttribute(currentAttribute, represented));
+
+ } else if (currentAttribute.getName().equals("mandate")) {
+ //attributeList.add(getMandateType(mandateContainer, currentAttribute));
+ MandateType mandateType = getMandateType(mandateContainer, currentAttribute);
+ attributeList.add(marshallComplexAttribute(currentAttribute, mandateType));
+
+ } else if (currentAttribute.getName().equals("legalName")) {
+ String legalName = getLegalName(mandateContainer, currentAttribute);
+ if (legalName.length() > 0) {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(legalName), AttributeStatusType.AVAILABLE.value()));
+ } else {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(legalName), AttributeStatusType.NOT_AVAILABLE.value()));
+ }
+ } else if (currentAttribute.getName().equals("eLPIdentifier")) {
+ String eLPIdentifier = geteLPIdentifier(mandateContainer, currentAttribute);
+ if (eLPIdentifier.length() > 0) {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(eLPIdentifier), AttributeStatusType.AVAILABLE.value()));
+ } else {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(eLPIdentifier), AttributeStatusType.NOT_AVAILABLE.value()));
+ }
+ } else if (currentAttribute.getName().equals("type")) {
+ String type = getCompanyType(mandateContainer, currentAttribute);
+ if (type.length() > 0) {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(type), AttributeStatusType.AVAILABLE.value()));
+ } else {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(type), AttributeStatusType.NOT_AVAILABLE.value()));
+ }
+ } else if (currentAttribute.getName().equals("status")) {
+ String status = getCompanyStatus(mandateContainer, currentAttribute);
+ if (status.length() > 0) {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(status), AttributeStatusType.AVAILABLE.value()));
+ } else {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(status), AttributeStatusType.NOT_AVAILABLE.value()));
+ }
+ } else if (currentAttribute.getName().equals("translatableType")) {
+ String translatableType = getCompanyTranslatableType(mandateContainer, currentAttribute);
+ if (translatableType.length() > 0) {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(translatableType), AttributeStatusType.AVAILABLE.value()));
+ } else {
+ attributeList.add(new PersonalAttribute(currentAttribute.getName(), currentAttribute.isRequired(), Arrays.asList(translatableType), AttributeStatusType.NOT_AVAILABLE.value()));
}
-
}
+ }
+
// if (attrResponse.getPersonalAttributeList().size() == 0) {
// Logger.error("AttributeList empty - could not retrieve attributes");
// throw new MOAIDException("stork.16", new Object[]{}); // TODO MESSAGE
// }
- attrResponse.setPersonalAttributeList(attributeList);
- moaStorkResponse.setSTORKAttrResponse(attrResponse);
+ attrResponse.setPersonalAttributeList(attributeList);
+ moaStorkResponse.setSTORKAttrResponse(attrResponse);
- Logger.debug("Attributes retrieved: " + moaStorkResponse.getStorkAttrQueryResponse().getPersonalAttributeList().size());
+ Logger.debug("Attributes retrieved: " + moaStorkResponse.getStorkAttrQueryResponse().getPersonalAttributeList().size() + " for SP country " + attrResponse.getCountry());
- // Prepare extended attributes
- Logger.debug("Preparing data container");
+ // Prepare extended attributes
+ Logger.debug("Preparing data container");
- // create fresh container
- DataContainer container = new DataContainer();
+ // create fresh container
+ DataContainer container = new DataContainer();
- // - fill in the request we extracted above
- container.setRequest(moaStorkRequest);
+ // - fill in the request we extracted above
+ container.setRequest(moaStorkRequest);
- // - fill in the partial response created above
- container.setResponse(moaStorkResponse);
+ // - fill in the partial response created above
+ container.setResponse(moaStorkResponse);
- container.setRemoteAddress(httpReq.getRemoteAddr());
+ container.setRemoteAddress(httpReq.getRemoteAddr());
- Logger.debug("Data container prepared");
-
- // ask for consent if necessary
- if (oaParam.isRequireConsentForStorkAttributes())
- new ConsentEvaluator().requestConsent(container, httpResp, oaParam);
- else
- new ConsentEvaluator().generateSTORKResponse(httpResp, container);
- }
+ Logger.debug("Data container prepared");
+ // ask for consent if necessary
+ if (oaParam.isRequireConsentForStorkAttributes())
+ new ConsentEvaluator().requestConsent(container, httpResp, oaParam);
+ else
+ new ConsentEvaluator().generateSTORKResponse(httpResp, container);
- return null; //
+ return null;
}
+
private String geteLPIdentifier(MandateContainer mandateContainer, PersonalAttribute currentAttribute) throws MOAIDException {
RepresentationPersonType represented = getRepresented(mandateContainer, currentAttribute);
if (mandateContainer instanceof CorporateBodyMandateContainer) {
- return "AT/".concat(represented.getELPIdentifier());
+ return represented.getELPIdentifier();
} else if (currentAttribute.isRequired()) {
Logger.error("Cannot provide eLPIdentifier for natural person.");
throw new MOAIDException("stork.19", new Object[]{currentAttribute.getName()});
@@ -218,6 +217,7 @@ public class MandateRetrievalRequest implements IAction {
return "";
}
+
private PersonalAttribute marshallComplexAttribute(PersonalAttribute currentAttribute, Object obj) { // TODO refactor
StringWriter stringWriter = new StringWriter();
try {
@@ -398,10 +398,79 @@ public class MandateRetrievalRequest implements IAction {
}
- private RepresentationPersonType getRepresentative(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) {
+ private String getRepresentedStorkeIdentifier(MandateContainer mandateContainer) throws MOAIDException {
+
+ //String identificationType, String identificationValue
+ if (!(mandateContainer instanceof PhyPersonMandateContainer)) {
+ Logger.error("Physical person mandate container missing");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ PhyPersonMandateContainer phyPersonMandateContainer = (PhyPersonMandateContainer) mandateContainer;
+
+ if (!phyPersonMandateContainer.getPhyPersMandatorIdentificationType().equals(Constants.URN_PREFIX_BASEID)) {
+ Logger.error("Identification type of represented person from MIS is not correct");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ if (phyPersonMandateContainer.getPhyPersMandatorIdentificationValue().length() != 24) {
+ Logger.error("Identification value of represented person from MIS is not correct");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ if ((this.moaStorkRequest.getStorkAttrQueryRequest().getSpCountry() == null) || (this.moaStorkRequest.getStorkAttrQueryRequest().getSpCountry().length() == 0)) {
+ Logger.error("Error accessing SP country code");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ BPKBuilder bpkBuilder = new BPKBuilder();
+ try {
+ return bpkBuilder.buildStorkeIdentifier(phyPersonMandateContainer.getPhyPersMandatorIdentificationType(), phyPersonMandateContainer.getPhyPersMandatorIdentificationValue(), this.moaStorkRequest.getStorkAttrQueryRequest().getSpCountry());
+ } catch (BuildException be) {
+ Logger.error("Could not build STORK eIdentifier while generating mandate assertion.");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+ }
+
+ private String getRepresentingStorkeIdentifier(MandateContainer mandateContainer) throws MOAIDException {
+ if ((this.representingIdentityLink == null)) {
+ Logger.error("Error accessing identityLink while fetching mandate attribute");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ if ((this.moaStorkRequest.getStorkAttrQueryRequest().getSpCountry() == null) || (this.moaStorkRequest.getStorkAttrQueryRequest().getSpCountry().length() == 0)) {
+ Logger.error("Error accessing SP country code");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ if (!this.representingIdentityLink.getIdentificationType().equals(Constants.URN_PREFIX_BASEID)) {
+ Logger.error("Incorrect identity link (local): identification type is not correct! Got: " + this.representingIdentityLink.getIdentificationType());
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ if (!mandateContainer.getPhysicalRepresentativeIdentificationType().equals(Constants.URN_PREFIX_BASEID)) {
+ Logger.error("Incorrect identity link (MIS): identification type is not correct! Got: " + this.representingIdentityLink.getIdentificationType());
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ if (!mandateContainer.getPhysicalRepresentativeIdentificationValue().equals(this.representingIdentityLink.getIdentificationValue())) {
+ Logger.error("Identification values from MIS and local service are not equal!");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+
+ BPKBuilder bpkBuilder = new BPKBuilder();
+ try {
+ return bpkBuilder.buildStorkeIdentifier(this.representingIdentityLink, this.moaStorkRequest.getStorkAttrQueryRequest().getSpCountry());
+ } catch (BuildException be) {
+ Logger.error("Could not build STORK eIdentifier while generating mandate assertion.");
+ throw new MOAIDException("stork.20", new Object[]{}); // TODO
+ }
+ }
+
+ private RepresentationPersonType getRepresentative(MandateContainer mandateContainer, PersonalAttribute sourceAttribute) throws MOAIDException {
RepresentationPersonType representative = new RepresentationPersonType();
- representative.setEIdentifier(""); // TODO CALCULATE
+ representative.setEIdentifier(getRepresentingStorkeIdentifier(mandateContainer));
representative.setGivenName(mandateContainer.getPhysicalRepresentativeGivenName());
representative.setSurname(mandateContainer.getPhysicalRepresentativeFamilyName());
representative.setDateOfBirth(mandateContainer.getPhysicalRepresentativeBirthDate());
@@ -414,15 +483,15 @@ public class MandateRetrievalRequest implements IAction {
RepresentationPersonType represented = new RepresentationPersonType();
if (mandateContainer instanceof CorporateBodyMandateContainer) {
- CorporateBodyMandateContainer corporateBodyMandateContainer = (CorporateBodyMandateContainer)mandateContainer;
- represented.setELPIdentifier("AT/" + corporateBodyMandateContainer.getCorpMandatorIdentificationValue());
+ CorporateBodyMandateContainer corporateBodyMandateContainer = (CorporateBodyMandateContainer) mandateContainer;
+ represented.setELPIdentifier(corporateBodyMandateContainer.getCorpMandatorIdentificationValue());
represented.setName(corporateBodyMandateContainer.getCorpMandatorFullName());
represented.setAddress("");
represented.setCanonicalAddress(new CanonicalAddressType());
represented.setType(getCompanyType(corporateBodyMandateContainer.corpMandatorFullName, corporateBodyMandateContainer.corpMandatorIdentificationType, sourceAttribute));
} else if (mandateContainer instanceof PhyPersonMandateContainer) {
PhyPersonMandateContainer phyPersonMandateContainer = (PhyPersonMandateContainer) mandateContainer;
- represented.setEIdentifier(""); // TODO CALCULATE
+ represented.setEIdentifier(getRepresentedStorkeIdentifier(mandateContainer)); // TODO CALCULATE
represented.setGivenName(phyPersonMandateContainer.getPhyPersMandatorGivenName());
represented.setSurname(phyPersonMandateContainer.getPhyPersMandatorFamilyName());
represented.setDateOfBirth(phyPersonMandateContainer.getPhyPersMandatorBirthDate());
@@ -448,7 +517,7 @@ public class MandateRetrievalRequest implements IAction {
mandateContent.setTransactionLimit(BigInteger.valueOf(0)); // TODO
mandateContent.setTransactionLimitCurrency("");// TODO
- mandateContent.setIsJoint("");
+ mandateContent.setIsJoint("0");
mandateContent.setIschained(false);
mandateContent.setTypePower(mapPowersType(mandateContainer));
Logger.debug("Complex attribute extracted: " + sourceAttribute.getName());
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java
index 6b3cff444..cd9042342 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/MandateAttributeRequestProvider.java
@@ -141,8 +141,11 @@ public class MandateAttributeRequestProvider extends AttributeProvider {
attributeRequest.setPersonalAttributeList(requestedAttributes);
attributeRequest.setCitizenCountryCode("AT");
- attributeRequest.setQaa(4);
+ attributeRequest.setQaa(oaParam.getQaaLevel());
+ if (attributeRequest.getQaa() == 0 ) {
+ attributeRequest.setQaa(4); // workaround
+ }
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java
index d1fef01b8..0de442bcf 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/SignedDocAttributeRequestProvider.java
@@ -244,8 +244,9 @@ public class SignedDocAttributeRequestProvider extends AttributeProvider {
} catch (Exception e) {
e.printStackTrace();
Logger.error("Failed to assemble signedDoc attribute");
- throw new MOAIDException("stork.05", null);
- }
+ //throw new MOAIDException("stork.05", null);
+ throw new UnsupportedAttributeException();
+ }
}
/*