aboutsummaryrefslogtreecommitdiff
path: root/id/server/idserverlib/src/main/java/at/gv/egovernment/moa
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-02-13 17:47:53 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-02-13 22:06:01 +0100
commita330b17e3ddc93181c8142b7c0ae871af528157f (patch)
treedf17e631dbf7d03abbe8c66809f6d3a77ab69894 /id/server/idserverlib/src/main/java/at/gv/egovernment/moa
parentd8302a2f7f3aae63593cd55bf0d5d4a4f9e5f55a (diff)
downloadmoa-id-spss-a330b17e3ddc93181c8142b7c0ae871af528157f.tar.gz
moa-id-spss-a330b17e3ddc93181c8142b7c0ae871af528157f.tar.bz2
moa-id-spss-a330b17e3ddc93181c8142b7c0ae871af528157f.zip
added ap logic #2
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/protocols/stork2/AttributeCollector.java6
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java14
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeRequestOngoingException.java5
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java5
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java13
-rw-r--r--id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java14
6 files changed, 45 insertions, 12 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 93204f2ab..30f7d3df2 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
@@ -89,7 +89,7 @@ public class AttributeCollector implements IAction {
}
}
- } catch (AttributeRequestOngoingException e) {
+ } catch (ExternalAttributeRequestRequiredException e) {
// the attribute request is ongoing and requires an external service.
try {
// memorize the container again
@@ -100,7 +100,9 @@ public class AttributeCollector implements IAction {
// - put container in temporary store.
AssertionStorage.getInstance().put(newArtifactId, container);
- // TODO - add container-key to httpresponse
+ // add container-key to redirect embedded within the return URL
+ // TODO find correct returnURL
+ e.getAp().performRedirect("returnURL");
} catch (Exception e1) {
// TODO should we return the response as is to the PEPS?
Logger.error("Error putting incomplete Stork response into temporary storage", e);
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java
index fd35b0c71..2c024e822 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProvider.java
@@ -1,6 +1,5 @@
package at.gv.egovernment.moa.id.protocols.stork2;
-import javax.activation.UnsupportedDataTypeException;
import javax.servlet.http.HttpServletRequest;
import eu.stork.peps.auth.commons.PersonalAttribute;
@@ -18,15 +17,24 @@ public interface AttributeProvider {
*
* @param attributeName the attribute name
* @return the personal attribute
- * @throws UnsupportedDataTypeException when the provider cannot acquire the specified attribute
+ * @throws UnsupportedAttributeException the unsupported attribute exception
+ * @throws ExternalAttributeRequestRequiredException an attribute request to an external service has to be done
*/
- public PersonalAttribute acquire(String attributeName) throws UnsupportedAttributeException, AttributeRequestOngoingException;
+ public PersonalAttribute acquire(String attributeName) throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException;
/**
+ * Perform redirect.
+ *
+ * @param url the return URL ending with ?artifactId=...
+ */
+ public void performRedirect(String url);
+
+ /**
* Parses the response we got from the external attribute provider.
*
* @param httpReq the http req
* @return the personal attribute
*/
public PersonalAttribute parse(HttpServletRequest httpReq);
+
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeRequestOngoingException.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeRequestOngoingException.java
deleted file mode 100644
index be5a53f34..000000000
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeRequestOngoingException.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package at.gv.egovernment.moa.id.protocols.stork2;
-
-public class AttributeRequestOngoingException extends Exception {
-
-}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java
index 23afc2544..978fa635c 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoNoRedirectAttributeProvider.java
@@ -29,4 +29,9 @@ public class DemoNoRedirectAttributeProvider implements AttributeProvider {
return null;
}
+ @Override
+ public void performRedirect(String url) {
+ // we should not get here
+ }
+
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java
index f44fbed07..13b113711 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/DemoRedirectAttributeProvider.java
@@ -16,8 +16,8 @@ public class DemoRedirectAttributeProvider implements AttributeProvider {
*/
@Override
public PersonalAttribute acquire(String attributeName)
- throws UnsupportedAttributeException, AttributeRequestOngoingException {
- throw new AttributeRequestOngoingException();
+ throws UnsupportedAttributeException, ExternalAttributeRequestRequiredException {
+ throw new ExternalAttributeRequestRequiredException(this);
}
/* (non-Javadoc)
@@ -28,4 +28,13 @@ public class DemoRedirectAttributeProvider implements AttributeProvider {
return new PersonalAttribute("sepp", true, new ArrayList<String>(), "");
}
+ /* (non-Javadoc)
+ * @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#performRedirect(java.lang.String)
+ */
+ @Override
+ public void performRedirect(String url) {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java
new file mode 100644
index 000000000..29b09487b
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/ExternalAttributeRequestRequiredException.java
@@ -0,0 +1,14 @@
+package at.gv.egovernment.moa.id.protocols.stork2;
+
+public class ExternalAttributeRequestRequiredException extends Exception {
+ private AttributeProvider ap;
+
+ public ExternalAttributeRequestRequiredException(AttributeProvider provider) {
+ ap = provider;
+ }
+
+ public AttributeProvider getAp() {
+ return ap;
+ }
+
+}