aboutsummaryrefslogtreecommitdiff
path: root/id
diff options
context:
space:
mode:
authorBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-04-25 17:08:39 +0200
committerBojan Suzic <bojan.suzic@iaik.tugraz.at>2014-04-25 17:08:39 +0200
commit592c6ee57ba5d4955fe06941040f7a158bdec67d (patch)
treee5166f0e390e6b482891c70a90c61979854d99f8 /id
parent3d08ca18a290e57f6dd70f4b6914f0e3d5840bb7 (diff)
downloadmoa-id-spss-592c6ee57ba5d4955fe06941040f7a158bdec67d.tar.gz
moa-id-spss-592c6ee57ba5d4955fe06941040f7a158bdec67d.tar.bz2
moa-id-spss-592c6ee57ba5d4955fe06941040f7a158bdec67d.zip
adjusting attribute collector
Diffstat (limited to 'id')
-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/MandateAttributeRequestProvider.java3
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateRetrievalRequest.java95
-rw-r--r--id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java2
4 files changed, 101 insertions, 2 deletions
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 8f0d259b4..47a631ce3 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
@@ -84,7 +84,8 @@ public class AttributeCollector implements IAction {
}
// - insert the embedded attribute(s) into the container
- addOrUpdateAll(container.getResponse().getPersonalAttributeList(), newAttributes);
+ if (null != newAttributes)
+ addOrUpdateAll(container.getResponse().getPersonalAttributeList(), newAttributes);
// see if we need some more attributes
return processRequest(container, httpReq, httpResp, moasession, oaParam);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
index 5d13ccb45..cae5e698b 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/MandateAttributeRequestProvider.java
@@ -58,6 +58,9 @@ public class MandateAttributeRequestProvider implements AttributeProvider {
}
PersonalAttributeList result = new PersonalAttributeList();
//return result;
+
+
+
Logger.info("Thrown external request by: " + getAttrProviderName());
throw new ExternalAttributeRequestRequiredException(this);
}
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 077867fe0..c473e6f82 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
@@ -1,20 +1,112 @@
package at.gv.egovernment.moa.id.protocols.stork2;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
+import at.gv.egovernment.moa.id.auth.exception.AuthenticationException;
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;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
/**
*
*/
public class MandateRetrievalRequest implements IAction {
+
+ private AuthenticationSession moaSession;
+ private MOASTORKRequest moaStorkRequest;
+
public String processRequest(IRequest req, HttpServletRequest httpReq, HttpServletResponse httpResp, AuthenticationSession moasession) throws MOAIDException {
Logger.error("Entering mandateretrievalrequest");
+
+ this.moaSession = moasession;
+
+ if ((req instanceof MOASTORKRequest)) {
+ this.moaStorkRequest = (MOASTORKRequest)req;
+
+ } else {
+ return null; // TODO
+ }
+
+
+ if (moaStorkRequest.isAttrRequest() && moaStorkRequest.getStorkAttrQueryRequest() != null) {
+
+
+ Logger.debug("Entering AttributeRequest for MandateProvider");
+ httpResp.reset();
+
+ OAAuthParameter oaParam = AuthConfigurationProvider.getInstance().getOnlineApplicationParameter(moasession.getPublicOAURLPrefix());
+ if (oaParam == null)
+ throw new AuthenticationException("stork.12", new Object[]{moasession.getPublicOAURLPrefix()});
+
+ MOASTORKResponse moaStorkResponse = new MOASTORKResponse();
+ STORKAttrQueryResponse attrResponse = new STORKAttrQueryResponse();
+
+// moaStorkResponse.setPersonalAttributeList(populateAttributes());
+
+ //moaStorkResponse.setCountry(moaStorkRequest.getSpCountry());
+
+ IPersonalAttributeList sourceAttributeList = moaStorkRequest.getStorkAttrQueryRequest().getPersonalAttributeList();
+
+ IPersonalAttributeList attributeList = new PersonalAttributeList();
+
+ for (PersonalAttribute currentAttribute : sourceAttributeList) {
+ Logger.debug("Evaluationg currentattribute " + currentAttribute.getName());
+ if (currentAttribute.getName().equals("mandateContent")) {
+ PersonalAttribute mandateContent = new PersonalAttribute();
+ List<String> x = new ArrayList<String>();
+ x.add("12345234k32jekqwjeqwe");
+ mandateContent.setName(currentAttribute.getName());
+ mandateContent.setFriendlyName(currentAttribute.getFriendlyName());
+ mandateContent.setIsRequired(currentAttribute.isRequired());
+ mandateContent.setValue(x);
+ mandateContent.setStatus("Available");
+ attributeList.add(mandateContent);
+ Logger.debug("Setting currentattribute " + currentAttribute.getName());
+
+ }
+ }
+
+ attrResponse.setPersonalAttributeList(attributeList);
+ moaStorkResponse.setSTORKAttrResponse(attrResponse);
+
+ Logger.debug("Attributes " + moaStorkResponse.getStorkAttrQueryResponse().getPersonalAttributeList().size());
+
+ // Prepare extended attributes
+ Logger.debug("Preparing data container");
+
+ // create fresh container
+ DataContainer container = new DataContainer();
+
+ // - fill in the request we extracted above
+ container.setRequest(moaStorkRequest);
+
+ // - fill in the partial response created above
+ container.setResponse(moaStorkResponse);
+
+ 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);
+
+
+ //return (new AttributeCollector()).processRequest(container, httpReq, httpResp, moasession, oaParam);
+ }
+
+
+
return null; //
}
@@ -25,4 +117,7 @@ public class MandateRetrievalRequest implements IAction {
public String getDefaultActionName() {
return STORKProtocol.MANDATERETRIEVALREQUEST;
}
+
+
+
}
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java
index 2354d0eb1..ea7c0e475 100644
--- a/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java
+++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/auth/commons/STORKAuthnRequest.java
@@ -112,7 +112,7 @@ public final class STORKAuthnRequest implements Serializable, Cloneable {
* @param nAlias The SP's Certificate Alias.
*/
public void setAlias(final String nAlias) {
- this.alias = nAlias;
+ this.alias = nAlias;
}
/**