aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule_id-austria/src
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule_id-austria/src')
-rw-r--r--eidas_modules/authmodule_id-austria/src/main/java/at/asitplus/eidas/specific/modules/auth/idaustria/tasks/RequestIdAustriaSystemTask.java9
-rw-r--r--eidas_modules/authmodule_id-austria/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/task/RequestIdAustriaSystemTaskTest.java32
2 files changed, 34 insertions, 7 deletions
diff --git a/eidas_modules/authmodule_id-austria/src/main/java/at/asitplus/eidas/specific/modules/auth/idaustria/tasks/RequestIdAustriaSystemTask.java b/eidas_modules/authmodule_id-austria/src/main/java/at/asitplus/eidas/specific/modules/auth/idaustria/tasks/RequestIdAustriaSystemTask.java
index 555f4e47..0c91345f 100644
--- a/eidas_modules/authmodule_id-austria/src/main/java/at/asitplus/eidas/specific/modules/auth/idaustria/tasks/RequestIdAustriaSystemTask.java
+++ b/eidas_modules/authmodule_id-austria/src/main/java/at/asitplus/eidas/specific/modules/auth/idaustria/tasks/RequestIdAustriaSystemTask.java
@@ -180,10 +180,13 @@ public class RequestIdAustriaSystemTask extends AbstractAuthServletTask {
log.debug("Set mandate-profiles attribute into ID-Austria request");
injectAttribute(attributs, ExtendedPvpAttributeDefinitions.SP_USED_MANDATE_PROFILES_NAME,
StringUtils.join(mandateProfiles, ","));
-
+
}
-
- //TODO: set force-mandates flag
+
+ // inject mandate mode attribute
+ injectAttribute(attributs, ExtendedPvpAttributeDefinitions.SP_USED_MANDATE_TYPE_NAME,
+ pendingReq.getServiceProviderConfiguration(ServiceProviderConfiguration.class).getMandateMode().getMode());
+
return attributs;
}
diff --git a/eidas_modules/authmodule_id-austria/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/task/RequestIdAustriaSystemTaskTest.java b/eidas_modules/authmodule_id-austria/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/task/RequestIdAustriaSystemTaskTest.java
index 6dc8d415..92aece46 100644
--- a/eidas_modules/authmodule_id-austria/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/task/RequestIdAustriaSystemTaskTest.java
+++ b/eidas_modules/authmodule_id-austria/src/test/java/at/asitplus/eidas/specific/modules/auth/idaustria/test/task/RequestIdAustriaSystemTaskTest.java
@@ -40,6 +40,7 @@ import at.asitplus.eidas.specific.modules.auth.idaustria.utils.IdAustriaAuthMeta
import at.asitplus.eidas.specific.modules.msproxyservice.protocol.ProxyServicePendingRequest;
import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
+import at.gv.egiz.eaaf.core.api.data.ExtendedPvpAttributeDefinitions.SpMandateModes;
import at.gv.egiz.eaaf.core.api.gui.IVelocityGuiBuilderConfiguration;
import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
import at.gv.egiz.eaaf.core.api.storage.ITransactionStorage;
@@ -213,7 +214,7 @@ public class RequestIdAustriaSystemTaskTest {
//validate state
final EaafRequestedAttributes reqAttr = validate();
- Assert.assertEquals("#Req Attribute", 3, reqAttr.getAttributes().size());
+ Assert.assertEquals("#Req Attribute", 4, reqAttr.getAttributes().size());
Assert.assertEquals("Wrong req attr.", "urn:eidgvat:attributes.eidas.uniqueId",
reqAttr.getAttributes().get(0).getName());
@@ -245,6 +246,17 @@ public class RequestIdAustriaSystemTaskTest {
Assert.assertEquals("Req. Attr. Value", "http://eidas.europa.eu/LoA/high",
((XSString)reqAttr.getAttributes().get(2).getAttributeValues().get(0)).getValue());
+ Assert.assertEquals("Wrong req attr.", "urn:eidgvat:attributes.ServiceProviderMandateType",
+ reqAttr.getAttributes().get(3).getName());
+ Assert.assertNotNull("Req. Attr value element", reqAttr.getAttributes().get(3).getAttributeValues());
+ Assert.assertEquals("#Req. Attr value", 1,
+ reqAttr.getAttributes().get(3).getAttributeValues().size());
+ org.springframework.util.Assert.isInstanceOf(XSString.class,
+ reqAttr.getAttributes().get(3).getAttributeValues().get(0), "Wrong requested Attributes Value type");
+ Assert.assertEquals("Req. Attr. Value",
+ pendingReq.getServiceProviderConfiguration(ServiceProviderConfiguration.class).getMandateMode().getMode(),
+ ((XSString)reqAttr.getAttributes().get(3).getAttributeValues().get(0)).getValue());
+
}
@Test
@@ -269,7 +281,7 @@ public class RequestIdAustriaSystemTaskTest {
//validate state
final EaafRequestedAttributes reqAttr = validate();
- Assert.assertEquals("#Req Attribute", 5, reqAttr.getAttributes().size());
+ Assert.assertEquals("#Req Attribute", 6, reqAttr.getAttributes().size());
Assert.assertEquals("Wrong req attr.", "urn:eidgvat:attributes.ServiceProviderFriendlyName",
reqAttr.getAttributes().get(3).getName());
@@ -313,13 +325,13 @@ public class RequestIdAustriaSystemTaskTest {
List<String> mandateProfiles = Arrays.asList(
RandomStringUtils.randomAlphabetic(5), RandomStringUtils.randomAlphabetic(5));
oaParam.setMandateProfiles(mandateProfiles);
-
+ oaParam.setMandateMode(SpMandateModes.LEGAL_FORCE);
//execute test
task.execute(pendingReq, executionContext);
//validate state
final EaafRequestedAttributes reqAttr = validate();
- Assert.assertEquals("#Req Attribute", 6, reqAttr.getAttributes().size());
+ Assert.assertEquals("#Req Attribute", 7, reqAttr.getAttributes().size());
Assert.assertEquals("Wrong req attr.", "urn:eidgvat:attributes.ServiceProviderMandateProfiles",
reqAttr.getAttributes().get(5).getName());
@@ -333,6 +345,18 @@ public class RequestIdAustriaSystemTaskTest {
((XSString)reqAttr.getAttributes().get(5).getAttributeValues().get(0)).getValue());
reqProfiles.stream().forEach(el -> assertTrue("missing profile: " + el, mandateProfiles.contains(el)));
+
+ Assert.assertEquals("Wrong req attr.", "urn:eidgvat:attributes.ServiceProviderMandateType",
+ reqAttr.getAttributes().get(6).getName());
+ Assert.assertNotNull("Req. Attr value element", reqAttr.getAttributes().get(6).getAttributeValues());
+ Assert.assertEquals("#Req. Attr value", 1,
+ reqAttr.getAttributes().get(6).getAttributeValues().size());
+ org.springframework.util.Assert.isInstanceOf(XSString.class,
+ reqAttr.getAttributes().get(6).getAttributeValues().get(0), "Wrong requested Attributes Value type");
+ Assert.assertEquals("Req. Attr. Value",
+ SpMandateModes.LEGAL_FORCE.getMode(),
+ ((XSString)reqAttr.getAttributes().get(6).getAttributeValues().get(0)).getValue());
+
}
private EaafRequestedAttributes validate() throws Pvp2InternalErrorException, SecurityException, Exception {