diff options
Diffstat (limited to 'id/server/idserverlib/src/main/java/at/gv')
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; + } + +} |