aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java
diff options
context:
space:
mode:
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java')
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java65
1 files changed, 60 insertions, 5 deletions
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 c473e6f82..52309a365 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
@@ -8,10 +8,18 @@ import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
import at.gv.egovernment.moa.id.moduls.IAction;
import at.gv.egovernment.moa.id.moduls.IRequest;
import at.gv.egovernment.moa.logging.Logger;
-import eu.stork.peps.auth.commons.*;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.auth.commons.STORKAttrQueryResponse;
+import eu.stork.peps.complex.attributes.MandateContentType;
+import eu.stork.peps.complex.attributes.MandateType;
+import eu.stork.peps.complex.attributes.RepresentationPersonType;
+import org.w3c.dom.Node;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
@@ -29,7 +37,7 @@ public class MandateRetrievalRequest implements IAction {
this.moaSession = moasession;
if ((req instanceof MOASTORKRequest)) {
- this.moaStorkRequest = (MOASTORKRequest)req;
+ this.moaStorkRequest = (MOASTORKRequest) req;
} else {
return null; // TODO
@@ -37,6 +45,7 @@ public class MandateRetrievalRequest implements IAction {
if (moaStorkRequest.isAttrRequest() && moaStorkRequest.getStorkAttrQueryRequest() != null) {
+ populateRepresented(moasession);
Logger.debug("Entering AttributeRequest for MandateProvider");
@@ -96,7 +105,7 @@ public class MandateRetrievalRequest implements IAction {
Logger.debug("Data container prepared");
// ask for consent if necessary
- if(oaParam.isRequireConsentForStorkAttributes())
+ if (oaParam.isRequireConsentForStorkAttributes())
new ConsentEvaluator().requestConsent(container, httpResp, oaParam);
else
new ConsentEvaluator().generateSTORKResponse(httpResp, container);
@@ -106,10 +115,57 @@ public class MandateRetrievalRequest implements IAction {
}
-
return null; //
}
+ private void populateMandatingData(AuthenticationSession moasession) {
+ MandateType mandateType = new MandateType();
+ RepresentationPersonType representationPersonType = new RepresentationPersonType();
+ MandateContentType mandateContentType = new MandateContentType();
+ }
+
+
+ private void populateRepresented(AuthenticationSession moasession) {
+
+ try {
+ CorporateBodyMandateContainer corporateBodyMandateContainer = new CorporateBodyMandateContainer(new String(moaSession.getMISMandate().getMandate(), "UTF-8"));
+
+
+ } catch (Exception ex) {
+
+ }
+ }
+
+
+ private Node extractChildNode(Node node, String childName) throws MOAIDException {
+ if (!node.hasChildNodes()) {
+ throw new MOAIDException("stork.11", null); // TODO description
+ }
+ for (int n = 0; n < node.getChildNodes().getLength(); n++) {
+ if (node.getChildNodes().item(n).getNodeName().equals(childName)) {
+ return node.getChildNodes().item(n);
+ }
+ }
+ throw new MOAIDException("stork.11", null); // TODO description
+
+ }
+
+ private String extractNodeTextContent(Node node, String childName) throws MOAIDException {
+ if (!node.hasChildNodes()) {
+ throw new MOAIDException("stork.11", null); // TODO description
+ }
+ for (int n = 0; n < node.getChildNodes().getLength(); n++) {
+ if (node.getChildNodes().item(n).getNodeName().equals(childName)) {
+ return node.getTextContent();
+ }
+ }
+ throw new MOAIDException("stork.11", null); // TODO description
+ }
+
+ private void populateMandateType(AuthenticationSession moasession) {
+
+ }
+
public boolean needAuthentication(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp) {
return true; //
}
@@ -119,5 +175,4 @@ public class MandateRetrievalRequest implements IAction {
}
-
}