aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-03-12 09:57:37 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-03-12 10:03:55 +0100
commit3075521544ff79c5fa0d740c6b388bfeab58b8c5 (patch)
tree2be2f4fe84cadb823448704b388e363dc63b7148
parent921a14d46078fba6ee66addd9b0c40ae82081f9c (diff)
downloadmoa-id-spss-3075521544ff79c5fa0d740c6b388bfeab58b8c5.tar.gz
moa-id-spss-3075521544ff79c5fa0d740c6b388bfeab58b8c5.tar.bz2
moa-id-spss-3075521544ff79c5fa0d740c6b388bfeab58b8c5.zip
storing datacontainer in temporary storage before redirecting
-rw-r--r--id/server/auth/src/main/webapp/WEB-INF/urlrewrite.xml4
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ConsentEvaluator.java25
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java4
3 files changed, 31 insertions, 2 deletions
diff --git a/id/server/auth/src/main/webapp/WEB-INF/urlrewrite.xml b/id/server/auth/src/main/webapp/WEB-INF/urlrewrite.xml
index d6df363c5..461ff7efc 100644
--- a/id/server/auth/src/main/webapp/WEB-INF/urlrewrite.xml
+++ b/id/server/auth/src/main/webapp/WEB-INF/urlrewrite.xml
@@ -61,6 +61,10 @@
<to type="forward">/dispatcher?mod=id_stork2&amp;action=AttributeCollector&amp;%{query-string}</to>
</rule>
<rule match-type="regex">
+ <from>^/stork2/CompleteAuthentication$</from>
+ <to type="forward">/dispatcher?mod=id_stork2&amp;action=ConsentEvaluator&amp;%{query-string}</to>
+ </rule>
+ <rule match-type="regex">
<from>^/stork2/SendPEPSAuthnRequest$</from>
<to type="forward">/dispatcher?mod=id_stork2&amp;action=AuthenticationRequest&amp;%{query-string}</to>
</rule>
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 9745d81c5..8b7bcf0c6 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
@@ -1,21 +1,27 @@
package at.gv.egovernment.moa.id.protocols.stork2;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
import at.gv.egovernment.moa.id.auth.data.AuthenticationSession;
import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
import at.gv.egovernment.moa.id.auth.stork.VelocityProvider;
import at.gv.egovernment.moa.id.commons.db.ex.MOADatabaseException;
+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.id.storage.AssertionStorage;
import at.gv.egovernment.moa.logging.Logger;
import eu.stork.peps.auth.commons.PEPSUtil;
+import eu.stork.peps.auth.commons.PersonalAttribute;
import eu.stork.peps.auth.engine.STORKSAMLEngine;
import eu.stork.peps.exceptions.STORKSAMLEngineException;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
+import org.opensaml.common.impl.SecureRandomIdentifierGenerator;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -63,6 +69,25 @@ public class ConsentEvaluator implements IAction {
*/
public String requestConsent(DataContainer container, HttpServletResponse response, OAAuthParameter oaParam) throws MOAIDException {
// prepare redirect
+ String newArtifactId;
+ try {
+
+ // memorize the container again
+ Logger.debug("prepare putting the container into temporary storage...");
+
+ // - generate new key
+ newArtifactId = new SecureRandomIdentifierGenerator().generateIdentifier();
+
+ // - put container in temporary store.
+ AssertionStorage.getInstance().put(newArtifactId, container);
+
+ Logger.debug("...successful");
+
+ } catch (Exception e1) {
+ // TODO should we return the response as is to the PEPS?
+ Logger.error("Error putting incomplete Stork response into temporary storage", e1);
+ throw new MOAIDException("stork.17", null);
+ }
// ask for consent
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
index b1c923b9f..19d1c7f15 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/STORKProtocol.java
@@ -33,7 +33,7 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants {
static {
actions.put(AUTHENTICATIONREQUEST, new AuthenticationRequest());
actions.put(ATTRIBUTE_COLLECTOR, new AttributeCollector());
- actions.put(CONSENT_EVALUATOR, new ConsentEvaluatorSepp());
+ actions.put(CONSENT_EVALUATOR, new ConsentEvaluator());
}
public String getName() {
@@ -65,7 +65,7 @@ public class STORKProtocol implements IModulInfo, MOAIDAuthConstants {
MOASTORKRequest STORK2Request = new MOASTORKRequest();
- if (AttributeCollector.class.getSimpleName().equals(action) || ConsentEvaluatorSepp.class.getSimpleName().equals(action))
+ if (AttributeCollector.class.getSimpleName().equals(action) || ConsentEvaluator.class.getSimpleName().equals(action))
return STORK2Request;
//extract STORK Response from HTTP Request