diff options
author | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2015-08-10 16:52:00 +0200 |
---|---|---|
committer | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2015-08-10 16:53:53 +0200 |
commit | 2b8c631a8ef6d6970a482914e41c59f37e3a6d08 (patch) | |
tree | a81b4c3247d1c65a3a9992f787511a5a0579e519 | |
parent | 496ba9bb6e150ad67c5c628c1c97f30d6da81dfb (diff) | |
download | moa-id-spss-2b8c631a8ef6d6970a482914e41c59f37e3a6d08.tar.gz moa-id-spss-2b8c631a8ef6d6970a482914e41c59f37e3a6d08.tar.bz2 moa-id-spss-2b8c631a8ef6d6970a482914e41c59f37e3a6d08.zip |
approved tests
22 files changed, 3443 insertions, 3077 deletions
diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java index 65f1f2247..3d0aa4d45 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeProvidersMapTestCase.java @@ -15,120 +15,121 @@ import eu.stork.peps.auth.commons.PersonalAttributeList; /**
* The AttributeSource's Test Case.
- *
- * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr)
- *
+ *
+ * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos
+ * (ilias@aegean.gr)
+ *
* @version $Revision: $, $Date: $
*/
public class AttributeProvidersMapTestCase {
- @Test
- public void testObjectOK1() {
- final IAttributeProvidersMap map = new AttributeProvidersMap();
- final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final IPersonalAttributeList pal = new PersonalAttributeList();
- boolean outcome = false;
-
- // Add a single item
- map.put(source, pal);
-
- if (map.containsKey(source)) {
- outcome = true;
- }
-
- assertTrue(outcome);
- }
-
- @Test
- public void testObjectOK2() {
- final IAttributeProvidersMap map = new AttributeProvidersMap();
- final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final IPersonalAttributeList pal = new PersonalAttributeList();
- boolean outcome = false;
-
- // Add a single item
- map.put(source, pal);
-
- if (map.containsKey(source)) {
- if (map.get(source) != null) {
- outcome = true;
- }
- }
-
- assertTrue(outcome);
- }
-
- @Test
- public void testObjectOK3() {
- final IAttributeProvidersMap map = new AttributeProvidersMap();
- final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final AttributeSource target = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final IPersonalAttributeList pal = new PersonalAttributeList();
- boolean outcome = false;
-
- // Add a single item
- map.put(source, pal);
-
- if (map.containsKey(target)) {
- outcome = true;
- }
-
- assertTrue(outcome);
- }
-
- @Test
- public void testObjectOK4() {
- final IAttributeProvidersMap map = new AttributeProvidersMap();
- final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final AttributeSource target = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final IPersonalAttributeList pal = new PersonalAttributeList();
- boolean outcome = false;
-
- // Add a single item
- map.put(source, pal);
-
- if (map.containsKey(target)) {
- if (map.get(target) != null) {
- outcome = true;
- }
- }
-
- assertTrue(outcome);
- }
-
- @Test
- public void testObjectNOK1() {
- final IAttributeProvidersMap map = new AttributeProvidersMap();
- final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final AttributeSource target = new AttributeSource(new Country("ID1", "Name 1"), "URL");
- final IPersonalAttributeList pal = new PersonalAttributeList();
- boolean outcome = false;
-
- // Add a single item
- map.put(source, pal);
-
- if (map.containsKey(target)) {
- outcome = true;
- }
-
- assertFalse(outcome);
- }
-
- @Test
- public void testObjectNOK2() {
- final IAttributeProvidersMap map = new AttributeProvidersMap();
- final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
- final AttributeSource target = new AttributeSource(new AttributeProvider("ID2", "Name 1", null), "URL");
- final IPersonalAttributeList pal = new PersonalAttributeList();
- boolean outcome = false;
-
- // Add a single item
- map.put(source, pal);
-
- if (map.containsKey(target)) {
- outcome = true;
- }
-
- assertFalse(outcome);
- }
+ @Test
+ public void testObjectOK1() {
+ final IAttributeProvidersMap map = new AttributeProvidersMap();
+ final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ boolean outcome = false;
+
+ //Add a single item
+ map.put(source, pal);
+
+ if (map.containsKey(source)) {
+ outcome = true;
+ }
+
+ assertTrue(outcome);
+ }
+
+ @Test
+ public void testObjectOK2() {
+ final IAttributeProvidersMap map = new AttributeProvidersMap();
+ final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ boolean outcome = false;
+
+ //Add a single item
+ map.put(source, pal);
+
+ if (map.containsKey(source)) {
+ if (map.get(source) != null) {
+ outcome = true;
+ }
+ }
+
+ assertTrue(outcome);
+ }
+
+ @Test
+ public void testObjectOK3() {
+ final IAttributeProvidersMap map = new AttributeProvidersMap();
+ final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final AttributeSource target = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ boolean outcome = false;
+
+ //Add a single item
+ map.put(source, pal);
+
+ if (map.containsKey(target)) {
+ outcome = true;
+ }
+
+ assertTrue(outcome);
+ }
+
+ @Test
+ public void testObjectOK4() {
+ final IAttributeProvidersMap map = new AttributeProvidersMap();
+ final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final AttributeSource target = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ boolean outcome = false;
+
+ //Add a single item
+ map.put(source, pal);
+
+ if (map.containsKey(target)) {
+ if (map.get(target) != null) {
+ outcome = true;
+ }
+ }
+
+ assertTrue(outcome);
+ }
+
+ @Test
+ public void testObjectNOK1() {
+ final IAttributeProvidersMap map = new AttributeProvidersMap();
+ final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final AttributeSource target = new AttributeSource(new Country("ID1", "Name 1"), "URL");
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ boolean outcome = false;
+
+ //Add a single item
+ map.put(source, pal);
+
+ if (map.containsKey(target)) {
+ outcome = true;
+ }
+
+ assertFalse(outcome);
+ }
+
+ @Test
+ public void testObjectNOK2() {
+ final IAttributeProvidersMap map = new AttributeProvidersMap();
+ final AttributeSource source = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL");
+ final AttributeSource target = new AttributeSource(new AttributeProvider("ID2", "Name 1", null), "URL");
+ final IPersonalAttributeList pal = new PersonalAttributeList();
+ boolean outcome = false;
+
+ //Add a single item
+ map.put(source, pal);
+
+ if (map.containsKey(target)) {
+ outcome = true;
+ }
+
+ assertFalse(outcome);
+ }
}
diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java index e0f685ade..a3fb6468f 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeSourceTestCase.java @@ -11,78 +11,80 @@ import eu.stork.peps.auth.commons.Country; /**
* The AttributeSource's Test Case.
- *
- * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos (ilias@aegean.gr)
- *
+ *
+ * @author Stelios Lelis (stelios.lelis@aegean.gr), Elias Pastos
+ * (ilias@aegean.gr)
+ *
* @version $Revision: $, $Date: $
*/
public final class AttributeSourceTestCase {
- private final AttributeSource ap1 = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL1");
- private final AttributeSource ap2 = new AttributeSource(new AttributeProvider("ID2", "Name 2", null), "URL2");
- private final AttributeSource ap3 = new AttributeSource(new AttributeProvider("ID1", "Name 2", null), "URL2");
- private final AttributeSource ap4 = new AttributeSource(new AttributeProvider("ID1", "Name 2", null), "URL1");
- private final AttributeSource ap5 = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL1");
-
- private final AttributeSource c1 = new AttributeSource(new Country("ID1", "Name 1"), "URL1");
- private final AttributeSource c2 = new AttributeSource(new Country("ID2", "Name 2"), "URL2");
- private final AttributeSource c3 = new AttributeSource(new Country("ID1", "Name 2"), "URL2");
- private final AttributeSource c4 = new AttributeSource(new Country("ID1", "Name 2"), "URL1");
- private final AttributeSource c5 = new AttributeSource(new Country("ID1", "Name 1"), "URL1");
-
- @Test
- public void testNotEquals1() {
- assertFalse(ap1.equals(ap2));
- }
-
- @Test
- public void testNotEquals2() {
- assertFalse(ap1.equals(c1));
- }
-
- @Test
- public void testNotEquals3() {
- assertFalse(c1.equals(c2));
- }
-
- @Test
- public void testEquals1() {
- assertTrue(ap1.equals(ap3));
- }
-
- @Test
- public void testEquals2() {
- assertTrue(ap1.equals(ap4));
- }
-
- @Test
- public void testEquals3() {
- assertTrue(ap1.equals(ap5));
- }
-
- @Test
- public void testEquals4() {
- assertTrue(c1.equals(c3));
- }
-
- @Test
- public void testEquals5() {
- assertTrue(c1.equals(c4));
- }
-
- @Test
- public void testEquals6() {
- assertTrue(c1.equals(c5));
- }
-
- @Test
- public void testEquals7() {
- final Object obj = ap5;
- assertTrue(ap1.equals(obj));
- }
-
- @Test
- public void testEquals8() {
- final Object obj = c5;
- assertTrue(c1.equals(obj));
- }
+
+ private final AttributeSource ap1 = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL1");
+ private final AttributeSource ap2 = new AttributeSource(new AttributeProvider("ID2", "Name 2", null), "URL2");
+ private final AttributeSource ap3 = new AttributeSource(new AttributeProvider("ID1", "Name 2", null), "URL2");
+ private final AttributeSource ap4 = new AttributeSource(new AttributeProvider("ID1", "Name 2", null), "URL1");
+ private final AttributeSource ap5 = new AttributeSource(new AttributeProvider("ID1", "Name 1", null), "URL1");
+
+ private final AttributeSource c1 = new AttributeSource(new Country("ID1", "Name 1"), "URL1");
+ private final AttributeSource c2 = new AttributeSource(new Country("ID2", "Name 2"), "URL2");
+ private final AttributeSource c3 = new AttributeSource(new Country("ID1", "Name 2"), "URL2");
+ private final AttributeSource c4 = new AttributeSource(new Country("ID1", "Name 2"), "URL1");
+ private final AttributeSource c5 = new AttributeSource(new Country("ID1", "Name 1"), "URL1");
+
+ @Test
+ public void testNotEquals1() {
+ assertFalse(ap1.innerEquals(ap2));
+ }
+
+ @Test
+ public void testNotEquals2() {
+ assertFalse(ap1.innerEquals(c1));
+ }
+
+ @Test
+ public void testNotEquals3() {
+ assertFalse(c1.innerEquals(c2));
+ }
+
+ @Test
+ public void testEquals1() {
+ assertTrue(ap1.innerEquals(ap3));
+ }
+
+ @Test
+ public void testEquals2() {
+ assertTrue(ap1.innerEquals(ap4));
+ }
+
+ @Test
+ public void testEquals3() {
+ assertTrue(ap1.innerEquals(ap5));
+ }
+
+ @Test
+ public void testEquals4() {
+ assertTrue(c1.innerEquals(c3));
+ }
+
+ @Test
+ public void testEquals5() {
+ assertTrue(c1.innerEquals(c4));
+ }
+
+ @Test
+ public void testEquals6() {
+ assertTrue(c1.innerEquals(c5));
+ }
+
+ @Test
+ public void testEquals7() {
+ final Object obj = ap5;
+ assertTrue(ap1.equals(obj));
+ }
+
+ @Test
+ public void testEquals8() {
+ final Object obj = c5;
+ assertTrue(c1.equals(obj));
+ }
}
diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java index 6f3e5273a..524a7446c 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/AttributeUtilTestCase.java @@ -31,448 +31,507 @@ import eu.stork.peps.auth.commons.PersonalAttributeList; /** * The AttributeUtil's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, luis.felix@multicert.com - * + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com + * * @version $Revision: $, $Date: $ */ public final class AttributeUtilTestCase { - /** - * Empty String to be used on the tests. - */ - private static final String EMPTY_STRING = ""; - - /** - * Tuple value sample to be used on the tests. - */ - private static final String[] TUPLE_STRING = new String[] { "age", "true", "[18]", "Available" }; - - /** - * Complex value to be used on escape/unescape tests. - */ - private static final String COMPLEX_VAL = "postalCode=4100," + "apartmentNumber=A,state=Porto,countryCodeAddress=PT,streetNumber=379," + "streetName=Avenida Sidonio Pais,town=Porto,"; - - /** - * Escaped Complex value to be used on escape/unescape tests. - */ - private static final String ESC_COMPLEX_VAL = "postalCode=4100%44" + "apartmentNumber=A%44state=Porto%44countryCodeAddress=PT%44" - + "streetNumber=379%44streetName=Avenida Sidonio Pais%44town=Porto%44"; - - /** - * Simple value to be used on escape/unescape tests. - */ - private static final String SIMPLE_VAL = "Avenida da Boavista, Porto"; - - /** - * Escaped simple value to be used on escape/unescape tests. - */ - private static final String ESC_SIMPLE_VAL = "Avenida da Boavista%44 Porto"; - - /** - * Simple text to be used on escape/unescape tests. Must match the escaped text. - */ - private static final String SIMPLE_TEXT = "John Doe"; - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given complex attribute value (canonical address' example attribute value). - */ - @Test - public void testEscapeSpecialCharsComplexVal() { - assertEquals(AttributeUtil.escape(COMPLEX_VAL), ESC_COMPLEX_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given attribute value. - */ - @Test - public void testEscapeSpecialCharsVal() { - assertEquals(AttributeUtil.escape(SIMPLE_VAL), ESC_SIMPLE_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given simple text: no special characters to escape. - */ - @Test - public void testEscapeNormalChars() { - assertEquals(AttributeUtil.escape(SIMPLE_TEXT), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#unescape(String)} method for the given escape complex attribute value (canonical address' example attribute value). - */ - @Test - public void testUnescapeSpecialCharsComplexVal() { - assertEquals(AttributeUtil.unescape(ESC_COMPLEX_VAL), COMPLEX_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given escape attribute value. - */ - @Test - public void testUnescapeSpecialCharsVal() { - assertEquals(AttributeUtil.unescape(ESC_SIMPLE_VAL), SIMPLE_VAL); - } - - /** - * Tests the {@link AttributeUtil#escape(String)} method for the given simple text: no special characters to unescape. - */ - @Test - public void testUnescapeNormalChars() { - assertEquals(AttributeUtil.unescape(SIMPLE_TEXT), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} method for the given empty string. - */ - @Test - public void testAppendIfNotNullEmptyStr() { - final StringBuilder strBuilder = new StringBuilder(SIMPLE_TEXT); - AttributeUtil.appendIfNotNull(strBuilder, EMPTY_STRING); - assertEquals(strBuilder.toString(), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} method for the given string. - */ - @Test - public void testAppendIfNotNullStr() { - final StringBuilder strBuilder = new StringBuilder(); - AttributeUtil.appendIfNotNull(strBuilder, SIMPLE_TEXT); - assertEquals(strBuilder.toString(), SIMPLE_TEXT); - } - - /** - * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} method for the given null value. - */ - @Test - public void testAppendIfNotNull() { - final StringBuilder strBuilder = new StringBuilder(); - AttributeUtil.appendIfNotNull(strBuilder, null); - assertEquals(strBuilder.toString(), EMPTY_STRING); - } - - /** - * Tests the {@link AttributeUtil#listToString(List, String)} method for the given List with two values. - */ - @Test - public void testListToStringTwoVals() { - final List<String> vals = new ArrayList<String>(); - vals.add(SIMPLE_VAL); - vals.add(SIMPLE_TEXT); - - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append(SIMPLE_TEXT); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - assertEquals(AttributeUtil.listToString(vals, PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#listToString(List, String)} method for the given List with one values. - */ - @Test - public void testListToStringOneVal() { - final List<String> vals = new ArrayList<String>(); - vals.add(SIMPLE_VAL); - - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - assertEquals(AttributeUtil.listToString(vals, PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#listToString(List, String)} method for the given List with one value. - */ - @Test - public void testListToStringEmptyVal() { - final List<String> vals = new ArrayList<String>(); - - final StringBuilder strBuilder = new StringBuilder(); - - assertEquals(AttributeUtil.listToString(vals, PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method for the given Map with one value. - */ - @Test - public void testMapToStringOneVal() { - final Map<String, String> vals = new HashMap<String, String>(); - vals.put("CanonicalAddress", COMPLEX_VAL); - - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("CanonicalAddress="); - strBuilder.append(ESC_COMPLEX_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - - assertEquals(AttributeUtil.mapToString(vals, PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method for the given empty Map. - */ - @Test - public void testMapToStringEmptyVal() { - final Map<String, String> vals = new HashMap<String, String>(); - - final StringBuilder strBuilder = new StringBuilder(); - - assertEquals(AttributeUtil.mapToString(vals, PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given invalid List. - */ - @Test - public void testIsValidValueInvalidList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append("]"); - assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given null value. - */ - @Test - public void testIsValidValueNullList() { - assertFalse(AttributeUtil.isValidValue(null)); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given empty List. - */ - @Test - public void testIsValidValueEmptyList() { - assertTrue(AttributeUtil.isValidValue("[]")); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given empty List. - */ - @Test - public void testIsValidValueEmptyCommaList() { - assertTrue(AttributeUtil.isValidValue("[,]")); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given one simple value List. - */ - @Test - public void testIsValidValueOneValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given one simple value List. - */ - @Test - public void testIsValidValueOneValueCommaList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given one complex value List. - */ - @Test - public void testIsValidValueOneComplexValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_COMPLEX_VAL); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given one complex value List. - */ - @Test - public void testIsValidValueOneComplexValueCommaList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_COMPLEX_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given multi value List. - */ - @Test - public void testIsValidValueMultiValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append("["); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append(SIMPLE_TEXT); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidValue(String)} method for the given invalid multi value List. - */ - @Test - public void testIsValidValueInvalidMultiValueList() { - final StringBuilder strBuilder = new StringBuilder(); - strBuilder.append(ESC_SIMPLE_VAL); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append(SIMPLE_TEXT); - strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); - strBuilder.append("]"); - assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given true type. - */ - @Test - public void testIsValidTypetrue() { - assertTrue(AttributeUtil.isValidType("true")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given True type. - */ - @Test - public void testIsValidTypeTrue() { - assertTrue(AttributeUtil.isValidType("True")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given TRUE type. - */ - @Test - public void testIsValidTypeTRUE() { - assertTrue(AttributeUtil.isValidType("TRUE")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given invalid type. - */ - @Test - public void testIsValidTypeInvalidType() { - assertFalse(AttributeUtil.isValidType("str")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given false type. - */ - @Test - public void testIsValidTypefalse() { - assertTrue(AttributeUtil.isValidType("false")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given False type. - */ - @Test - public void testIsValidTypeFalse() { - assertTrue(AttributeUtil.isValidType("False")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given FALSE type. - */ - @Test - public void testIsValidTypeFALSEVal() { - assertTrue(AttributeUtil.isValidType("False")); - } - - /** - * Tests the {@link AttributeUtil#isValidType(String)} method for the given null. - */ - @Test - public void testIsValidTypeNullVal() { - assertFalse(AttributeUtil.isValidType(null)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the given valid tuple. - */ - @Test - public void testHasValidTuples() { - assertTrue(AttributeUtil.hasValidTuples(TUPLE_STRING)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the given invalid tuple. - */ - @Test - public void testHasValidTuplesInvalid() { - final String[] tuple = new String[] { "name", "type" }; - assertFalse(AttributeUtil.hasValidTuples(tuple)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the given invalid tuple with valid size. - */ - @Test - public void testHasValidTuplesSameSizeInvalidValues() { - final String[] tuple = new String[] { "age", "type", "[18]", "Available" }; - assertFalse(AttributeUtil.hasValidTuples(tuple)); - } - - /** - * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the given null value. - */ - @Test - public void testHasValidTuplesNull() { - assertFalse(AttributeUtil.hasValidTuples(null)); - } - - /** - * Tests the {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} method for the given attribute list.. - */ - @Test - public void testCheckMandatoryAttributes() { - final IPersonalAttributeList attrList = new PersonalAttributeList(); - attrList.populate("isAgeOver:true:[18,]:Available;"); - assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); - - } - - /** - * Tests the {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} method for the given null value. - */ - @Test(expected = NullPointerException.class) - public void testCheckMandatoryAttributesNullAttrList() { - assertTrue(AttributeUtil.checkMandatoryAttributes(null)); - } - - /** - * Tests the {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} method for the given empty attribute list. - */ - @Test - public void testCheckMandatoryAttributesEmptyAttrList() { - final IPersonalAttributeList attrList = new PersonalAttributeList(); - assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); - } - - /** - * Tests the {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} method for the given attribute list (missing mandatory attribute). - */ - @Test - public void testCheckMandatoryAttributesMissingAttr() { - final IPersonalAttributeList attrList = new PersonalAttributeList(); - attrList.populate("isAgeOver:true:[]:NotAvailable;"); - assertFalse(AttributeUtil.checkMandatoryAttributes(attrList)); - } + /** + * Empty String to be used on the tests. + */ + private static final String EMPTY_STRING = ""; + + /** + * Tuple value sample to be used on the tests. + */ + private static final String[] TUPLE_STRING = new String[]{"age", "true", + "[18]", "Available"}; + + /** + * Complex value to be used on escape/unescape tests. + */ + private static final String COMPLEX_VAL = "postalCode=4100," + + "apartmentNumber=A,state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto,"; + + /** + * Escaped Complex value to be used on escape/unescape tests. + */ + private static final String ESC_COMPLEX_VAL = "postalCode=4100%44" + + "apartmentNumber=A%44state=Porto%44countryCodeAddress=PT%44" + + "streetNumber=379%44streetName=Avenida Sidonio Pais%44town=Porto%44"; + + /** + * Simple value to be used on escape/unescape tests. + */ + private static final String SIMPLE_VAL = "Avenida da Boavista, Porto"; + + /** + * Escaped simple value to be used on escape/unescape tests. + */ + private static final String ESC_SIMPLE_VAL = "Avenida da Boavista%44 Porto"; + + /** + * Simple text to be used on escape/unescape tests. Must match the escaped + * text. + */ + private static final String SIMPLE_TEXT = "John Doe"; + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * complex attribute value (canonical address' example attribute value). + */ + @Test + public void testEscapeSpecialCharsComplexVal() { + assertEquals(AttributeUtil.escape(COMPLEX_VAL), ESC_COMPLEX_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * attribute value. + */ + @Test + public void testEscapeSpecialCharsVal() { + assertEquals(AttributeUtil.escape(SIMPLE_VAL), ESC_SIMPLE_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * simple text: no special characters to escape. + */ + @Test + public void testEscapeNormalChars() { + assertEquals(AttributeUtil.escape(SIMPLE_TEXT), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#unescape(String)} method for the given + * escape complex attribute value (canonical address' example attribute + * value). + */ + @Test + public void testUnescapeSpecialCharsComplexVal() { + assertEquals(AttributeUtil.unescape(ESC_COMPLEX_VAL), COMPLEX_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * escape attribute value. + */ + @Test + public void testUnescapeSpecialCharsVal() { + assertEquals(AttributeUtil.unescape(ESC_SIMPLE_VAL), SIMPLE_VAL); + } + + /** + * Tests the {@link AttributeUtil#escape(String)} method for the given + * simple text: no special characters to unescape. + */ + @Test + public void testUnescapeNormalChars() { + assertEquals(AttributeUtil.unescape(SIMPLE_TEXT), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given empty string. + */ + @Test + public void testAppendIfNotNullEmptyStr() { + final StringBuilder strBuilder = new StringBuilder(SIMPLE_TEXT); + AttributeUtil.appendIfNotNull(strBuilder, EMPTY_STRING); + assertEquals(strBuilder.toString(), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given string. + */ + @Test + public void testAppendIfNotNullStr() { + final StringBuilder strBuilder = new StringBuilder(); + AttributeUtil.appendIfNotNull(strBuilder, SIMPLE_TEXT); + assertEquals(strBuilder.toString(), SIMPLE_TEXT); + } + + /** + * Tests the {@link AttributeUtil#appendIfNotNull(StringBuilder, Object)} + * method for the given null value. + */ + @Test + public void testAppendIfNotNull() { + final StringBuilder strBuilder = new StringBuilder(); + AttributeUtil.appendIfNotNull(strBuilder, null); + assertEquals(strBuilder.toString(), EMPTY_STRING); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with two values. + */ + @Test + public void testListToStringTwoVals() { + final List<String> vals = new ArrayList<String>(); + vals.add(SIMPLE_VAL); + vals.add(SIMPLE_TEXT); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with one values. + */ + @Test + public void testListToStringOneVal() { + final List<String> vals = new ArrayList<String>(); + vals.add(SIMPLE_VAL); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#listToString(List, String)} method for the + * given List with one value. + */ + @Test + public void testListToStringEmptyVal() { + final List<String> vals = new ArrayList<String>(); + + final StringBuilder strBuilder = new StringBuilder(); + + assertEquals( + AttributeUtil.listToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method + * for the given Map with one value. + */ + @Test + public void testMapToStringOneVal() { + final Map<String, String> vals = new HashMap<String, String>(); + vals.put("CanonicalAddress", COMPLEX_VAL); + + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("CanonicalAddress="); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + + assertEquals(AttributeUtil.mapToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#mapToString(java.util.Map, String)} method + * for the given empty Map. + */ + @Test + public void testMapToStringEmptyVal() { + final Map<String, String> vals = new HashMap<String, String>(); + + final StringBuilder strBuilder = new StringBuilder(); + + assertEquals(AttributeUtil.mapToString(vals, + PEPSValues.ATTRIBUTE_VALUE_SEP.toString()), strBuilder.toString()); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * invalid List. + */ + @Test + public void testIsValidValueInvalidList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append("]"); + assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * null value. + */ + @Test + public void testIsValidValueNullList() { + assertFalse(AttributeUtil.isValidValue(null)); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * empty List. + */ + @Test + public void testIsValidValueEmptyList() { + assertTrue(AttributeUtil.isValidValue("[]")); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * empty List. + */ + @Test + public void testIsValidValueEmptyCommaList() { + assertTrue(AttributeUtil.isValidValue("[,]")); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one simple value List. + */ + @Test + public void testIsValidValueOneValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one simple value List. + */ + @Test + public void testIsValidValueOneValueCommaList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one complex value List. + */ + @Test + public void testIsValidValueOneComplexValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * one complex value List. + */ + @Test + public void testIsValidValueOneComplexValueCommaList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_COMPLEX_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * multi value List. + */ + @Test + public void testIsValidValueMultiValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append("["); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertTrue(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidValue(String)} method for the given + * invalid multi value List. + */ + @Test + public void testIsValidValueInvalidMultiValueList() { + final StringBuilder strBuilder = new StringBuilder(); + strBuilder.append(ESC_SIMPLE_VAL); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append(SIMPLE_TEXT); + strBuilder.append(PEPSValues.ATTRIBUTE_VALUE_SEP.toString()); + strBuilder.append("]"); + assertFalse(AttributeUtil.isValidValue(strBuilder.toString())); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * true type. + */ + @Test + public void testIsValidTypetrue() { + assertTrue(AttributeUtil.isValidType("true")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * True type. + */ + @Test + public void testIsValidTypeTrue() { + assertTrue(AttributeUtil.isValidType("True")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * TRUE type. + */ + @Test + public void testIsValidTypeTRUE() { + assertTrue(AttributeUtil.isValidType("TRUE")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * invalid type. + */ + @Test + public void testIsValidTypeInvalidType() { + assertFalse(AttributeUtil.isValidType("str")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * false type. + */ + @Test + public void testIsValidTypefalse() { + assertTrue(AttributeUtil.isValidType("false")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * False type. + */ + @Test + public void testIsValidTypeFalse() { + assertTrue(AttributeUtil.isValidType("False")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * FALSE type. + */ + @Test + public void testIsValidTypeFALSEVal() { + assertTrue(AttributeUtil.isValidType("False")); + } + + /** + * Tests the {@link AttributeUtil#isValidType(String)} method for the given + * null. + */ + @Test + public void testIsValidTypeNullVal() { + assertFalse(AttributeUtil.isValidType(null)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given valid tuple. + */ + @Test + public void testHasValidTuples() { + assertTrue(AttributeUtil.hasValidTuples(TUPLE_STRING)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given invalid tuple. + */ + @Test + public void testHasValidTuplesInvalid() { + final String[] tuple = new String[]{"name", "type"}; + assertFalse(AttributeUtil.hasValidTuples(tuple)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given invalid tuple with valid size. + */ + @Test + public void testHasValidTuplesSameSizeInvalidValues() { + final String[] tuple = new String[]{"age", "type", "[18]", "Available"}; + assertFalse(AttributeUtil.hasValidTuples(tuple)); + } + + /** + * Tests the {@link AttributeUtil#hasValidTuples(String[])} method for the + * given null value. + */ + @Test + public void testHasValidTuplesNull() { + assertFalse(AttributeUtil.hasValidTuples(null)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given attribute list.. + */ + @Test + public void testCheckMandatoryAttributes() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + attrList.populate("isAgeOver:true:[18,]:Available;"); + assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); + + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given null value. + */ + @Test(expected = NullPointerException.class) + public void testCheckMandatoryAttributesNullAttrList() { + assertTrue(AttributeUtil.checkMandatoryAttributes(null)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given empty attribute list. + */ + @Test + public void testCheckMandatoryAttributesEmptyAttrList() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + assertTrue(AttributeUtil.checkMandatoryAttributes(attrList)); + } + + /** + * Tests the + * {@link AttributeUtil#checkMandatoryAttributes(IPersonalAttributeList)} + * method for the given attribute list (missing mandatory attribute). + */ + @Test + public void testCheckMandatoryAttributesMissingAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(); + attrList.populate("isAgeOver:true:[]:NotAvailable;"); + assertFalse(AttributeUtil.checkMandatoryAttributes(attrList)); + } } diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java index b8220ce98..f2383c07a 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/ComplexAttributesMarshalling.java @@ -11,7 +11,6 @@ package eu.stork.peps.tests;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.StringWriter;
@@ -33,249 +32,215 @@ import eu.stork.peps.complex.attributes.eu.stork.names.tc.stork._1_0.assertion.O import eu.stork.peps.complex.attributes.eu.stork.names.tc.stork._1_0.assertion.RepresentationPersonType;
/**
- * @author Advania Examples on how to use the jaxb marshaller. The classes are created from the StorkcomplexAttributes.xsd schema located in resources.
+ * @author Advania Examples on how to use the jaxb marshaller. The classes are created from the
+ * StorkcomplexAttributes.xsd schema located in resources.
* @version $Revision: 1.00 $, $Date: 2014-17-02 11:15:00 $
- *
*/
public class ComplexAttributesMarshalling {
- MandateContentType mtObject = new MandateContentType();
- RepresentationPersonType rpObject = new RepresentationPersonType();
- RepresentationPersonType rptObject = new RepresentationPersonType();
-
- void initMandateValues() {
- // Fill in the information ...
- mtObject.setIsChained(false);
- // mtObject.setIsJoined("IsJoined");
- mtObject.setTypeOfPower("The Force");
- mtObject.setIsChained(false);
- // ... fill in info for the representative
- rpObject.setTextRegisteredAddress("Address at some street");
- rpObject.setDateOfBirth(DateTime.now().toString());
- rpObject.setEIdentifier("123456");
- rpObject.setGivenName("Name of some person");
- rpObject.setLegalForm("Type of person");
- // .... fill in the info for the represented
- rptObject.setTextRegisteredAddress("Another Address at some street");
- rptObject.setDateOfBirth(DateTime.now().toString());
- rptObject.setEIdentifier("654321");
- rptObject.setGivenName("Another Name of some person");
- rptObject.setLegalForm("Yet another type of person");
- }
-
- /**
- * Test marshalling canonical address <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <canonicalResidenceAddress xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion">
- * <countryCodeAddress>IS</countryCodeAddress> <state>Reykjavik</state> <municipalityCode>RVK</municipalityCode> <town>Reykjavik</town> <postalCode>101</postalCode>
- * <streetName>Laugavegur</streetName> <streetNumber>1</streetNumber> <apartmentNumber>10</apartmentNumber> </canonicalResidenceAddress>
- */
- @Test
- public void testMarshallCanonicalResidencAddress() {
- try {
- final CanonicalAddressType object = new CanonicalAddressType();
- object.setApartmentNumber("10");
- object.setCountryCodeAddress("IS");
- object.setMunicipalityCode("RVK");
- object.setPostalCode("101");
- object.setState("Reykjavik");
- object.setStreetName("Laugavegur");
- object.setStreetNumber("1");
- object.setTown("Reykjavik");
-
- final JAXBContext context = JAXBContext.newInstance(CanonicalAddressType.class);
- final Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- final ObjectFactory objf = new ObjectFactory();
-
- m.marshal(objf.createCanonicalResidenceAddress(object), new FileOutputStream("CanonicalAddressType.xml"));
- m.marshal(objf.createCanonicalResidenceAddress(object), System.out);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testForDiana() {
- initMandateValues();
-
- try {
- // Create the marshallers'
-
- final JAXBContext mandateTypeContext = JAXBContext.newInstance(MandateType.class);
- final Marshaller mandateMarshaller = mandateTypeContext.createMarshaller();
- final Unmarshaller mandateUnmarshaller = mandateTypeContext.createUnmarshaller();
-
- // final JAXBContext MandateContentTypecontext = JAXBContext.newInstance(MandateContentType.class);
- // final Marshaller mandM = MandateContentTypecontext.createMarshaller();
- //
- // final JAXBContext RepresentationPersonTypecontext =
- // JAXBContext.newInstance(RepresentationPersonType.class);
- // final Marshaller repM = RepresentationPersonTypecontext.createMarshaller();
- //
-
- final ObjectFactory objf = new ObjectFactory();
- MandateType mandate = new MandateType();
- RepresentationPersonType representative = new RepresentationPersonType();
- representative.setDateOfBirth("1990-01-01");
- representative.setGivenName("Bilbo");
- representative.setSurname("Baggins");
- representative.setEIdentifier("IT/IT/12345678990");
- mandate.setRepresentative(representative);
-
- RepresentationPersonType represented = new RepresentationPersonType();
- represented.setTextRegisteredAddress("Via....");
- represented.setELPIdentifier("IT/1111111");
- represented.setLegalName("Shire Corp.");
- mandate.setRepresented(represented);
-
- MandateContentType mandateContent1 = new MandateContentType();
- // OriginalMandateType omt1 = new OriginalMandateType();
- // omt1.setMimeType("text/plain");
- // omt1.setValue("Chief executive officer".getBytes());
- mandateContent1.setOriginalMandate("Chief executive officer".getBytes());
- mandateContent1.setOriginalMandateType("text/plain");
- MandateContentType mandateContent2 = new MandateContentType();
- // mandateContent2.setOriginalMandate(omt1);
- mandateContent2.setOriginalMandate("Chief executive officer2".getBytes());
- mandateContent2.setOriginalMandateType("text/plain");
- mandate.getMandateContent().add(mandateContent1);
- mandate.getMandateContent().add(mandateContent2);
-
- // create a hashmap
- // HashMap<String, String> complexMandate = new HashMap<String, String>();
-
- // marshall the mandatecontent
- StringWriter sw = new StringWriter();
- mandateMarshaller.marshal(objf.createMandate(mandate), sw);
-
- System.out.print(sw.toString());
-
- // add it to the hashmap
- // complexMandate.put("representative", sw.toString());
- // sw.flush();
- //
- // // continue with the rest of the objects.
- // repM.marshal(objf.createRepresentationPerson(rpObject), sw);
- // System.out.print(sw.toString());
- // complexMandate.put("representative", sw.toString());
- // sw.flush();
- //
- // MandateType mandateType = new MandateType();
- //
- // repM.marshal(objf.createRepresentationPerson(rptObject), sw);
- // System.out.print(sw.toString());
- // complexMandate.put("represented", sw.toString());
- // sw.flush();
- //
- // // add the complex values to the attr.list.
- // PersonalAttribute pal = new PersonalAttribute();
- //
- // pal.setName("mandateContent");
- // pal.setIsRequired(pal.isRequired());
- // pal.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- // pal.setComplexValue(complexMandate);
- //
- // System.out.println(pal.toString());
- } catch (JAXBException e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testMandateContent() {
- initMandateValues();
- try {
- final MandateType object = new MandateType();
- // Make the object ....
- object.getMandateContent().add(mtObject);
- object.setRepresented(rpObject);
- object.setRepresentative(rptObject);
-
- final JAXBContext context = JAXBContext.newInstance(MandateType.class);
- // Create the marshaller
- final Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- final ObjectFactory objf = new ObjectFactory();
- // Various types of output
- m.marshal(objf.createMandate(object), new FileOutputStream("MandateContentType.xml"));
- m.marshal(objf.createMandate(object), System.out);
-
- StringWriter sw = new StringWriter();
- m.marshal(objf.createMandate(object), sw);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Test unmarshalling canonical address <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <canonicalResidenceAddress xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion">
- * <countryCodeAddress>IS</countryCodeAddress> <state>Reykjavik</state> <municipalityCode>RVK</municipalityCode> <town>Reykjavik</town> <postalCode>101</postalCode>
- * <streetName>Laugavegur</streetName> <streetNumber>1</streetNumber> <apartmentNumber>10</apartmentNumber> </canonicalResidenceAddress>
- */
- @Test
- public void testUnmarshallCanonicalAddress() {
- JAXBContext uContext;
- try {
- uContext = JAXBContext.newInstance(CanonicalAddressType.class);
- final Unmarshaller u = uContext.createUnmarshaller();
- final File file = new File("CanonicalAddressType.xml");
-
- final JAXBElement<CanonicalAddressType> root = u.unmarshal(new StreamSource(file), CanonicalAddressType.class);
- final CanonicalAddressType foo = root.getValue();
-
- final String A = foo.getStreetName();
- final String B = foo.getStreetNumber();
-
- System.out.println("Streetname: " + A);
- System.out.println("Streetnumber: " + B);
-
- } catch (final JAXBException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Test marshalling has bank account <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hasAccountInBank xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion"> <bankName>Arion</bankName>
- * <AQAA>3</AQAA> </hasAccountInBank>
- */
- @Test
- public void testMarshallHasBankAccount() {
- try {
- final HasAccountInBankType object = new HasAccountInBankType();
- object.setAQAA(3);
- object.setBankName("Arion Bank");
- final JAXBContext context = JAXBContext.newInstance(HasAccountInBankType.class);
- final Marshaller m = context.createMarshaller();
- final ObjectFactory o = new ObjectFactory();
- m.marshal(o.createHasAccountInBank(object), new FileOutputStream("hasbankaccount.xml"));
- m.marshal(o.createHasAccountInBank(object), System.out);
-
- } catch (FileNotFoundException e) {
- e.printStackTrace();
-
- } catch (Exception e) {
- e.printStackTrace();
-
- }
- }
-
- /**
- * Test unmarshalling has bank account <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hasAccountInBank xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion"> <bankName>Arion</bankName>
- * <AQAA>3</AQAA> </hasAccountInBank>
- */
- @Test
- public void testUnmarshallHasBankAccount() {
- try {
- final JAXBContext context = JAXBContext.newInstance(HasAccountInBankType.class);
- final Unmarshaller um = context.createUnmarshaller();
- final File file = new File("hasbankaccount.xml");
- final JAXBElement<HasAccountInBankType> root = um.unmarshal(new StreamSource(file), HasAccountInBankType.class);
- final HasAccountInBankType foo = root.getValue();
- System.out.println(foo.getBankName());
- } catch (final JAXBException e) {
- e.printStackTrace();
- }
- }
+ MandateContentType mtObject = new MandateContentType();
+ RepresentationPersonType rpObject = new RepresentationPersonType();
+ RepresentationPersonType rptObject = new RepresentationPersonType();
+
+ void initMandateValues() {
+ // Fill in the information ...
+ mtObject.setIsChained(false);
+ // mtObject.setIsJoined("IsJoined");
+ mtObject.setTypeOfPower("The Force");
+ mtObject.setIsChained(false);
+ // ... fill in info for the representative
+ rpObject.setTextRegisteredAddress("Address at some street");
+ rpObject.setDateOfBirth(DateTime.now().toString());
+ rpObject.setEIdentifier("123456");
+ rpObject.setGivenName("Name of some person");
+ rpObject.setLegalForm("Type of person");
+ // .... fill in the info for the represented
+ rptObject.setTextRegisteredAddress("Another Address at some street");
+ rptObject.setDateOfBirth(DateTime.now().toString());
+ rptObject.setEIdentifier("654321");
+ rptObject.setGivenName("Another Name of some person");
+ rptObject.setLegalForm("Yet another type of person");
+ }
+
+ /**
+ * Test marshalling canonical address <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+ * <canonicalResidenceAddress xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion">
+ * <countryCodeAddress>IS</countryCodeAddress> <state>Reykjavik</state> <municipalityCode>RVK</municipalityCode>
+ * <town>Reykjavik</town> <postalCode>101</postalCode> <streetName>Laugavegur</streetName>
+ * <streetNumber>1</streetNumber> <apartmentNumber>10</apartmentNumber> </canonicalResidenceAddress>
+ */
+ @Test
+ public void testMarshallCanonicalResidencAddress() {
+ try {
+ final CanonicalAddressType object = new CanonicalAddressType();
+ object.setApartmentNumber("10");
+ object.setCountryCodeAddress("IS");
+ object.setMunicipalityCode("RVK");
+ object.setPostalCode("101");
+ object.setState("Reykjavik");
+ object.setStreetName("Laugavegur");
+ object.setStreetNumber("1");
+ object.setTown("Reykjavik");
+
+ final JAXBContext context = JAXBContext.newInstance(CanonicalAddressType.class);
+ final Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ final ObjectFactory objf = new ObjectFactory();
+
+ m.marshal(objf.createCanonicalResidenceAddress(object), new FileOutputStream("CanonicalAddressType.xml"));
+ m.marshal(objf.createCanonicalResidenceAddress(object), System.out);
+ }
+ catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testForDiana() {
+ initMandateValues();
+
+ try {
+ // Create the marshallers'
+
+ final JAXBContext mandateTypeContext = JAXBContext.newInstance(MandateType.class);
+ final Marshaller mandateMarshaller = mandateTypeContext.createMarshaller();
+
+ final ObjectFactory objf = new ObjectFactory();
+ MandateType mandate = new MandateType();
+ RepresentationPersonType representative = new RepresentationPersonType();
+ representative.setDateOfBirth("1990-01-01");
+ representative.setGivenName("Bilbo");
+ representative.setSurname("Baggins");
+ representative.setEIdentifier("IT/IT/12345678990");
+ mandate.setRepresentative(representative);
+
+ RepresentationPersonType represented = new RepresentationPersonType();
+ represented.setTextRegisteredAddress("Via....");
+ represented.setELPIdentifier("IT/1111111");
+ represented.setLegalName("Shire Corp.");
+ mandate.setRepresented(represented);
+
+ MandateContentType mandateContent1 = new MandateContentType();
+ mandateContent1.setOriginalMandate("Chief executive officer".getBytes());
+ mandateContent1.setOriginalMandateType("text/plain");
+ MandateContentType mandateContent2 = new MandateContentType();
+ mandateContent2.setOriginalMandate("Chief executive officer2".getBytes());
+ mandateContent2.setOriginalMandateType("text/plain");
+ mandate.getMandateContent().add(mandateContent1);
+ mandate.getMandateContent().add(mandateContent2);
+
+ // marshall the mandatecontent
+ StringWriter sw = new StringWriter();
+ mandateMarshaller.marshal(objf.createMandate(mandate), sw);
+
+ System.out.print(sw.toString());
+
+ }
+ catch ( JAXBException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testMandateContent() {
+ initMandateValues();
+ try {
+ final MandateType object = new MandateType();
+ // Make the object ....
+ object.getMandateContent().add(mtObject);
+ object.setRepresented(rpObject);
+ object.setRepresentative(rptObject);
+
+ final JAXBContext context = JAXBContext.newInstance(MandateType.class);
+ // Create the marshaller
+ final Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+ final ObjectFactory objf = new ObjectFactory();
+ // Various types of output
+ m.marshal(objf.createMandate(object), new FileOutputStream("MandateContentType.xml"));
+ m.marshal(objf.createMandate(object), System.out);
+
+ StringWriter sw = new StringWriter();
+ m.marshal(objf.createMandate(object), sw);
+
+ }
+ catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Test unmarshalling canonical address <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+ * <canonicalResidenceAddress xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion">
+ * <countryCodeAddress>IS</countryCodeAddress> <state>Reykjavik</state> <municipalityCode>RVK</municipalityCode>
+ * <town>Reykjavik</town> <postalCode>101</postalCode> <streetName>Laugavegur</streetName>
+ * <streetNumber>1</streetNumber> <apartmentNumber>10</apartmentNumber> </canonicalResidenceAddress>
+ */
+ @Test
+ public void testUnmarshallCanonicalAddress() {
+ JAXBContext uContext;
+ try {
+ uContext = JAXBContext.newInstance(CanonicalAddressType.class);
+ final Unmarshaller u = uContext.createUnmarshaller();
+ final File file = new File("CanonicalAddressType.xml");
+
+ final JAXBElement<CanonicalAddressType> root = u.unmarshal(new StreamSource(file),
+ CanonicalAddressType.class);
+ final CanonicalAddressType foo = root.getValue();
+
+ final String A = foo.getStreetName();
+ final String B = foo.getStreetNumber();
+
+ System.out.println("Streetname: " + A);
+ System.out.println("Streetnumber: " + B);
+
+ }
+ catch ( final JAXBException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Test marshalling has bank account <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hasAccountInBank
+ * xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion"> <bankName>Arion</bankName> <AQAA>3</AQAA> </hasAccountInBank>
+ */
+ @Test
+ public void testMarshallHasBankAccount() {
+ try {
+ final HasAccountInBankType object = new HasAccountInBankType();
+ object.setAQAA(3);
+ object.setBankName("Arion Bank");
+ final JAXBContext context = JAXBContext.newInstance(HasAccountInBankType.class);
+ final Marshaller m = context.createMarshaller();
+ final ObjectFactory o = new ObjectFactory();
+ m.marshal(o.createHasAccountInBank(object), new FileOutputStream("hasbankaccount.xml"));
+ m.marshal(o.createHasAccountInBank(object), System.out);
+
+ }
+ catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Test unmarshalling has bank account <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hasAccountInBank
+ * xmlns="urn:eu:stork:names:tc:STORK:1.0:assertion"> <bankName>Arion</bankName> <AQAA>3</AQAA> </hasAccountInBank>
+ */
+ @Test
+ public void testUnmarshallHasBankAccount() {
+ try {
+ final JAXBContext context = JAXBContext.newInstance(HasAccountInBankType.class);
+ final Unmarshaller um = context.createUnmarshaller();
+ final File file = new File("hasbankaccount.xml");
+ final JAXBElement<HasAccountInBankType> root = um.unmarshal(new StreamSource(file),
+ HasAccountInBankType.class);
+ final HasAccountInBankType foo = root.getValue();
+ System.out.println(foo.getBankName());
+ }
+ catch ( final JAXBException e ) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java index 706e7affd..6c9a17ddc 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/DateUtilTestCase.java @@ -19,7 +19,6 @@ import java.util.Properties; import org.joda.time.DateTime; import org.junit.Assert; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import eu.stork.peps.auth.commons.DateUtil; @@ -28,229 +27,268 @@ import eu.stork.peps.auth.commons.exceptions.SecurityPEPSException; /** * The PersonalAttribute's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, luis.felix@multicert.com, hugo.magalhaes@multicert.com, paulo.ribeiro@multicert.com + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com * @version $Revision: 1.2 $, $Date: 2010-11-17 05:17:03 $ */ public final class DateUtilTestCase { - /** - * Stork Format date. - */ - private static final String FORMAT = "yyyyMMdd"; - - /** - * Expected 10 value. - */ - private static final int TEN = 10; - - /** - * Expected 11 value. - */ - private static final int ELEVEN = 11; - - /** - * The testing Date ("current" date). - */ - private static final DateTime TESTDATE = new DateTime(2011, 10, 10, 15, 20, 0, 0); - - /** - * Init DateUtilTestCase class. - */ - @BeforeClass - public static void runsBeforeTheTestSuite() { - final Properties configs = new Properties(); - configs.setProperty("invalidAgeDateValue.code", "35"); - configs.setProperty("invalidAttributeValue.code", "34"); - configs.setProperty("invalidAttributeValue.message", "Unexpected or invalid content was encountered within a " + "<saml:Attribute> or <saml:AttributeValue> element."); - PEPSUtil.createInstance(configs); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromYear() { - Assert.assertTrue(TEN == DateUtil.calculateAge("2000", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year and month against the testDate: 2011-10-10 15:20:00.0. Must return 11. - */ - @Test - public void calculateAgeFromEarlyMonth() { - Assert.assertTrue(ELEVEN == DateUtil.calculateAge("200001", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year and month against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromSameMonth() { - Assert.assertTrue(TEN == DateUtil.calculateAge("200010", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given year and month against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromLaterMonth() { - Assert.assertTrue(TEN == DateUtil.calculateAge("200011", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return 11. - */ - @Test - public void calculateAgeFromEarlyFullDate() { - Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20000101", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return 11. - */ - @Test - public void calculateAgeFromSameDay() { - Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20001010", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return 10. - */ - @Test - public void calculateAgeFromLaterFullDate() { - Assert.assertTrue(TEN == DateUtil.calculateAge("20001011", TESTDATE, FORMAT)); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return a SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromInvalidDate() { - DateUtil.calculateAge("200", TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return a SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromInvalidMonth() { - DateUtil.calculateAge("200013", TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return a SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromInvalidDay() { - DateUtil.calculateAge("20000230", TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return a SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromNullDate() { - DateUtil.calculateAge(null, TESTDATE, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return a SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromNullCurDate() { - DateUtil.calculateAge("2000", null, FORMAT); - } - - /** - * Tests the {@link DateUtil#calculateAge} method for the given full date against the testDate: 2011-10-10 15:20:00.0. Must return a SecurityPEPSException exception. - */ - @Test(expected = SecurityPEPSException.class) - public void calculateAgeFromNullFormat() { - DateUtil.calculateAge("2000", TESTDATE, null); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return true - */ - @Test - public void isValidFormatDateFromYear() { - Assert.assertTrue(DateUtil.isValidFormatDate("2000", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year and month. Must return true. - */ - @Test - public void isValidFormatDateFromMonth() { - Assert.assertTrue(DateUtil.isValidFormatDate("200001", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return false. - */ - @Test - public void isValidFormatDate() { - Assert.assertTrue(DateUtil.isValidFormatDate("20000101", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return false. - */ - @Test - public void isValidFormatDateInvalidYear() { - Assert.assertFalse(DateUtil.isValidFormatDate("200", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return false. - */ - @Test - public void isValidFormatDateInvalidMonth() { - Assert.assertFalse(DateUtil.isValidFormatDate("200013", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return false. - */ - @Test - public void isValidFormatDateInvalidDate() { - Assert.assertFalse(DateUtil.isValidFormatDate("20010229", FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return false. - */ - @Test - public void isValidFormatDateNullDate() { - Assert.assertFalse(DateUtil.isValidFormatDate(null, FORMAT)); - } - - /** - * Tests the {@link DateUtil#isValidFormatDate} method for the given year. Must return false. - */ - @Test - public void isValidFormatDateNullFormat() { - Assert.assertFalse(DateUtil.isValidFormatDate("2000", null)); - } - - /** - * Tests the {@link DateUtil#currentTimeStamp()} method for the current TimeStamp (TS). Must return true. - */ - @Test - public void testCurrentTimeStampBefore() { - Timestamp ts = DateUtil.currentTimeStamp(); - Assert.assertNotSame(ts, DateUtil.currentTimeStamp()); - } - - /** - * Tests the {@link DateUtil#currentTimeStamp()} method for the current TimeStamp (TS). Must return true. - */ - @Test - @Ignore - public void testCurrentTimeStampAfter() { - Timestamp ts = DateUtil.currentTimeStamp(); - Assert.assertEquals(DateUtil.currentTimeStamp(), ts); - } + /** + * Stork Format date. + */ + private static final String FORMAT = "yyyyMMdd"; + + /** + * Expected 10 value. + */ + private static final int TEN = 10; + + /** + * Expected 11 value. + */ + private static final int ELEVEN = 11; + + /** + * The testing Date ("current" date). + */ + private static final DateTime TESTDATE = new DateTime(2011, 10, 10, 15, 20, + 0, 0); + + /** + * Init DateUtilTestCase class. + */ + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Properties configs = new Properties(); + configs.setProperty("invalidAgeDateValue.code", "35"); + configs.setProperty("invalidAttributeValue.code", "34"); + configs + .setProperty( + "invalidAttributeValue.message", + "Unexpected or invalid content was encountered within a " + + "<saml:Attribute> or <saml:AttributeValue> element."); + PEPSUtil.createInstance(configs); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year against + * the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromYear() { + Assert.assertTrue(TEN == DateUtil.calculateAge("2000", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and + * month against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromEarlyMonth() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("200001", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and + * month against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromSameMonth() { + Assert.assertTrue(TEN == DateUtil.calculateAge("200010", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given year and + * month against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromLaterMonth() { + Assert.assertTrue(TEN == DateUtil.calculateAge("200011", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromEarlyFullDate() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20000101", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 11. + */ + @Test + public void calculateAgeFromSameDay() { + Assert.assertTrue(ELEVEN == DateUtil.calculateAge("20001010", TESTDATE, + FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return 10. + */ + @Test + public void calculateAgeFromLaterFullDate() { + Assert.assertTrue(TEN == DateUtil + .calculateAge("20001011", TESTDATE, FORMAT)); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidDate() { + DateUtil.calculateAge("200", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidMonth() { + DateUtil.calculateAge("200013", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromInvalidDay() { + DateUtil.calculateAge("20000230", TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullDate() { + DateUtil.calculateAge(null, TESTDATE, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullCurDate() { + DateUtil.calculateAge("2000", null, FORMAT); + } + + /** + * Tests the {@link DateUtil#calculateAge} method for the given full date + * against the testDate: 2011-10-10 15:20:00.0. Must return a + * SecurityPEPSException exception. + */ + @Test(expected = SecurityPEPSException.class) + public void calculateAgeFromNullFormat() { + DateUtil.calculateAge("2000", TESTDATE, null); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return true + */ + @Test + public void isValidFormatDateFromYear() { + Assert.assertTrue(DateUtil.isValidFormatDate("2000", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year + * and month. Must return true. + */ + @Test + public void isValidFormatDateFromMonth() { + Assert.assertTrue(DateUtil.isValidFormatDate("200001", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDate() { + Assert.assertTrue(DateUtil.isValidFormatDate("20000101", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidYear() { + Assert.assertFalse(DateUtil.isValidFormatDate("200", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidMonth() { + Assert.assertFalse(DateUtil.isValidFormatDate("200013", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateInvalidDate() { + Assert.assertFalse(DateUtil.isValidFormatDate("20010229", FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateNullDate() { + Assert.assertFalse(DateUtil.isValidFormatDate(null, FORMAT)); + } + + /** + * Tests the {@link DateUtil#isValidFormatDate} method for the given year. + * Must return false. + */ + @Test + public void isValidFormatDateNullFormat() { + Assert.assertFalse(DateUtil.isValidFormatDate("2000", null)); + } + + /** + * Tests the {@link DateUtil#currentTimeStamp()} method for the current + * TimeStamp (TS). Must return true. + */ + @Test + public void testCurrentTimeStampBefore() { + Timestamp ts = DateUtil.currentTimeStamp(); + Assert.assertNotSame(ts, DateUtil.currentTimeStamp()); + } + + /** + * Tests the {@link DateUtil#currentTimeStamp()} method for the current + * TimeStamp (TS). Must return true. + */ + @Test + public void testCurrentTimeStampAfter() { + Timestamp ts = DateUtil.currentTimeStamp(); + Assert.assertEquals(DateUtil.currentTimeStamp(), ts); + } } diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java index fbef5bc99..95c1f4594 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PEPSUtilTestCase.java @@ -36,436 +36,518 @@ import eu.stork.peps.auth.commons.exceptions.InvalidParameterPEPSException; /** * The PEPSUtil's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, luis.felix@multicert.com - * + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com + * * @version $Revision: $, $Date: $ */ public final class PEPSUtilTestCase { - /** - * Message example. - */ - private static final String MESSAGE_SAMPLE = "003002 - Authentication Failed"; - - /** - * Error message example. - */ - private static final String ERROR_MESSAGE_SAMPLE = "Authentication Failed"; - - /** - * Error code example. - */ - private static final String ERROR_CODE_SAMPLE = "003002"; - - /** - * Properties values for testing proposes. - */ - private static final Properties CONFIGS1 = new Properties(); - - /** - * Properties values for testing proposes. - */ - private static final Properties CONFIGS2 = new Properties(); - - /** - * The empty string value: "". - */ - private static final String EMPTY_STRING = ""; - - /** - * The empty byte value: []. - */ - private static final byte[] EMPTY_BYTE = new byte[] {}; - - /** - * The empty byte hash value. - */ - private static final byte[] EMPTY_HASH_BYTE = new byte[] { -49, -125, -31, 53, 126, -17, -72, -67, -15, 84, 40, 80, -42, 109, -128, 7, -42, 32, -28, 5, 11, 87, 21, -36, -125, -12, -87, 33, -45, - 108, -23, -50, 71, -48, -47, 60, 93, -123, -14, -80, -1, -125, 24, -46, -121, 126, -20, 47, 99, -71, 49, -67, 71, 65, 122, -127, -91, 56, 50, 122, -7, 39, -38, 62 }; - - /** - * The SAML example byte[] value. - */ - private static final byte[] SAML_BYTE_SAMPLE = new byte[] { 60, 115, 97, 109, 108, 62, 46, 46, 46, 60, 47, 115, 97, 109, 108 }; - - /** - * The SAML's Base64 example value. - */ - private static final String SAML_BASE64_SAMPLE = "PHNhbWw+Li4uPC9zYW1s"; - - /** - * The SAML's Base64 byte[] example value. - */ - private static byte[] SAML_BASE64_BYTE_SAMPLE = new byte[] { 80, 72, 78, 104, 98, 87, 119, 43, 76, 105, 52, 117, 80, 67, 57, 122, 89, 87, 49, 115 }; - - /** - * The SAML's Base64 Hash byte[] example value. - */ - private static byte[] HASH_BYTE_SAMPLE = new byte[] { 67, 38, 11, 115, 49, -5, 54, -85, 38, 43, -99, 96, 71, -41, 50, -96, 71, -86, 90, -97, 66, -67, 90, 101, 30, 82, -13, 60, -106, -72, -103, - -75, 19, 2, -107, 107, -6, -56, 34, -111, -44, -57, -26, -5, 33, 78, -1, 30, 21, 74, -26, 118, -46, -12, -102, 12, -56, 30, -59, -104, -21, -42, -103, 82 }; - - /** - * Init PEPSUtilTestCase class. - */ - @BeforeClass - public static void runsBeforeTheTestSuite() { - - CONFIGS1.setProperty("max.attrList.size", "20000"); - CONFIGS1.setProperty("attrList.code", "202005"); - CONFIGS1.setProperty("attrList.message", "invalid.attrList.parameter"); - - CONFIGS1.setProperty("max.qaaLevel.size", "1"); - CONFIGS1.setProperty("max.spUrl.size", "inv"); - CONFIGS1.setProperty("validation.active", "true"); - CONFIGS1.setProperty("hashDigest.className", "org.bouncycastle.crypto.digests.SHA512Digest"); - CONFIGS1.setProperty("invalidAgeDateValue.code", "35"); - CONFIGS1.setProperty("invalidAttributeValue.code", "34"); - CONFIGS1.setProperty("invalidAttributeValue.message", "Unexpected or invalid content was encountered within a " + "<saml:Attribute> or <saml:AttributeValue> element."); - } - - /** - * Tests the {@link PEPSUtil#createInstance(Properties)} method for the given properties object. - */ - @Test - public void testCreateInstance() { - Assert.assertNotNull(PEPSUtil.createInstance(CONFIGS2)); - } - - /** - * Tests the {@link PEPSUtil#getConfigs()}. - */ - @Test - public void testGetConfigs() { - final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); - assertEquals(pepsUtils.getConfigs(), CONFIGS1); - } - - /** - * Tests the {@link PEPSUtil#getConfigs()}. - */ - @Test - public void testGetConfigsDifferent() { - final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); - assertNotSame(pepsUtils.getConfigs(), CONFIGS2); - } - - /** - * Tests the {@link PEPSUtil#getConfig(String)} method for the given existing config. - */ - @Test - public void testGetConfigExists() { - assertEquals(PEPSUtil.getConfig("hashDigest.className"), "org.bouncycastle.crypto.digests.SHA512Digest"); - } - - /** - * Tests the {@link PEPSUtil#getConfig(String)} method for the given not existing config. - */ - @Test - public void testGetConfigNoExists() { - assertNull(PEPSUtil.getConfig("doesnt.exists")); - } - - /** - * Tests the {@link PEPSUtil#getConfig(String)} method for the given null value. - */ - @Test(expected = NullPointerException.class) - public void testGetConfigNull() { - assertNull(PEPSUtil.getConfig(null)); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the given param values. - */ - @Test - public void testIsValidParameterExists() { - assertTrue(PEPSUtil.isValidParameter("qaaLevel", "1")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the given param values. - */ - @Test - public void testIsValidParameterExistsGreat() { - assertFalse(PEPSUtil.isValidParameter("qaaLevel", "12")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the given param values. - */ - @Test - public void testIsValidParameterExistsIvalidConf() { - assertFalse(PEPSUtil.isValidParameter("spUrl", "http://localhost:8080/SP/")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the given param values. - */ - @Test - public void testIsValidParameterNotExists() { - assertFalse(PEPSUtil.isValidParameter("doesntexists", "http://localhost:8080/SP/")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the given param values. - */ - @Test - public void testIsValidParameterNullParamName() { - assertFalse(PEPSUtil.isValidParameter(null, "http://localhost:8080/SP/")); - } - - /** - * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for the given param values. - */ - @Test - public void testIsValidParameterNullParamValue() { - assertFalse(PEPSUtil.isValidParameter("spUrl", null)); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method for the given object values. - */ - @Test - public void testValidateParameterValid() { - final IPersonalAttributeList persAttrList = new PersonalAttributeList(); - persAttrList.populate("isAgeOver:true:[15,]:Available;"); - PEPSUtil.validateParameter("ServiceProviderAction", PEPSParameters.ATTRIBUTE_LIST.toString(), persAttrList); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterNull() { - PEPSUtil.validateParameter("ServiceProviderAction", PEPSParameters.ATTRIBUTE_LIST.toString(), null); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String)} method for the given string values. - * - * The tested class just invokes {@link PEPSUtil#validateParameter(String, String, String, String, String)} so further tests will be later. - */ - @Test - public void testValidateParameter() { - PEPSUtil.validateParameter("ServiceProviderAction", PEPSParameters.ATTRIBUTE_LIST.toString(), "isAgeOver:true:[15,]:Available;"); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String, PEPSErrors)} method for the given string value and {@link PEPSErrors} enum. - * - * The tested class just invokes {@link PEPSUtil#validateParameter(String, String, String, String, String)} so further tests will be later. - */ - @Test - public void testValidateParameterPEPSErrors() { - PEPSUtil.validateParameter("CountrySelectorAction", PEPSParameters.ATTRIBUTE_LIST.toString(), "isAgeOver:true:[15,]:Available;", PEPSErrors.SP_COUNTRY_SELECTOR_INVALID_ATTR); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String, String, String)} method for the given string values. - */ - @Test - public void testValidateParameterValidParams() { - PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "1", "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String, String, String)} method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterInvalidParamValue() { - PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "10", "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String, String, String)} method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterInvalidParamName() { - PEPSUtil.validateParameter("ServiceProviderAction", "doesnt.exists", "1", "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String, String, String)} method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterNullParamName() { - PEPSUtil.validateParameter("ServiceProviderAction", null, "1", "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the {@link PEPSUtil#validateParameter(String, String, String, String, String)} method for the given string values. - */ - @Test(expected = InvalidParameterPEPSException.class) - public void testValidateParameterNullParamValue() { - PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", null, "qaaLevel.code", "qaaLevel.message"); - } - - /** - * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given string value. - */ - @Test - public void testEncodeSAMLToken() { - assertEquals(PEPSUtil.encodeSAMLToken(SAML_BYTE_SAMPLE), SAML_BASE64_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given null. - */ - @Test(expected = NullPointerException.class) - public void testEncodeSAMLTokenNull() { - assertNotSame(PEPSUtil.encodeSAMLToken(null), SAML_BASE64_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given empty byte[] value. - */ - @Test - public void testEncodeSAMLTokenEmpty() { - assertEquals(PEPSUtil.encodeSAMLToken(EMPTY_BYTE), EMPTY_STRING); - } - - /** - * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given byte[] value. - */ - @Test - public void testDecodeSAMLToken() { - assertArrayEquals(PEPSUtil.decodeSAMLToken(SAML_BASE64_SAMPLE), SAML_BYTE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given null value. - */ - @Test(expected = NullPointerException.class) - public void testDecodeSAMLTokenNull() { - assertNotSame(PEPSUtil.decodeSAMLToken(null), SAML_BYTE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given empty string value. - */ - @Test(expected = StringIndexOutOfBoundsException.class) - public void testDecodeSAMLTokenEmpty() { - assertTrue(PEPSUtil.decodeSAMLToken(EMPTY_STRING) == EMPTY_BYTE); - } - - /** - * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given byte[] value. - */ - @Test - public void testHashPersonalToken() { - assertArrayEquals(PEPSUtil.hashPersonalToken(SAML_BASE64_BYTE_SAMPLE), HASH_BYTE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given null value. - */ - @Test(expected = InternalErrorPEPSException.class) - public void testHashPersonalTokenNull() { - assertNull(PEPSUtil.hashPersonalToken(null)); - } - - /** - * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given empty value. - */ - @Test - public void testHashPersonalTokenEmpty() { - assertArrayEquals(PEPSUtil.hashPersonalToken(EMPTY_BYTE), EMPTY_HASH_BYTE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given correct message. - */ - @Test - public void testGetStorkErrorCodeExists() { - assertEquals(PEPSUtil.getStorkErrorCode(MESSAGE_SAMPLE), ERROR_CODE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given invalid message. - */ - @Test - public void testGetStorkErrorCodeNoExists() { - assertNull(PEPSUtil.getStorkErrorCode(ERROR_MESSAGE_SAMPLE)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given empty message. - */ - @Test - public void testGetStorkErrorCodeEmpty() { - assertNull(PEPSUtil.getStorkErrorCode(EMPTY_STRING)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given null message. - */ - @Test - public void testGetStorkErrorCodeNull() { - assertNull(PEPSUtil.getStorkErrorCode(null)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given invalid message. - */ - @Test - public void testGetStorkErrorCodeWithSepFake() { - assertNull(PEPSUtil.getStorkErrorCode("-")); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given invalid message. - */ - @Test - public void testGetStorkErrorCodeWithSepAndCodeFake() { - assertNull(PEPSUtil.getStorkErrorCode("000001 -")); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the given correct message. - */ - @Test - public void testGetStorkErrorMessageExists() { - assertEquals(PEPSUtil.getStorkErrorMessage(MESSAGE_SAMPLE), ERROR_MESSAGE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the given invalid message. - */ - @Test - public void testGetStorkErrorMessageNoExists() { - assertEquals(PEPSUtil.getStorkErrorMessage(ERROR_MESSAGE_SAMPLE), ERROR_MESSAGE_SAMPLE); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the given empty message. - */ - @Test - public void testGetStorkErrorMessageEmpty() { - assertEquals(PEPSUtil.getStorkErrorMessage(EMPTY_STRING), EMPTY_STRING); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the given null message. - */ - @Test - public void testGetStorkErrorMessageNull() { - assertNull(PEPSUtil.getStorkErrorMessage(null)); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the given invalid message. - */ - @Test - public void testGetStorkErrorMessageWithSepFake() { - assertEquals(PEPSUtil.getStorkErrorMessage("-"), "-"); - } - - /** - * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the given invalid message. - */ - @Test - public void testGetStorkErrorMessageWithSepAndCodeFake() { - assertEquals(PEPSUtil.getStorkErrorMessage("000001 -"), "000001 -"); - } + /** + * Message example. + */ + private static final String MESSAGE_SAMPLE = "003002 - Authentication Failed"; + + /** + * Error message example. + */ + private static final String ERROR_MESSAGE_SAMPLE = "Authentication Failed"; + + /** + * Error code example. + */ + private static final String ERROR_CODE_SAMPLE = "003002"; + + /** + * Properties values for testing proposes. + */ + private static final Properties CONFIGS1 = new Properties(); + + /** + * Properties values for testing proposes. + */ + private static final Properties CONFIGS2 = new Properties(); + + /** + * The empty string value: "". + */ + private static final String EMPTY_STRING = ""; + + /** + * The empty byte value: []. + */ + private static final byte[] EMPTY_BYTE = new byte[]{}; + + /** + * The empty byte hash value. + */ + private static final byte[] EMPTY_HASH_BYTE = new byte[]{-49, -125, -31, + 53, 126, -17, -72, -67, -15, 84, 40, 80, -42, 109, -128, 7, -42, 32, -28, + 5, 11, 87, 21, -36, -125, -12, -87, 33, -45, 108, -23, -50, 71, -48, -47, + 60, 93, -123, -14, -80, -1, -125, 24, -46, -121, 126, -20, 47, 99, -71, 49, + -67, 71, 65, 122, -127, -91, 56, 50, 122, -7, 39, -38, 62}; + + /** + * The SAML example byte[] value. + */ + private static final byte[] SAML_BYTE_SAMPLE = new byte[]{60, 115, 97, 109, + 108, 62, 46, 46, 46, 60, 47, 115, 97, 109, 108}; + + /** + * The SAML's Base64 example value. + */ + private static final String SAML_BASE64_SAMPLE = "PHNhbWw+Li4uPC9zYW1s"; + + /** + * The SAML's Base64 byte[] example value. + */ + private static byte[] SAML_BASE64_BYTE_SAMPLE = new byte[]{80, 72, 78, 104, + 98, 87, 119, 43, 76, 105, 52, 117, 80, 67, 57, 122, 89, 87, 49, 115}; + + /** + * The SAML's Base64 Hash byte[] example value. + */ + private static byte[] HASH_BYTE_SAMPLE = new byte[]{67, 38, 11, 115, 49, + -5, 54, -85, 38, 43, -99, 96, 71, -41, 50, -96, 71, -86, 90, -97, 66, -67, + 90, 101, 30, 82, -13, 60, -106, -72, -103, -75, 19, 2, -107, 107, -6, -56, + 34, -111, -44, -57, -26, -5, 33, 78, -1, 30, 21, 74, -26, 118, -46, -12, + -102, 12, -56, 30, -59, -104, -21, -42, -103, 82}; + + /** + * Init PEPSUtilTestCase class. + */ + @BeforeClass + public static void runsBeforeTheTestSuite() { + + CONFIGS1.setProperty("max.attrList.size", "20000"); + CONFIGS1.setProperty("attrList.code", "202005"); + CONFIGS1.setProperty("attrList.message", "invalid.attrList.parameter"); + + CONFIGS1.setProperty("max.qaaLevel.size", "1"); + CONFIGS1.setProperty("max.spUrl.size", "inv"); + CONFIGS1.setProperty("validation.active", "true"); + CONFIGS1.setProperty("hashDigest.className", + "org.bouncycastle.crypto.digests.SHA512Digest"); + CONFIGS1.setProperty("invalidAgeDateValue.code", "35"); + CONFIGS1.setProperty("invalidAttributeValue.code", "34"); + CONFIGS1.setProperty("invalidAttributeValue.message", + "Unexpected or invalid content was encountered within a " + + "<saml:Attribute> or <saml:AttributeValue> element."); + } + + /** + * Tests the {@link PEPSUtil#createInstance(Properties)} method for the + * given properties object. + */ + @Test + public void testCreateInstance() { + Assert.assertNotNull(PEPSUtil.createInstance(CONFIGS2)); + } + + /** + * Tests the {@link PEPSUtil#getConfigs()}. + */ + @Test + public void testGetConfigs() { + final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); + assertEquals(pepsUtils.getConfigs(), CONFIGS1); + } + + /** + * Tests the {@link PEPSUtil#getConfigs()}. + */ + @Test + public void testGetConfigsDifferent() { + final PEPSUtil pepsUtils = PEPSUtil.createInstance(CONFIGS1); + assertNotSame(pepsUtils.getConfigs(), CONFIGS2); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given + * existing config. + */ + @Test + public void testGetConfigExists() { + assertEquals(PEPSUtil.getConfig("hashDigest.className"), + "org.bouncycastle.crypto.digests.SHA512Digest"); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given not + * existing config. + */ + @Test + public void testGetConfigNoExists() { + assertNull(PEPSUtil.getConfig("doesnt.exists")); + } + + /** + * Tests the {@link PEPSUtil#getConfig(String)} method for the given null + * value. + */ + @Test(expected = NullPointerException.class) + public void testGetConfigNull() { + assertNull(PEPSUtil.getConfig(null)); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for + * the given param values. + */ + @Test + public void testIsValidParameterExists() { + assertTrue(PEPSUtil.isValidParameter("qaaLevel", "1")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for + * the given param values. + */ + @Test + public void testIsValidParameterExistsGreat() { + assertFalse(PEPSUtil.isValidParameter("qaaLevel", "12")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for + * the given param values. + */ + @Test + public void testIsValidParameterExistsIvalidConf() { + assertFalse(PEPSUtil + .isValidParameter("spUrl", "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for + * the given param values. + */ + @Test + public void testIsValidParameterNotExists() { + assertFalse(PEPSUtil.isValidParameter("doesntexists", + "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for + * the given param values. + */ + @Test + public void testIsValidParameterNullParamName() { + assertFalse(PEPSUtil.isValidParameter(null, "http://localhost:8080/SP/")); + } + + /** + * Tests the {@link PEPSUtil#isValidParameter(String, String)} method for + * the given param values. + */ + @Test + public void testIsValidParameterNullParamValue() { + assertFalse(PEPSUtil.isValidParameter("spUrl", null)); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} + * method for the given object values. + */ + @Test + public void testValidateParameterValid() { + final IPersonalAttributeList persAttrList = new PersonalAttributeList(); + persAttrList.populate("isAgeOver:true:[15,]:Available;"); + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), persAttrList); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, Object)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNull() { + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), null); + } + + /** + * Tests the {@link PEPSUtil#validateParameter(String, String, String)} + * method for the given string values. + * + * The tested class just invokes + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * so further tests will be later. + */ + @Test + public void testValidateParameter() { + PEPSUtil.validateParameter("ServiceProviderAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), + "isAgeOver:true:[15,]:Available;"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, PEPSErrors)} + * method for the given string value and {@link PEPSErrors} enum. + * + * The tested class just invokes + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * so further tests will be later. + */ + @Test + public void testValidateParameterPEPSErrors() { + PEPSUtil.validateParameter("CountrySelectorAction", + PEPSParameters.ATTRIBUTE_LIST.toString(), + "isAgeOver:true:[15,]:Available;", + PEPSErrors.SP_COUNTRY_SELECTOR_INVALID_ATTR); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test + public void testValidateParameterValidParams() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterInvalidParamValue() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", "10", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterInvalidParamName() { + PEPSUtil.validateParameter("ServiceProviderAction", "doesnt.exists", "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNullParamName() { + PEPSUtil.validateParameter("ServiceProviderAction", null, "1", + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the + * {@link PEPSUtil#validateParameter(String, String, String, String, String)} + * method for the given string values. + */ + @Test(expected = InvalidParameterPEPSException.class) + public void testValidateParameterNullParamValue() { + PEPSUtil.validateParameter("ServiceProviderAction", "qaaLevel", null, + "qaaLevel.code", "qaaLevel.message"); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * string value. + */ + @Test + public void testEncodeSAMLToken() { + assertEquals(PEPSUtil.encodeSAMLToken(SAML_BYTE_SAMPLE), SAML_BASE64_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * null. + */ + @Test(expected = NullPointerException.class) + public void testEncodeSAMLTokenNull() { + assertNotSame(PEPSUtil.encodeSAMLToken(null), SAML_BASE64_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#encodeSAMLToken(byte[])} method for the given + * empty byte[] value. + */ + @Test + public void testEncodeSAMLTokenEmpty() { + assertEquals(PEPSUtil.encodeSAMLToken(EMPTY_BYTE), EMPTY_STRING); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * byte[] value. + */ + @Test + public void testDecodeSAMLToken() { + assertArrayEquals(PEPSUtil.decodeSAMLToken(SAML_BASE64_SAMPLE), + SAML_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * null value. + */ + @Test(expected = NullPointerException.class) + public void testDecodeSAMLTokenNull() { + assertNotSame(PEPSUtil.decodeSAMLToken(null), SAML_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#decodeSAMLToken(byte[])} method for the given + * empty string value. + */ + @Test(expected = StringIndexOutOfBoundsException.class) + public void testDecodeSAMLTokenEmpty() { + assertTrue(PEPSUtil.decodeSAMLToken(EMPTY_STRING) == EMPTY_BYTE); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * byte[] value. + */ + @Test + public void testHashPersonalToken() { + assertArrayEquals(PEPSUtil.hashPersonalToken(SAML_BASE64_BYTE_SAMPLE), + HASH_BYTE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * null value. + */ + @Test(expected = InternalErrorPEPSException.class) + public void testHashPersonalTokenNull() { + assertNull(PEPSUtil.hashPersonalToken(null)); + } + + /** + * Tests the {@link PEPSUtil#hashPersonalToken(byte[])} method for the given + * empty value. + */ + @Test + public void testHashPersonalTokenEmpty() { + assertArrayEquals(PEPSUtil.hashPersonalToken(EMPTY_BYTE), EMPTY_HASH_BYTE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * correct message. + */ + @Test + public void testGetStorkErrorCodeExists() { + assertEquals(PEPSUtil.getStorkErrorCode(MESSAGE_SAMPLE), ERROR_CODE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeNoExists() { + assertNull(PEPSUtil.getStorkErrorCode(ERROR_MESSAGE_SAMPLE)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * empty message. + */ + @Test + public void testGetStorkErrorCodeEmpty() { + assertNull(PEPSUtil.getStorkErrorCode(EMPTY_STRING)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * null message. + */ + @Test + public void testGetStorkErrorCodeNull() { + assertNull(PEPSUtil.getStorkErrorCode(null)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeWithSepFake() { + assertNull(PEPSUtil.getStorkErrorCode("-")); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorCode(String)} method for the given + * invalid message. + */ + @Test + public void testGetStorkErrorCodeWithSepAndCodeFake() { + assertNull(PEPSUtil.getStorkErrorCode("000001 -")); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given correct message. + */ + @Test + public void testGetStorkErrorMessageExists() { + assertEquals(PEPSUtil.getStorkErrorMessage(MESSAGE_SAMPLE), + ERROR_MESSAGE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageNoExists() { + assertEquals(PEPSUtil.getStorkErrorMessage(ERROR_MESSAGE_SAMPLE), + ERROR_MESSAGE_SAMPLE); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given empty message. + */ + @Test + public void testGetStorkErrorMessageEmpty() { + assertEquals(PEPSUtil.getStorkErrorMessage(EMPTY_STRING), + EMPTY_STRING); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given null message. + */ + @Test + public void testGetStorkErrorMessageNull() { + assertNull(PEPSUtil.getStorkErrorMessage(null)); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageWithSepFake() { + assertEquals(PEPSUtil.getStorkErrorMessage("-"), "-"); + } + + /** + * Tests the {@link PEPSUtil#getStorkErrorMessage(String)} method for the + * given invalid message. + */ + @Test + public void testGetStorkErrorMessageWithSepAndCodeFake() { + assertEquals(PEPSUtil.getStorkErrorMessage("000001 -"), "000001 -"); + } } diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java index 1b6fad6ae..7800e78b5 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeListTestCase.java @@ -22,661 +22,756 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import eu.stork.peps.auth.commons.IPersonalAttributeList; import eu.stork.peps.auth.commons.PersonalAttribute; import eu.stork.peps.auth.commons.PersonalAttributeList; import eu.stork.peps.auth.commons.STORKStatusCode; /** * The PersonalAttributeList's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, luis.felix@multicert.com, hugo.magalhaes@multicert.com, paulo.ribeiro@multicert.com + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com * @version $Revision: 1.5 $, $Date: 2010-11-17 05:17:02 $ */ public final class PersonalAttributeListTestCase { - /** - * isAgeOver constant value. - */ - private static final String ISAGEOVER_CONS = "isAgeOver"; - - /** - * 1 constant value. - */ - private static final int ONE_CONS = 1; - - /** - * 2 constant value. - */ - private static final int TWO_CONS = 2; - - /** - * An empty attribute. - */ - @SuppressWarnings("unused") - private static final PersonalAttributeList EMPTY_ATTR_LIST = new PersonalAttributeList(0); - - /** - * An attribute with a complex value (canonicalResidenceAddress). - */ - private static PersonalAttribute complexAttrValue = null; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST = "isAgeOver:true:[15,]:Available;"; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST2 = "isAgeOver:true:[18,]:Available;"; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST3 = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; - - /** - * Simple attribute value list string. - */ - private static final String SIMPLE_ATTRLIST3_REVERSE = "isAgeOver:true:[18,]:Available;isAgeOver:true:[15,]:Available;"; - /** - * Simple attribute value list string. - */ - private static final String COMPLEX_ATTRLIST = "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B," + "state=Porto,countryCodeAddress=PT,streetNumber=379," - + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;"; - /** - * Mix attribute list string. - */ - private static final String STR_MIX_ATTR_LIST = "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:[" + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," - + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:" + "Available;"; - - /** - * Mix attribute list 2 string. - */ - private static final String STR_MIX_ATTR_LIST2 = "isAgeOver:true:[15,]:Available;canonicalResidenceAddress:true:[" + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," - + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto,]:Available;" + "mandateContent:true:[" - + "isJoint=\"isjoint\",typeOfPower=\"power\",ValidTo=\"validto\",validfrom=\"validfrom\",AQAA=\"3\",isChained=\"ischained\",]:" + "Available;"; - - /** - * Attribute List example. - */ - @SuppressWarnings({ "serial" }) - private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute("age", true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - /** - * Init PersonalAttributeListTestCase class. - */ - @SuppressWarnings("serial") - @BeforeClass - public static void runsBeforeTheTestSuite() { - final Map<String, String> values = new HashMap<String, String>() { - { - put("countryCodeAddress", "PT"); - put("state", "Porto"); - put("town", "Porto"); - put("postalCode", "4100"); - put("streetName", "Avenida Sidonio Pais"); - put("streetNumber", "379"); - put("apartmentNumber", "Ed. B"); - } - }; - - complexAttrValue = new PersonalAttribute("canonicalResidenceAddress", true, values, STORKStatusCode.STATUS_AVAILABLE.toString()); - - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be size 1 - Simple attribute. - */ - @Test - public void testAddSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(ATTR_VALUE); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be size 1 - Complex attribute. - */ - @Test - public void testAddCompleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(complexAttrValue); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be size 0 - no attribute. - */ - @Test - public void testAddNull() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(null); - Assert.assertTrue(attrList.size() == 0); - } - - /** - * Testing Personal Attribute List add method. Same attribute name added twice. Personal Attribute list must be size 2 - IsAgeOver attribute added twice. - */ - @SuppressWarnings("serial") - @Test - public void testAddSameAttrName() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List add method. Same attribute name added twice. Personal Attribute list must be size 2 - IsAgeOver attribute added twice. - */ - @SuppressWarnings("serial") - @Test - public void testAddSameAttrNameEmpty() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add(""); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be size 1 - Simple Value. - */ - @Test - public void testPutSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(ATTR_VALUE.getName(), ATTR_VALUE); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be size 1 - Complex Value. - */ - @Test - public void testPutComplexAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(ATTR_VALUE.getName(), complexAttrValue); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be size 0 - no attribute. - */ - @Test - public void testPutNull() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put("", null); - Assert.assertTrue(attrList.size() == 0); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be size 2 - IsAgeOver attribute added twice. - */ - @SuppressWarnings("serial") - @Test - public void testPutSameAttrName() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List put method. Personal Attribute list must be size 2 - IsAgeOver attribute added twice. - */ - @SuppressWarnings("serial") - @Test - public void testPutSameAttrNameEmpty() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add(""); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List get method. Personal Attribute list must be size 1 - Simple attribute. - */ - @Test - public void testGetSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(ATTR_VALUE); - Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName())); - } - - /** - * Testing Personal Attribute List add method. Personal Attribute list must be size 1 - Complex attribute. - */ - @Test - public void testGetCompleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(complexAttrValue); - Assert.assertEquals(complexAttrValue.toString(), attrList.get(complexAttrValue.getName()).toString()); - } - - /** - * Testing Personal Attribute List get method. Personal Attribute list must be size 2 - IsAgeOver attribute. - */ - @SuppressWarnings("serial") - @Test - public void testGetIsAgeOverAttr() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST, attrList.get(attrValueUnder.getName()).toString()); - Assert.assertEquals(SIMPLE_ATTRLIST2, attrList.get(attrValueOver.getName()).toString()); - } - - /** - * Testing Personal Attribute List populate method. Personal Attribute list must be size 1 - Simple attribute. - */ - @Test - public void testPopulateSimpleAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(SIMPLE_ATTRLIST); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List populate method. Personal Attribute list must be size 1 - Complex attribute. - */ - @Test - public void testPopulateComplexAttr() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(COMPLEX_ATTRLIST); - Assert.assertTrue(attrList.size() == 1); - } - - /** - * Testing Personal Attribute List populate method. Personal Attribute list must be size 1 - Simple and Complex attribute. - */ - @Test - public void testPopulateMixAttrs() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(STR_MIX_ATTR_LIST); - Assert.assertTrue(attrList.size() == 2); - } - - /** - * Testing Personal Attribute List toString method using add. - */ - @SuppressWarnings("serial") - @Test - public void testToStringFromAdd() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString()); - } - - /** - * Testing Personal Attribute List toString method using put. - * - */ - @SuppressWarnings("serial") - @Test - public void testToStringFromPut() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString()); - } - - /** - * Testing Personal Attribute List toString method using populate. - */ - @Test - public void testToStringFromSimplePopulate() { - final String strAttrList = "isAgeOver:true"; - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(strAttrList); - Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString()); - } - - /** - * Testing Personal Attribute List toString method using populate. - */ - @Test - public void testToStringFromPopulate() { - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.populate(SIMPLE_ATTRLIST3); - Assert.assertEquals(SIMPLE_ATTRLIST3_REVERSE, attrList.toString()); - } - - /** - * Testing Personal Attribute List populate method, with invalid values. - */ - @Test - public void testPopulateWithInvalidValuesFormat() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate("name:type:values:status;"); - Assert.assertEquals(pal, new PersonalAttributeList()); - } - - /** - * Testing Personal Attribute List populate method, with invalid format. - */ - @Test - public void testPopulateWithInvalidFormat() { - - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate("name:type::status;"); - Assert.assertEquals(pal, new PersonalAttributeList()); - } - - /** - * Testing Personal Attribute List clone method using add. - */ - @SuppressWarnings("serial") - @Test - public void testCloneFromAdd() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.add(attrValueUnder); - attrList.add(attrValueOver); - Assert.assertNotSame(attrList, attrList.clone()); - } - - /** - * Testing Personal Attribute List clone method using put. - */ - @SuppressWarnings("serial") - @Test - public void testCloneFromPut() { - final PersonalAttribute attrValueUnder = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - final PersonalAttribute attrValueOver = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { - { - add("18"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - final PersonalAttributeList attrList = new PersonalAttributeList(1); - attrList.put(attrValueUnder.getName(), attrValueUnder); - attrList.put(attrValueOver.getName(), attrValueOver); - Assert.assertNotSame(attrList, attrList.clone()); - } - - /** - * Testing Personal Attribute List clone method using populate. - */ - @Test - public void testCloneFromPopulate() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(SIMPLE_ATTRLIST3); - Assert.assertNotSame(pal, pal.clone()); - } - - /** - * Testing Personal Attribute List iterator. - */ - @Test - public void testIterator() { - final String strAttrList = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - final Iterator<PersonalAttribute> itAttr = pal.iterator(); - while (itAttr.hasNext()) { - final PersonalAttribute attr = itAttr.next(); - Assert.assertEquals(ISAGEOVER_CONS, attr.getName()); - } - } - - /** - * Testing Personal Attribute List's GetOptionalAttributes method with empty attribute list. - */ - @Test - public void testGetOptionalAttributesWithEmptyList() { - final PersonalAttributeList pal = new PersonalAttributeList(); - Assert.assertTrue(pal.getOptionalAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's GetOptionalAttributes method without optional attributes. - */ - @Test - public void testGetOptionalAttributesWithoutOptional() { - final String strAttrList = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - Assert.assertTrue(pal.getOptionalAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's GetOptionalAttributes method with one optional attribute. - */ - @Test - public void testGetOptionalAttributesWithOneOptional() { - final String strAttrList = "age:false:[]:;isAgeOver:true:[15,]:;isAgeOver:true:[18,]:;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - Assert.assertTrue(pal.getOptionalAttributes().size() == ONE_CONS); - } - - /** - * Testing Personal Attribute List's GetOptionalAttributes method with two optional attribute. - */ - @Test - public void testGetOptionalAttributesWithOnlyOptional() { - final String strAttrList = "age:false:[]:;isAgeOver:false:[18,]:;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - Assert.assertTrue(pal.getOptionalAttributes().size() == TWO_CONS); - } - - /** - * Testing Personal Attribute List's getMandatoryAttributes method with empty attribute list. - */ - @Test - public void testGetMandatoryAttributesWithEmptyList() { - final PersonalAttributeList pal = new PersonalAttributeList(); - Assert.assertTrue(pal.getMandatoryAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's getMandatoryAttributes method without mandatory attributes. - */ - @Test - public void testGetMandatoryAttributesWithoutMandatory() { - final String strAttrList = "isAgeOver:false:[15,]:Available;isAgeOver:false:[18,]:Available;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - Assert.assertTrue(pal.getMandatoryAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's GetMandatoryAttributes method with one mandatory attribute. - */ - @Test - public void testGetMandatoryAttributesWithOneMandatory() { - final String strAttrList = "age:true:[]:;isAgeOver:false:[15,]:;isAgeOver:false:[18,]:;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - Assert.assertTrue(pal.getMandatoryAttributes().size() == ONE_CONS); - } - - /** - * Testing Personal Attribute List's GetMandatoryAttributes method with two mandatory attribute. - */ - @Test - public void testGetMandatoryAttributesWithOnlyMandatory() { - final String strAttrList = "age:true:[]:;isAgeOver:true:[18,]:;"; - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(strAttrList); - Assert.assertTrue(pal.getMandatoryAttributes().size() == TWO_CONS); - } - - /** - * Testing Personal Attribute List's getSimpleValueAttributes method with empty attribute list. - */ - @Test - public void testGetSimpleValueAttributesWithEmptyList() { - final PersonalAttributeList pal = new PersonalAttributeList(); - Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's getSimpleValueAttributes() method without simple attributes. - */ - @Test - public void testGetSimpleValueAttributesWithoutSimple() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(COMPLEX_ATTRLIST); - Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's getSimpleValueAttributes() method with one simple attribute. - */ - @Test - public void testGetSimpleValueAttributesWithOneSimple() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(STR_MIX_ATTR_LIST); - Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS); - } - - /** - * Testing Personal Attribute List's GetMandatoryAttributes method with two simple attribute. - */ - @Test - public void testGetSimpleValueAttributesWithOnlySimple() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(SIMPLE_ATTRLIST3); - Assert.assertTrue(pal.getSimpleValueAttributes().size() == TWO_CONS); - } - - /** - * Testing Personal Attribute List's getComplexValueAttributes method with empty attribute list. - */ - @Test - public void testGetComplexAttributesWithEmptyList() { - final PersonalAttributeList pal = new PersonalAttributeList(); - Assert.assertTrue(pal.getComplexAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's getComplexAttributes() method without complex attributes. - */ - @Test - public void testGetComplexAttributesWithoutSimple() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(SIMPLE_ATTRLIST2); - Assert.assertTrue(pal.getComplexAttributes().isEmpty()); - } - - /** - * Testing Personal Attribute List's getComplexAttributes() method with one complex attribute. - */ - @Test - public void testGetComplexAttributesWithOneComplex() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(STR_MIX_ATTR_LIST); - Assert.assertTrue(pal.getComplexAttributes().size() == ONE_CONS); - } - - /** - * Testing Personal Attribute List's GetMandatoryAttributes method with only two Complex attribute. - */ - @Test - public void testGetComplexAttributesWithOnlyComplex() { - final PersonalAttributeList pal = new PersonalAttributeList(); - pal.populate(STR_MIX_ATTR_LIST2); - Assert.assertTrue(pal.getComplexAttributes().size() == TWO_CONS); - } + /** + * isAgeOver constant value. + */ + private static final String ISAGEOVER_CONS = "isAgeOver"; + + /** + * 1 constant value. + */ + private static final int ONE_CONS = 1; + + /** + * 2 constant value. + */ + private static final int TWO_CONS = 2; + + /** + * An empty attribute. + */ + @SuppressWarnings("unused") + private static final IPersonalAttributeList EMPTY_ATTR_LIST + = new PersonalAttributeList(0); + + /** + * An attribute with a complex value (canonicalResidenceAddress). + */ + private static PersonalAttribute complexAttrValue = null; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST + = "isAgeOver:true:[15]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST2 + = "isAgeOver:true:[18]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST3 + = "isAgeOver:true:[15]:Available;isAgeOver:true:[18]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST4 + = "isAgeOver:true:[15,18]:Available;"; + + /** + * Simple attribute value list string. + */ + private static final String SIMPLE_ATTRLIST3_REVERSE + = "isAgeOver:true:[18]:Available;isAgeOver:true:[15]:Available;"; + /** + * Simple attribute value list string. + */ + private static final String COMPLEX_ATTRLIST + = "canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=Ed. B," + + "state=Porto,countryCodeAddress=PT,streetNumber=379," + + "streetName=Avenida Sidonio Pais,town=Porto]:Available;"; + /** + * Mix attribute list string. + */ + private static final String STR_MIX_ATTR_LIST + = "isAgeOver:true:[15]:Available;canonicalResidenceAddress:true:[" + + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," + + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto]:" + + "Available;"; + + /** + * Mix attribute list 2 string. + */ + private static final String STR_MIX_ATTR_LIST2 + = "isAgeOver:true:[15]:Available;canonicalResidenceAddress:true:[" + + "postalCode=4100,apartmentNumber=Ed.B,state=Porto,countryCodeAddress=PT," + + "streetNumber=379,streetName=Avenida Sidonio Pais,town=Porto]:Available;" + + "mandateContent:true:[" + + "isJoint=\"isjoint\",typeOfPower=\"power\",ValidTo=\"validto\",validfrom=\"validfrom\",AQAA=\"3\",isChained=\"ischained\",]:" + + "Available;"; + + /** + * Attribute List example. + */ + @SuppressWarnings({"serial"}) + private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( + "age", true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + /** + * Init PersonalAttributeListTestCase class. + */ + @SuppressWarnings("serial") + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Map<String, String> values = new HashMap<String, String>() { + { + put("countryCodeAddress", "PT"); + put("state", "Porto"); + put("town", "Porto"); + put("postalCode", "4100"); + put("streetName", "Avenida Sidonio Pais"); + put("streetNumber", "379"); + put("apartmentNumber", "Ed. B"); + } + }; + + complexAttrValue + = new PersonalAttribute("canonicalResidenceAddress", true, values, + STORKStatusCode.STATUS_AVAILABLE.toString()); + + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must + * be size 1 - Simple attribute. + */ + @Test + public void testAddSimpleAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(ATTR_VALUE); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must + * be size 1 - Complex attribute. + */ + @Test + public void testAddCompleAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(complexAttrValue); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must + * be size 0 - no attribute. + */ + @Test + public void testAddNull() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(null); + Assert.assertTrue(attrList.size() == 0); + } + + /** + * Testing Personal Attribute List add method. Same attribute name added + * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added + * twice. + */ + @SuppressWarnings("serial") + @Test + public void testAddSameAttrName() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + System.out.println(); + Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2); + } + + /** + * Testing Personal Attribute List add method. Same attribute name added + * twice. Personal Attribute list must be size 2 - IsAgeOver attribute added + * twice. + */ + @SuppressWarnings("serial") + @Test + public void testAddSameAttrNameEmpty() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add(""); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertTrue(attrList.size() == 1); + Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must + * be size 1 - Simple Value. + */ + @Test + public void testPutSimpleAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(ATTR_VALUE.getName(), ATTR_VALUE); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must + * be size 1 - Complex Value. + */ + @Test + public void testPutComplexAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(ATTR_VALUE.getName(), complexAttrValue); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must + * be size 0 - no attribute. + */ + @Test(expected = NullPointerException.class) + public void testPutNull() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put("", null); + Assert.assertTrue(attrList.size() == 0); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must + * be size 2 - IsAgeOver attribute added twice. + */ + @SuppressWarnings("serial") + @Test + public void testPutSameAttrName() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertTrue(attrList.size() == 1); + Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2); + } + + /** + * Testing Personal Attribute List put method. Personal Attribute list must + * be size 2 - IsAgeOver attribute added twice. + */ + @SuppressWarnings("serial") + @Test + public void testPutSameAttrNameEmpty() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add(""); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertTrue(attrList.size() == 1); + Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2); + } + + /** + * Testing Personal Attribute List get method. Personal Attribute list must + * be size 1 - Simple attribute. + */ + @Test + public void testGetSimpleAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(ATTR_VALUE); + Assert.assertEquals(ATTR_VALUE, attrList.get(ATTR_VALUE.getName())); + } + + /** + * Testing Personal Attribute List add method. Personal Attribute list must + * be size 1 - Complex attribute. + */ + @Test + public void testGetCompleAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(complexAttrValue); + Assert.assertEquals(complexAttrValue.toString(), + attrList.get(complexAttrValue.getName()).toString()); + } + + /** + * Testing Personal Attribute List get method. Personal Attribute list must + * be size 2 - IsAgeOver attribute. + */ + @SuppressWarnings("serial") + @Test + public void testGetIsAgeOverAttr() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertNotEquals(SIMPLE_ATTRLIST, + attrList.get(attrValueUnder.getName()).toString()); + Assert.assertNotEquals(SIMPLE_ATTRLIST2, + attrList.get(attrValueOver.getName()).toString()); + Assert.assertEquals(SIMPLE_ATTRLIST4, + attrList.get(attrValueOver.getName()).toString()); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Simple attribute. + */ + @Test + public void testPopulateSimpleAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(SIMPLE_ATTRLIST); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Complex attribute. + */ + @Test + public void testPopulateComplexAttr() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(COMPLEX_ATTRLIST); + Assert.assertTrue(attrList.size() == 1); + } + + /** + * Testing Personal Attribute List populate method. Personal Attribute list + * must be size 1 - Simple and Complex attribute. + */ + @Test + public void testPopulateMixAttrs() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(attrList.size() == 2); + //Assert.assertTrue(attrList.get(attrValueOver.getName()).getValue().size() == 2); + } + + /** + * Testing Personal Attribute List toString method using add. + */ + @SuppressWarnings("serial") + @Test + public void testToStringFromAdd() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST4, attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using put. + * + */ + @SuppressWarnings("serial") + @Test + public void testToStringFromPut() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertEquals(SIMPLE_ATTRLIST4, attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using populate. + */ + @Test + public void testToStringFromSimplePopulate() { + final String strAttrList = "isAgeOver:true"; + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(strAttrList); + Assert.assertEquals("isAgeOver:true:[]:;", attrList.toString()); + } + + /** + * Testing Personal Attribute List toString method using populate. + */ + @Test + public void testToStringFromPopulate() { + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.populate(SIMPLE_ATTRLIST3); + Assert.assertEquals(SIMPLE_ATTRLIST4, attrList.toString()); + } + + /** + * Testing Personal Attribute List populate method, with invalid values. + */ + @Test + public void testPopulateWithInvalidValuesFormat() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate("name:type:values:status;"); + Assert.assertEquals(pal, new PersonalAttributeList()); + } + + /** + * Testing Personal Attribute List populate method, with invalid format. + */ + @Test + public void testPopulateWithInvalidFormat() { + + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate("name:type::status;"); + Assert.assertEquals(pal, new PersonalAttributeList()); + } + + /** + * Testing Personal Attribute List clone method using add. + */ + @SuppressWarnings("serial") + @Test + public void testCloneFromAdd() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.add(attrValueUnder); + attrList.add(attrValueOver); + Assert.assertNotSame(attrList, attrList.clone()); + } + + /** + * Testing Personal Attribute List clone method using put. + */ + @SuppressWarnings("serial") + @Test + public void testCloneFromPut() { + final PersonalAttribute attrValueUnder + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + final PersonalAttribute attrValueOver + = new PersonalAttribute(ISAGEOVER_CONS, true, new ArrayList<String>() { + { + add("18"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + final IPersonalAttributeList attrList = new PersonalAttributeList(1); + attrList.put(attrValueUnder.getName(), attrValueUnder); + attrList.put(attrValueOver.getName(), attrValueOver); + Assert.assertNotSame(attrList, attrList.clone()); + } + + /** + * Testing Personal Attribute List clone method using populate. + */ + @Test + public void testCloneFromPopulate() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST3); + Assert.assertNotSame(pal, pal.clone()); + } + + /** + * Testing Personal Attribute List iterator. + */ + @Test + public void testIterator() { + final String strAttrList + = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + final Iterator<PersonalAttribute> itAttr = pal.iterator(); + while (itAttr.hasNext()) { + final PersonalAttribute attr = itAttr.next(); + Assert.assertEquals(ISAGEOVER_CONS, attr.getName()); + } + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method with empty + * attribute list. + */ + @Test + public void testGetOptionalAttributesWithEmptyList() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getOptionalAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method without + * optional attributes. + */ + @Test + public void testGetOptionalAttributesWithoutOptional() { + final String strAttrList + = "isAgeOver:true:[15,]:Available;isAgeOver:true:[18,]:Available;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getOptionalAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method with one + * optional attribute. + */ + @Test + public void testGetOptionalAttributesWithOneOptional() { + final String strAttrList + = "age:false:[]:;isAgeOver:true:[15,]:;isAgeOver:true:[18,]:;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getOptionalAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetOptionalAttributes method with two + * optional attribute. + */ + @Test + public void testGetOptionalAttributesWithOnlyOptional() { + final String strAttrList + = "age:false:[]:;isAgeOver:false:[18,]:;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getOptionalAttributes().size() == TWO_CONS); + } + + /** + * Testing Personal Attribute List's getMandatoryAttributes method with + * empty attribute list. + */ + @Test + public void testGetMandatoryAttributesWithEmptyList() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getMandatoryAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getMandatoryAttributes method without + * mandatory attributes. + */ + @Test + public void testGetMandatoryAttributesWithoutMandatory() { + final String strAttrList + = "isAgeOver:false:[15,]:Available;isAgeOver:false:[18,]:Available;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getMandatoryAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with one + * mandatory attribute. + */ + @Test + public void testGetMandatoryAttributesWithOneMandatory() { + final String strAttrList + = "age:true:[]:;isAgeOver:false:[15,]:;isAgeOver:false:[18,]:;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getMandatoryAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with two + * mandatory attribute. + */ + @Test + public void testGetMandatoryAttributesWithOnlyMandatory() { + final String strAttrList + = "age:true:[]:;isAgeOver:true:[18,]:;"; + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(strAttrList); + Assert.assertTrue(pal.getMandatoryAttributes().size() == TWO_CONS); + } + + /** + * Testing Personal Attribute List's getSimpleValueAttributes method with + * empty attribute list. + */ + @Test + public void testGetSimpleValueAttributesWithEmptyList() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getSimpleValueAttributes() method + * without simple attributes. + */ + @Test + public void testGetSimpleValueAttributesWithoutSimple() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(COMPLEX_ATTRLIST); + Assert.assertTrue(pal.getSimpleValueAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getSimpleValueAttributes() method with + * one simple attribute. + */ + @Test + public void testGetSimpleValueAttributesWithOneSimple() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with two + * simple attribute. + */ + @Test + public void testGetSimpleValueAttributesWithOnlySimple() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST3); + Assert.assertTrue(pal.getSimpleValueAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's getComplexValueAttributes method with + * empty attribute list. + */ + @Test + public void testGetComplexAttributesWithEmptyList() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + Assert.assertTrue(pal.getComplexAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getComplexAttributes() method without + * complex attributes. + */ + @Test + public void testGetComplexAttributesWithoutSimple() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(SIMPLE_ATTRLIST2); + Assert.assertTrue(pal.getComplexAttributes().isEmpty()); + } + + /** + * Testing Personal Attribute List's getComplexAttributes() method with one + * complex attribute. + */ + @Test + public void testGetComplexAttributesWithOneComplex() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(STR_MIX_ATTR_LIST); + Assert.assertTrue(pal.getComplexAttributes().size() == ONE_CONS); + } + + /** + * Testing Personal Attribute List's GetMandatoryAttributes method with only + * two Complex attribute. + */ + @Test + public void testGetComplexAttributesWithOnlyComplex() { + final IPersonalAttributeList pal = new PersonalAttributeList(); + pal.populate(STR_MIX_ATTR_LIST2); + Assert.assertTrue(pal.getComplexAttributes().size() == TWO_CONS); + } } diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java index 0f014d896..82676ccf0 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/PersonalAttributeTestCase.java @@ -17,8 +17,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import junit.framework.Assert; - import org.junit.BeforeClass; import org.junit.Test; @@ -27,138 +25,167 @@ import eu.stork.peps.auth.commons.STORKStatusCode; /** * The PersonalAttribute's Test Case. - * - * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, luis.felix@multicert.com, hugo.magalhaes@multicert.com, paulo.ribeiro@multicert.com + * + * @author ricardo.ferreira@multicert.com, renato.portela@multicert.com, + * luis.felix@multicert.com, hugo.magalhaes@multicert.com, + * paulo.ribeiro@multicert.com * @version $Revision: 1.4 $, $Date: 2010-11-17 05:17:03 $ */ public final class PersonalAttributeTestCase { - /** - * An empty attribute. - */ - private static final PersonalAttribute EMPTYATTR = new PersonalAttribute(); - - /** - * An attribute with a complex value (canonicalResidenceAddress). - */ - private static PersonalAttribute complexAttrValue = null; - - /** - * An attribute with a simple value (age). - */ - @SuppressWarnings("serial") - private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute("age", true, new ArrayList<String>() { - { - add("15"); - } - }, STORKStatusCode.STATUS_AVAILABLE.toString()); - - /** - * Init PersonalAttributeTestCase class. - */ - @SuppressWarnings("serial") - @BeforeClass - public static void runsBeforeTheTestSuite() { - final Map<String, String> values = new HashMap<String, String>() { - { - put("countryCodeAddress", "PT"); - put("state", "Porto"); - put("town", "Porto"); - put("postalCode", "4100"); - put("streetName", "Avenida Sidonio Pais"); - put("streetNumber", "379"); - put("apartmentNumber", "B"); - } - }; - - complexAttrValue = new PersonalAttribute("canonicalResidenceAddress", true, values, STORKStatusCode.STATUS_AVAILABLE.toString()); - - } - - /** - * Tests the {@link PersonalAttribute#toString()} method for the given simple attribute value. Values must match. - */ - @Test - public void testToStringValues() { - Assert.assertEquals("age:true:[15,]:Available;", ATTR_VALUE.toString()); - } - - /** - * Tests the {@link PersonalAttribute#toString()} method for the given complex attribute value. Values must match. - */ - @Test - public void testToStringComplexValues() { - Assert.assertEquals("canonicalResidenceAddress:true:[postalCode=4100,apartmentNumber=B," + "state=Porto,countryCodeAddress=PT,streetNumber=379," - + "streetName=Avenida Sidonio Pais,town=Porto,]:Available;", complexAttrValue.toString()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyStatusWithNull() { - Assert.assertTrue(EMPTYATTR.isEmptyStatus()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given new attribute. Must return true. - */ - @Test - public void testToIsEmptyStatusWithEmptyString() { - final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); - attr.setStatus(""); - Assert.assertTrue(attr.isEmptyStatus()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyValueWithNull() { - final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); - attr.setValue(null); - Assert.assertTrue(attr.isEmptyValue()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyValue() { - Assert.assertTrue(EMPTYATTR.isEmptyValue()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyComplexValueWithNull() { - final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); - attr.setComplexValue(null); - Assert.assertTrue(attr.isEmptyComplexValue()); - } - - /** - * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the given empty attribute. Must return true. - */ - @Test - public void testToIsEmptyComplexValueWithEmptyComplexValue() { - Assert.assertTrue(EMPTYATTR.isEmptyComplexValue()); - } - - /** - * Tests the {@link PersonalAttribute#clone()} method for the given attribute. Must return true. - */ - @Test - public void testCloneToComplexValue() { - Assert.assertNotSame(complexAttrValue, complexAttrValue.clone()); - } - - /** - * Tests the {@link PersonalAttribute#clone()} method for the given attribute. Must return true. - */ - @Test - public void testCloneToValue() { - Assert.assertNotSame(ATTR_VALUE, ATTR_VALUE.clone()); - } + /** + * An empty attribute. + */ + private static final PersonalAttribute EMPTYATTR = new PersonalAttribute(); + + /** + * An attribute with a complex value (canonicalResidenceAddress). + */ + private static PersonalAttribute complexAttrValue = null; + + /** + * An attribute with a simple value (age). + */ + @SuppressWarnings("serial") + private static final PersonalAttribute ATTR_VALUE = new PersonalAttribute( + "age", true, new ArrayList<String>() { + { + add("15"); + } + }, STORKStatusCode.STATUS_AVAILABLE.toString()); + + /** + * Init PersonalAttributeTestCase class. + */ + @SuppressWarnings("serial") + @BeforeClass + public static void runsBeforeTheTestSuite() { + final Map<String, String> values = new HashMap<String, String>() { + { + put("countryCodeAddress", "PT"); + put("state", "Porto"); + put("town", "Porto"); + put("postalCode", "4100"); + put("streetName", "Avenida Sidonio Pais"); + put("streetNumber", "379"); + put("apartmentNumber", "B"); + } + }; + + complexAttrValue + = new PersonalAttribute("canonicalResidenceAddress", true, values, + STORKStatusCode.STATUS_AVAILABLE.toString()); + + } + + /** + * Tests the {@link PersonalAttribute#toString()} method for the given + * simple attribute value. Values must match. + */ + @Test + public void testToStringValues() { + final String attrVal = ATTR_VALUE.toString(); + assert "age:true:[15]:Available;".equals(attrVal); + } + + /** + * Tests the {@link PersonalAttribute#toString()} method for the given + * complex attribute value. Values must match. + */ + @Test + public void testToStringComplexValues() { + //We are testing normal attribute Canonical address, only one value! + final Map<String,String> complexAttrVal = complexAttrValue.getComplexValue(); + final boolean testResult = containsKeyAndValue(complexAttrVal, "postalCode", "4100") && + containsKeyAndValue(complexAttrVal, "apartmentNumber", "B") && + containsKeyAndValue(complexAttrVal, "state", "Porto") && + containsKeyAndValue(complexAttrVal, "countryCodeAddress", "PT") && + containsKeyAndValue(complexAttrVal, "streetNumber", "379") && + containsKeyAndValue(complexAttrVal, "streetName", "Avenida Sidonio Pais") && + containsKeyAndValue(complexAttrVal, "town", "Porto"); + assert testResult; + } + + private boolean containsKeyAndValue(final Map<String,String> complexAttrVal, final String key, final String expectedValue) { + final boolean res = complexAttrVal.containsKey(key) && complexAttrVal.get(key).equals(expectedValue); + return res; + } + + /** + * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyStatusWithNull() { + assert EMPTYATTR.isEmptyStatus(); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyStatus()} method for the given + * new attribute. Must return true. + */ + @Test + public void testToIsEmptyStatusWithEmptyString() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setStatus(""); + assert attr.isEmptyStatus(); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyValueWithNull() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setValue(null); + assert attr.isEmptyValue(); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyValue()} method for the given + * empty attribute. Must return true. + */ + @Test + public void testToIsEmptyValue() { + assert EMPTYATTR.isEmptyValue(); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the + * given empty attribute. Must return true. + */ + @Test + public void testToIsEmptyComplexValueWithNull() { + final PersonalAttribute attr = (PersonalAttribute) EMPTYATTR.clone(); + attr.setComplexValue(null); + assert attr.isEmptyComplexValue(); + } + + /** + * Tests the {@link PersonalAttribute#isEmptyComplexValue()} method for the + * given empty attribute. Must return true. + */ + @Test + public void testToIsEmptyComplexValueWithEmptyComplexValue() { + assert EMPTYATTR.isEmptyComplexValue(); + } + + /** + * Tests the {@link PersonalAttribute#clone()} method for the given + * attribute. Must return true. + */ + @Test + public void testCloneToComplexValue() { + assert (complexAttrValue.getComplexValue().toString().equals(complexAttrValue.getComplexValue().toString()) && !complexAttrValue.equals(complexAttrValue.clone())); + } + + /** + * Tests the {@link PersonalAttribute#clone()} method for the given + * attribute. Must return true. + */ + @Test + public void testCloneToValue() { + assert !ATTR_VALUE.equals(ATTR_VALUE.clone()); + } } diff --git a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java index 452602210..37841dd03 100644 --- a/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java +++ b/id/server/stork2-commons/src/test/java/eu/stork/peps/tests/package-info.java @@ -2,4 +2,3 @@ * This package provides all JUnit test classes.
*/
package eu.stork.peps.tests;
-
diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml index 2b20da600..2a266a975 100644 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml @@ -2,86 +2,111 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> - <comment>SAML constants for AuthnRequests and Responses.</comment> - - <!-- Types of consent obtained from the user for this authentication and - data transfer. Allow values: 'unspecified'. --> - <entry key="consentAuthnRequest">unspecified</entry> - - <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit', - 'unspecified'. --> - <entry key="consentAuthnResponse">obtained</entry> - - <!--URI representing the classification of the identifier Allow values: - 'entity'. --> - <entry key="formatEntity">entity</entry> - - <!--Only HTTP-POST binding is only supported for inter PEPS --> - <!--The SOAP binding is only supported for direct communication between - SP-MW and VIdP --> - <entry key="protocolBinding">HTTP-POST</entry> - - - - - <!--URI representing the classification of the identifier Allow values: - 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry> - <entry key="eIDCrossBorderShare">true</entry> --> - - - - <!-- A friendly name for the attribute that can be displayed to a user --> - <entry key="friendlyName">false</entry> - - <!-- A friendly name for the attribute that can be displayed to a user --> - <entry key="isRequired">true</entry> - - <!--PEPS in the Service Provider's country --> - <entry key="requester">http://S-PEPS.gov.xx</entry> - - <!--PEPS in the citizen's origin country --> - <entry key="responder">http://C-PEPS.gov.xx</entry> - - <!--Subject cannot be confirmed on or after this seconds time (positive - number) --> - <entry key="timeNotOnOrAfter">300</entry> - - <!--Validation IP of the response --> - <entry key="ipAddrValidation">false</entry> - - - <!--Subject Attribute Definitions --> - <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> - <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> - <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> - <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> - <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> - <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> - <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> - <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> - <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> - <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> - <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry> - <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> - <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry> - <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> - <entry key="age">http://www.stork.gov.eu/1.0/age</entry> - <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> - - <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry> - <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry> - - <entry key="title">http://www.stork.gov.eu/1.0/title</entry> - <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry> - - <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry> - <entry key="citizen509Certificate">http://www.stork.gov.eu/1.0/citizen509Certificate</entry> - - <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry> - <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry> - <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> - <entry key="mandateContent">http://www.stork.gov.eu/1.0/mandateContent</entry> - - <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry> - + <comment>SAML constants for AuthnRequests and Responses.</comment> + + <!-- Types of consent obtained from the user for this authentication and + data transfer. Allow values: 'unspecified'. --> + <entry key="consentAuthnRequest">unspecified</entry> + + <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit', + 'unspecified'. --> + <entry key="consentAuthnResponse">obtained</entry> + + <!--URI representing the classification of the identifier Allow values: + 'entity'. --> + <entry key="formatEntity">entity</entry> + + <!--Only HTTP-POST binding is only supported for inter PEPS --> + <!--The SOAP binding is only supported for direct communication between + SP-MW and VIdP --> + <entry key="protocolBinding">HTTP-POST</entry> + + + + + <!--URI representing the classification of the identifier Allow values: + 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry> + <entry key="eIDCrossBorderShare">true</entry> --> + + + + <!-- A friendly name for the attribute that can be displayed to a user --> + <entry key="friendlyName">false</entry> + + <!-- A friendly name for the attribute that can be displayed to a user --> + <entry key="isRequired">true</entry> + + <!--PEPS in the Service Provider's country --> + <entry key="requester">http://S-PEPS.gov.xx</entry> + + <!--PEPS in the citizen's origin country --> + <entry key="responder">http://C-PEPS.gov.xx</entry> + + <!-- Format --> + <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry> + + <!--Subject cannot be confirmed on or after this seconds time (positive + number) --> + <entry key="timeNotOnOrAfter">300</entry> + + <!--Validation IP of the response --> + <entry key="ipAddrValidation">false</entry> + + + <!--Subject Attribute Definitions--> + <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> + <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> + <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> + <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> + <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> + <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> + <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> + <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> + <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry> + <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> + <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> + <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry> + <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry> + <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> + <entry key="title">http://www.stork.gov.eu/1.0/title</entry> + <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry> + <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> + <entry key="age">http://www.stork.gov.eu/1.0/age</entry> + <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> + <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry> + <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry> + <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry> + <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry> + <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry> + <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + + <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry> + <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry> + <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry> + <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry> + <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry> + <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry> + <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry> + <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry> + <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry> + <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry> + + <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry> + <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry> + <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry> + <entry key="type">http://www.stork.gov.eu/1.0/type</entry> + <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry> + <entry key="status">http://www.stork.gov.eu/1.0/status</entry> + <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry> + <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry> + <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry> + <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry> + <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry> + <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry> + <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry> + + </properties>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml index ad04cc3df..a65717a05 100644 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml @@ -2,84 +2,110 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> - <comment>SAML constants for AuthnRequests and Responses.</comment> - - <!-- Types of consent obtained from the user for this authentication and - data transfer. Allow values: 'unspecified'. --> - <entry key="consentAuthnRequest">unspecified</entry> - - <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit', - 'unspecified'. --> - <entry key="consentAuthnResponse">obtained</entry> - - <!--URI representing the classification of the identifier Allow values: - 'entity'. --> - <entry key="formatEntity">entity</entry> - - <!--Only HTTP-POST binding is only supported for inter PEPS --> - <!--The SOAP binding is only supported for direct communication between - SP-MW and VIdP --> - <entry key="protocolBinding">HTTP-POST</entry> - - - - - <!--URI representing the classification of the identifier Allow values: - 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry> - <entry key="eIDCrossBorderShare">true</entry> --> - - - - <!-- A friendly name for the attribute that can be displayed to a user --> - <entry key="friendlyName">false</entry> - - <!-- A friendly name for the attribute that can be displayed to a user --> - <entry key="isRequired">true</entry> - - <!--PEPS in the Service Provider's country --> - <entry key="requester">http://S-PEPS.gov.xx</entry> - - <!--PEPS in the citizen's origin country --> - <entry key="responder">http://C-PEPS.gov.xx</entry> - - <!--Subject cannot be confirmed on or after this seconds time (positive - number) --> - <entry key="timeNotOnOrAfter">300</entry> - - <!--Validation IP of the response --> - <entry key="ipAddrValidation">false</entry> - - - <!--Subject Attribute Definitions --> - <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> - <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> - <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> - <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> - <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> - <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> - <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> - <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> - <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> - <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> - <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry> - <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> - <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry> - <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> - <entry key="age">http://www.stork.gov.eu/1.0/age</entry> - <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> - - <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry> - <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry> - - <entry key="title">http://www.stork.gov.eu/1.0/title</entry> - <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry> - - <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry> - <entry key="citizen509Certificate">http://www.stork.gov.eu/1.0/citizen509Certificate</entry> - - <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry> - <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry> - <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> - <entry key="mandateContent">http://www.stork.gov.eu/1.0/mandateContent</entry> + <comment>SAML constants for AuthnRequests and Responses.</comment> + + <!-- Types of consent obtained from the user for this authentication and + data transfer. Allow values: 'unspecified'. --> + <entry key="consentAuthnRequest">unspecified</entry> + + <!-- Allow values: 'obtained', 'prior', 'current-implicit', 'current-explicit', + 'unspecified'. --> + <entry key="consentAuthnResponse">obtained</entry> + + <!--URI representing the classification of the identifier Allow values: + 'entity'. --> + <entry key="formatEntity">entity</entry> + + <!--Only HTTP-POST binding is only supported for inter PEPS --> + <!--The SOAP binding is only supported for direct communication between + SP-MW and VIdP --> + <entry key="protocolBinding">HTTP-POST</entry> + + + + + <!--URI representing the classification of the identifier Allow values: + 'entity'. <entry key="eIDSectorShare">true</entry> <entry key="eIDCrossSectorShare">true</entry> + <entry key="eIDCrossBorderShare">true</entry> --> + + + + <!-- A friendly name for the attribute that can be displayed to a user --> + <entry key="friendlyName">false</entry> + + <!-- A friendly name for the attribute that can be displayed to a user --> + <entry key="isRequired">true</entry> + + <!--PEPS in the Service Provider's country --> + <entry key="requester">http://S-PEPS.gov.xx</entry> + + <!--PEPS in the citizen's origin country --> + <entry key="responder">http://C-PEPS.gov.xx</entry> + + <!-- Format --> + <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry> + + <!--Subject cannot be confirmed on or after this seconds time (positive + number) --> + <entry key="timeNotOnOrAfter">300</entry> + + <!--Validation IP of the response --> + <entry key="ipAddrValidation">false</entry> + + + <!--Subject Attribute Definitions--> + <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> + <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> + <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> + <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> + <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> + <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> + <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> + <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> + <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry> + <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> + <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> + <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry> + <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry> + <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> + <entry key="title">http://www.stork.gov.eu/1.0/title</entry> + <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry> + <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> + <entry key="age">http://www.stork.gov.eu/1.0/age</entry> + <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> + <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry> + <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry> + <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry> + <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry> + <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry> + <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + + <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry> + <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry> + <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry> + <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry> + <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry> + <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry> + <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry> + <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry> + <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry> + <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry> + + <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry> + <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry> + <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry> + <entry key="type">http://www.stork.gov.eu/1.0/type</entry> + <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry> + <entry key="status">http://www.stork.gov.eu/1.0/status</entry> + <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry> + <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry> + <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry> + <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry> + <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry> + <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry> + <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry> </properties>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml index fd1db92ac..a0a5bea10 100644 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml @@ -2,59 +2,100 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> - <comment>SAML constants for AuthnRequests and Responses.</comment> - - <!-- Types of consent obtained from the user for this authentication and - data transfer. Allow values: 'unspecified'. --> - <entry key="consentAuthnRequest">unspecified</entry> - <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit', - 'unspecified'. --> - <entry key="consentAuthnResponse">obtained</entry> - - <!--URI representing the classification of the identifier Allow values: - 'entity'. --> - <entry key="formatEntity">entity</entry> - - <!--Only HTTP-POST binding is only supported for inter PEPS --> - <!--The SOAP binding is only supported for direct communication between - SP-MW and VIdP --> - <entry key="protocolBinding">HTTP-POST</entry> - - <entry key="eIDSectorShare">false</entry> - <entry key="eIDCrossSectorShare">false</entry> - <entry key="eIDCrossBorderShare">false</entry> - - <!--PEPS in the Service Provider's country --> - <entry key="requester">http://S-PEPS.gov.xx</entry> - - <!--PEPS in the citizen's origin country --> - <entry key="responder">http://C-PEPS.gov.xx</entry> - - <!--Subject cannot be confirmed on or after this seconds time --> - <entry key="timeNotOnOrAfter">300</entry> - - <!--Validation IP of the response --> - <entry key="ipAddrValidation">false</entry> - - <!-- A friendly name for the attribute that can be displayed to a user --> - <entry key="isRequired">false</entry> - - - <!--Subject Attribute Definitions --> - <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> - <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> - <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> - <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> - <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> - <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> - <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> - <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> - <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> - <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> - <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry> - <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> - <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry> - <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> - <entry key="age">http://www.stork.gov.eu/1.0/age</entry> - <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> + <comment>SAML constants for AuthnRequests and Responses.</comment> + + <!-- Types of consent obtained from the user for this authentication and + data transfer. Allow values: 'unspecified'. --> + <entry key="consentAuthnRequest">unspecified</entry> + <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit', + 'unspecified'. --> + <entry key="consentAuthnResponse">obtained</entry> + + <!--URI representing the classification of the identifier Allow values: + 'entity'. --> + <entry key="formatEntity">entity</entry> + + <!--Only HTTP-POST binding is only supported for inter PEPS --> + <!--The SOAP binding is only supported for direct communication between + SP-MW and VIdP --> + <entry key="protocolBinding">HTTP-POST</entry> + + <entry key="eIDSectorShare">false</entry> + <entry key="eIDCrossSectorShare">false</entry> + <entry key="eIDCrossBorderShare">false</entry> + + <!--PEPS in the Service Provider's country --> + <entry key="requester">http://S-PEPS.gov.xx</entry> + + <!--PEPS in the citizen's origin country --> + <entry key="responder">http://C-PEPS.gov.xx</entry> + + <!-- Format --> + <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry> + + <!--Subject cannot be confirmed on or after this seconds time --> + <entry key="timeNotOnOrAfter">300</entry> + + <!--Validation IP of the response --> + <entry key="ipAddrValidation">false</entry> + + <!-- A friendly name for the attribute that can be displayed to a user --> + <entry key="isRequired">false</entry> + + + <!--Subject Attribute Definitions--> + <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> + <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> + <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> + <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> + <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> + <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> + <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> + <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> + <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry> + <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> + <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> + <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry> + <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry> + <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> + <entry key="title">http://www.stork.gov.eu/1.0/title</entry> + <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry> + <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> + <entry key="age">http://www.stork.gov.eu/1.0/age</entry> + <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> + <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry> + <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry> + <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry> + <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry> + <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry> + <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + + <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry> + <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry> + <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry> + <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry> + <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry> + <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry> + <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry> + <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry> + <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry> + <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry> + + <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry> + <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry> + <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry> + <entry key="type">http://www.stork.gov.eu/1.0/type</entry> + <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry> + <entry key="status">http://www.stork.gov.eu/1.0/status</entry> + <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry> + <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry> + <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry> + <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry> + <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry> + <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry> + <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry> + </properties>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml index bea40d274..61c6cd6d6 100644 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml @@ -2,56 +2,96 @@ <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> - <comment>SAML constants for AuthnRequests and Responses.</comment> - - <!-- Types of consent obtained from the user for this authentication and - data transfer. Allow values: 'unspecified'. --> - <entry key="consentAuthnRequest">unspecified</entry> - <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit', - 'unspecified'. --> - <entry key="consentAuthnResponse">obtained</entry> - - <!--URI representing the classification of the identifier Allow values: - 'entity'. --> - <entry key="formatEntity">entity</entry> - - <!--Only HTTP-POST binding is only supported for inter PEPS --> - <!--The SOAP binding is only supported for direct communication between - SP-MW and VIdP --> - <entry key="protocolBinding">HTTP-POST</entry> - - <entry key="eIDSectorShare">false</entry> - <entry key="eIDCrossSectorShare">false</entry> - <entry key="eIDCrossBorderShare">false</entry> - - <!--PEPS in the Service Provider's country --> - <entry key="requester">http://S-PEPS.gov.xx</entry> - - <!--PEPS in the citizen's origin country --> - <entry key="responder">http://C-PEPS.gov.xx</entry> - - <!--Subject cannot be confirmed on or after this seconds time --> - <entry key="timeNotOnOrAfter">300</entry> - - <!--Validation IP of the response --> - <entry key="ipAddrValidation">false</entry> - - <!--Subject Attribute Definitions --> - <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> - <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> - <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> - <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> - <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> - <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> - <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> - <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> - <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> - <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> - <entry key="residenceAddress">http://www.stork.gov.eu/1.0/residenceAddress</entry> - <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> - <entry key="academicTitle">http://www.stork.gov.eu/1.0/academicTitle</entry> - <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> - <entry key="age">http://www.stork.gov.eu/1.0/age</entry> - <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> - <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry> + <comment>SAML constants for AuthnRequests and Responses.</comment> + + <!-- Types of consent obtained from the user for this authentication and + data transfer. Allow values: 'unspecified'. --> + <entry key="consentAuthnRequest">unspecified</entry> + <!-- Allow values: 'obtained', 'prior', 'curent-implicit', 'curent-explicit', + 'unspecified'. --> + <entry key="consentAuthnResponse">obtained</entry> + + <!--URI representing the classification of the identifier Allow values: + 'entity'. --> + <entry key="formatEntity">entity</entry> + + <!--Only HTTP-POST binding is only supported for inter PEPS --> + <!--The SOAP binding is only supported for direct communication between + SP-MW and VIdP --> + <entry key="protocolBinding">HTTP-POST</entry> + + <entry key="eIDSectorShare">false</entry> + <entry key="eIDCrossSectorShare">false</entry> + <entry key="eIDCrossBorderShare">false</entry> + + <!--PEPS in the Service Provider's country --> + <entry key="requester">http://S-PEPS.gov.xx</entry> + + <!--PEPS in the citizen's origin country --> + <entry key="responder">http://C-PEPS.gov.xx</entry> + + <!-- Format --> + <entry key="format">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</entry> + + <!--Subject cannot be confirmed on or after this seconds time --> + <entry key="timeNotOnOrAfter">300</entry> + + <!--Validation IP of the response --> + <entry key="ipAddrValidation">false</entry> + + <!--Subject Attribute Definitions--> + <entry key="eIdentifier">http://www.stork.gov.eu/1.0/eIdentifier</entry> + <entry key="givenName">http://www.stork.gov.eu/1.0/givenName</entry> + <entry key="surname">http://www.stork.gov.eu/1.0/surname</entry> + <entry key="inheritedFamilyName">http://www.stork.gov.eu/1.0/inheritedFamilyName</entry> + <entry key="adoptedFamilyName">http://www.stork.gov.eu/1.0/adoptedFamilyName</entry> + <entry key="gender">http://www.stork.gov.eu/1.0/gender</entry> + <entry key="dateOfBirth">http://www.stork.gov.eu/1.0/dateOfBirth</entry> + <entry key="countryCodeOfBirth">http://www.stork.gov.eu/1.0/countryCodeOfBirth</entry> + <entry key="placeOfBirth">http://www.stork.gov.eu/1.0/placeOfBirth</entry> + <entry key="nationalityCode">http://www.stork.gov.eu/1.0/nationalityCode</entry> + <entry key="maritalStatus">http://www.stork.gov.eu/1.0/maritalStatus</entry> + <entry key="textResidenceAddress">http://www.stork.gov.eu/1.0/textResidenceAddress</entry> + <entry key="canonicalResidenceAddress">http://www.stork.gov.eu/1.0/canonicalResidenceAddress</entry> + <entry key="eMail">http://www.stork.gov.eu/1.0/eMail</entry> + <entry key="title">http://www.stork.gov.eu/1.0/title</entry> + <entry key="residencePermit">http://www.stork.gov.eu/1.0/residencePermit</entry> + <entry key="pseudonym">http://www.stork.gov.eu/1.0/pseudonym</entry> + <entry key="age">http://www.stork.gov.eu/1.0/age</entry> + <entry key="isAgeOver">http://www.stork.gov.eu/1.0/isAgeOver</entry> + <entry key="signedDoc">http://www.stork.gov.eu/1.0/signedDoc</entry> + <entry key="citizenQAALevel">http://www.stork.gov.eu/1.0/citizenQAALevel</entry> + <entry key="fiscalNumber">http://www.stork.gov.eu/1.0/fiscalNumber</entry> + <entry key="unknown">http://www.stork.gov.eu/1.0/unknown</entry> + <entry key="newAttribute1">http://www.stork.gov.eu/1.0/newAttribute1</entry> + <entry key="newAttribute2">http://www.stork.gov.eu/1.0/newAttribute2</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + + <entry key="diplomaSupplement">http://www.stork.gov.eu/1.0/diplomaSupplement</entry> + <entry key="currentStudiesSupplement">http://www.stork.gov.eu/1.0/currentStudiesSupplement</entry> + <entry key="isStudent">http://www.stork.gov.eu/1.0/isStudent</entry> + <entry key="isAcademicStaff">http://www.stork.gov.eu/1.0/isAcademicStaff</entry> + <entry key="isTeacherOf">http://www.stork.gov.eu/1.0/isTeacherOf</entry> + <entry key="isCourseCoordinator">http://www.stork.gov.eu/1.0/isCourseCoordinator</entry> + <entry key="isAdminStaff">http://www.stork.gov.eu/1.0/isAdminStaff</entry> + <entry key="habilitation">http://www.stork.gov.eu/1.0/habilitation</entry> + <entry key="Title">http://www.stork.gov.eu/1.0/Title</entry> + <entry key="hasDegree">http://www.stork.gov.eu/1.0/hasDegree</entry> + <entry key="hasAccountInBank">http://www.stork.gov.eu/1.0/hasAccountInBank</entry> + <entry key="isHealthCareProfessional">http://www.stork.gov.eu/1.0/isHealthCareProfessional</entry> + + <entry key="eLPIdentifier">http://www.stork.gov.eu/1.0/eLPIdentifier</entry> + <entry key="legalName">http://www.stork.gov.eu/1.0/legalName</entry> + <entry key="alternativeName">http://www.stork.gov.eu/1.0/alternativeName</entry> + <entry key="type">http://www.stork.gov.eu/1.0/type</entry> + <entry key="translatableType">http://www.stork.gov.eu/1.0/translatableType</entry> + <entry key="status">http://www.stork.gov.eu/1.0/status</entry> + <entry key="activity">http://www.stork.gov.eu/1.0/activity</entry> + <entry key="registeredAddress">http://www.stork.gov.eu/1.0/registeredAddress</entry> + <entry key="registeredCanonicalAddress">http://www.stork.gov.eu/1.0/registeredCanonicalAddress</entry> + <entry key="contactInformation">http://www.stork.gov.eu/1.0/contactInformation</entry> + <entry key="LPFiscalNumber">http://www.stork.gov.eu/1.0/LPFiscalNumber</entry> + <entry key="mandate">http://www.stork.gov.eu/1.0/mandate</entry> + <entry key="docRequest">http://www.stork.gov.eu/1.0/docRequest</entry> + </properties>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml index 3764389e4..d4f6f89da 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml @@ -1,82 +1,68 @@ -<?xml version="1.0" encoding="UTF-8"?> -<saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" - Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_939726f0a02072f40b548de378612a50" - IssueInstant="2013-10-04T16:57:55.547Z" Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignedInfo> - <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> - <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> - <ds:Reference URI="#_939726f0a02072f40b548de378612a50"> - <ds:Transforms> - <ds:Transform - Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> - <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> - <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" - PrefixList="xs" /> - </ds:Transform> - </ds:Transforms> - <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> - <ds:DigestValue>BgPDTVCv7BhiWIs6HsC06jaHaag=</ds:DigestValue> - </ds:Reference> - </ds:SignedInfo> - <ds:SignatureValue>dIC61bGi6Jqp1zSVojpjaVq9WaZcDtNImXgo1Dyze5/hJA07Sy4TaHu+/IuLEC99aLjM6rxh2UUNqpPaQCFlF5eVkVv/c4gHEZVyevhjJKTidqmnuhlI78PGMx2thfxFsHsPcqHqOzy1Z6w18K1ds6APQP+aXI9TNKis+pykn4nJititYuiSseD0VY0F4QnXx+U6k3raoi1CAFE5fe7EuI/KfxuhhQLAbLq90Vm8R94ITBjfSS25mXstXNe9zppTSjDB42ld1TjDovDwXAn5OxiZasIEb5m68sRlxgoQ/2/+ZdYNNINFLAwkCbb8MiCbGASd626Bme0Kx+ropeWdxw==</ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIDXjCCAkagAwIBAgIEUk1MbDANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJJUzESMBAGA1UE - CAwJUmV5a2phdmlrMRIwEAYDVQQHDAlSZXlramF2aWsxEDAOBgNVBAoMB0FkdmFuaWExDzANBgNV - BAsMBlNUT1JLMjEXMBUGA1UEAwwOc2FtbC1kZW1vLWNlcnQwHhcNMTMxMDAzMTA1MzEyWhcNMjMx - MDAzMTA1MzEyWjBxMQswCQYDVQQGEwJJUzESMBAGA1UECAwJUmV5a2phdmlrMRIwEAYDVQQHDAlS - ZXlramF2aWsxEDAOBgNVBAoMB0FkdmFuaWExDzANBgNVBAsMBlNUT1JLMjEXMBUGA1UEAwwOc2Ft - bC1kZW1vLWNlcnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCkSgTxZkNRXZTKLB0c - 4oz7/8Dh56FX+0cYg7hjw4e8vn+ITXkxzrmUH57FtsvKln4mq1H0FHXL80u3IiWX8qY+QLgNeKeB - m85lXuyOb3wWpKAaQvpLAkejGLCx22AN2L0WZkKZV2puwRQVsRHCq6U6vToJXDZ6Ui6ltKsAl/ZS - 8qUFpiIvqD5ea4ohz4JsFE/uApRc7pbJ4VbOmAAeH/tQTayptq2kPb2vvUVk+2cH5J7UD+GCI88E - e+mS+C33tV9NmWUHL69mYEe8FXjumbKA5e9i1ejn9i0/BLUtHFonHnL9YFMim0foI7NNc5mNg9aw - vm0PuByVU3kuibQkqGBLAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAA9X5B4NBmVuhjECi+KOnRRX - 5oUV+jbYKhGZODDPi+F4Uo7ZtPFQ6sS3tE54+8AoDl5zQ5q5fDDVXhB42IIIjDxHKo8cBXie5FZ6 - mJtErvWZWYWdO0uV2OQAUALq2LieidqSFDJ+Pjl8w1New8oi3migwyE0jZo4Q97lJGDfJTruV0A2 - JE/Gt6QAAcWhhN2hZl92pYkIi5OeqHXyzBUp5vg8LLfNmeyziCAiXDC1Sy/aQU/cllZ3zFJMrqZM - s2xBpmB4sF1YRbIrr2OqEVE6M6DUx+pAQOd2uogV3AMT9D5MYpckI1jx/o/Tto7ju74nIVOskDiN - K0FR8izxcT0HixM=</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Extensions> - <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> - <storkp:eIDSectorShare>false</storkp:eIDSectorShare> - <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> - <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> - <storkp:RequestedAttributes> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="false" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">16</stork:AttributeValue> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">18</stork:AttributeValue> - </stork:RequestedAttribute> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">Sveinbjorn</stork:AttributeValue> - </stork:RequestedAttribute> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue> - </stork:RequestedAttribute> - </storkp:RequestedAttributes> - </saml2p:Extensions> - <saml2:Subject> - <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" /> - </saml2:Subject> +<?xml version="1.0" encoding="UTF-8"?><saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema" AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_bf999e47edabb47770eb406a5d37f24e" IssueInstant="2014-04-25T12:49:39.398Z" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> + <ds:Reference URI="#_bf999e47edabb47770eb406a5d37f24e"> + <ds:Transforms> + <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> + <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs"/> + </ds:Transform> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> + <ds:DigestValue>NwBXMUys6XjoR7Ddbr6JI5gB+O8=</ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue>MFoAC5mncGKFyvZKygSIH7+9JrXWMJ18jolBHZ0WisxpIrDldS+K+Mf6uwOirL5mal2uktpIT2RRiT1Twk+fS5t94wnobaLpktpv+uoZCzd2BAqFpBBHnImwC/UEy7hCF9htsW8CCx97wRXHA4IGx5OX9Fg4f+ZJdPPFLrGpdfJ3bJXvQeQPwGLqhjWio/XnAYwJYQ8YGQvRywZDDodTZDWHsKMHAsrIdmNJz93wmMPceRtgcUceZdN4jDkPE8SPNrApe2ksd3dEKauyyJQ2DR5jryVQpGM7sJzQhP9Z57XIJta+c/nJ7bttw+M+QsZn/E+CLQpcI8MeuuhBb1+mGA==</ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIDIjCCAgqgAwIBAgIES6idsjANBgkqhkiG9w0BAQUFADBTMQswCQYDVQQGEwJFUzEOMAwGA1UE + CAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxvY2Fs + LWRlbW8wHhcNMTMwODI4MTY0NzM1WhcNMTUwODI4MTY0NzM1WjBTMQswCQYDVQQGEwJFUzEOMAwG + A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxv + Y2FsLWRlbW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx+7zEQUbt8Ot9dByR5TuY + NPmTwaKhECtnkxYAx9tl+Ga3kFiv+dOSeDoQOhxkICG1ZMaG0Gtk0EQWjscC1cLwDXpAOdhOm5xh + ndFHxa3V3Y3zomFZA7A3nwP8wt17wDrc1xi2Ye8VrwO7Vjb/F8Rgutlcrvq+LF4g9nQLoRiKUq8w + NFvDlvhBbLr8hMVBMY/jY7tSQ85qLqKUkWRcoDttJjgWZoO1vpBS4m+FywtYdOoHnN6fv4Dvf1r2 + rNLgebgBvSfwznxiulwW6FBLasYX0rYKP7RfwG8TJ+FumOgAjADj2LdwK25RZNg44XU2V1z1Fp37 + fNXhfo08LpdD1ueFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBADMRGTWOmadZyCoJNluV+M7LopjC + 9WpFUj76X0cAoNXmt12zYqYe8hjRmBr6l2V/FXT3/TyWET1nILG46zwwAxslw3b2LvkhU+9QcuB8 + yC8TCJJ0kgsTZ/EUZPSbwUG7Nn2jkMiyjlyKcjSCQOzEKQyR1xYwyZG40+BPeGbYjmRgm6kcmCxY + USWoPwNyfke9gNT80f0pUj7wJ9YwWbTIz1rhf/h7rxoMYypXo+JXwaXW/Ra8v1uDcwfKpE5ZgwAU + nubLXF4A+H7/N7ZvB5XDwJ4W+99nuPsKfwacD8m1sflTXcEPzzhOq6iQ9anJT94/pMctnp827zXA + y66jvDrin5I=</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Extensions> + <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> + <stork:spCountry>IS</stork:spCountry> + <storkp:eIDSectorShare>false</storkp:eIDSectorShare> + <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> + <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> + <storkp:RequestedAttributes> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">Sveinbjorn</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="false"/> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/fiscalNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">fiscalNumber</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">16</stork:AttributeValue> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">18</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/LPFiscalNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">LPFiscalNumber</stork:AttributeValue> + </stork:RequestedAttribute> + </storkp:RequestedAttributes> + </saml2p:Extensions> + <saml2:Subject> + <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/> + </saml2:Subject> </saml2p:AttributeQuery>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml index 7dffe0312..fadc86d14 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestSdoc.xml @@ -1,68 +1,54 @@ -<?xml version="1.0" encoding="UTF-8"?> -<saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" - Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" - ID="_334488599e0c2781ff34857c4964debb" IssueInstant="2014-02-06T22:09:18.113Z" - Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignedInfo> - <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> - <ds:SignatureMethod - Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /> - <ds:Reference URI="#_334488599e0c2781ff34857c4964debb"> - <ds:Transforms> - <ds:Transform - Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> - <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> - <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" - PrefixList="xs" /> - </ds:Transform> - </ds:Transforms> - <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> - <ds:DigestValue>X1nUVB6qXdoKbJzNekiSo9ExLdw=</ds:DigestValue> - </ds:Reference> - </ds:SignedInfo> - <ds:SignatureValue>ExCPHHC/9OhdhOl1Ou+43Qw1nvskpbMYMu9vqa7m16doxM2PIUmK7LUw7hZiKtjIdBxuhpca3OrjO8O6MuTDN1FksWoj+7B1KTLFtmspucT5O7Cu2OqhK5WIVuCaLuA7CD0N2UfFouRwR5NlLHyzn9Trd7IM5OjA41dGb5jqYl7Ir+62+MgjhZRlLooDzb5fDAczbxv9LHGiKRBpgnk40w3gDAvoSPNdEuKhZi8LPQWWNBvVi3N5ZmJmAIacZWBqePywXTjygmChWAc8p7ptAX6tw0hpBxyxoW3aaZZzWQNcwobTRYbn89fcM11gqIz/YK7VXtiQ7WEQt1enQD/GAA==</ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIDIjCCAgqgAwIBAgIES6idsjANBgkqhkiG9w0BAQUFADBTMQswCQYDVQQGEwJFUzEOMAwGA1UE - CAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxvY2Fs - LWRlbW8wHhcNMTMwODI4MTY0NzM1WhcNMTUwODI4MTY0NzM1WjBTMQswCQYDVQQGEwJFUzEOMAwG - A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxv - Y2FsLWRlbW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx+7zEQUbt8Ot9dByR5TuY - NPmTwaKhECtnkxYAx9tl+Ga3kFiv+dOSeDoQOhxkICG1ZMaG0Gtk0EQWjscC1cLwDXpAOdhOm5xh - ndFHxa3V3Y3zomFZA7A3nwP8wt17wDrc1xi2Ye8VrwO7Vjb/F8Rgutlcrvq+LF4g9nQLoRiKUq8w - NFvDlvhBbLr8hMVBMY/jY7tSQ85qLqKUkWRcoDttJjgWZoO1vpBS4m+FywtYdOoHnN6fv4Dvf1r2 - rNLgebgBvSfwznxiulwW6FBLasYX0rYKP7RfwG8TJ+FumOgAjADj2LdwK25RZNg44XU2V1z1Fp37 - fNXhfo08LpdD1ueFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBADMRGTWOmadZyCoJNluV+M7LopjC - 9WpFUj76X0cAoNXmt12zYqYe8hjRmBr6l2V/FXT3/TyWET1nILG46zwwAxslw3b2LvkhU+9QcuB8 - yC8TCJJ0kgsTZ/EUZPSbwUG7Nn2jkMiyjlyKcjSCQOzEKQyR1xYwyZG40+BPeGbYjmRgm6kcmCxY - USWoPwNyfke9gNT80f0pUj7wJ9YwWbTIz1rhf/h7rxoMYypXo+JXwaXW/Ra8v1uDcwfKpE5ZgwAU - nubLXF4A+H7/N7ZvB5XDwJ4W+99nuPsKfwacD8m1sflTXcEPzzhOq6iQ9anJT94/pMctnp827zXA - y66jvDrin5I=</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Extensions> - <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> - <stork:spCountry>IS</stork:spCountry> - <storkp:eIDSectorShare>false</storkp:eIDSectorShare> - <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> - <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> - <storkp:RequestedAttributes> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/docRequest" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">IS/IS/fbea6e68-0393-401b-b616-f767fff9418c</stork:AttributeValue> - </stork:RequestedAttribute> - </storkp:RequestedAttributes> - </saml2p:Extensions> - <saml2:Subject> - <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" /> - </saml2:Subject> +<?xml version="1.0" encoding="UTF-8"?><saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" xmlns:xs="http://www.w3.org/2001/XMLSchema" AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest" ID="_0b74cf761d490383ac5127629a39a458" IssueInstant="2014-04-25T12:49:39.848Z" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> + <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> + <ds:Reference URI="#_0b74cf761d490383ac5127629a39a458"> + <ds:Transforms> + <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> + <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs"/> + </ds:Transform> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> + <ds:DigestValue>2WMvsIXoH1VpwqbNiXG8lWS2ZPc=</ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue>nMfUZiYHyHgSky4NHfDGch8a6UxWupS1Dhk2mu3L065Vq2eKLfDwWjgNkKPDoLcEkgAiDpNlLsS0+nDk8IexAMSq+T54Mlt4AhMRIrDP3SlWya5mqQ0VnxFENGlhi7kSKK2oIMfkiaeIBART7QBZggSZFnk0mw/BzmJM5bJ4Dipymndx7tv98BDlWFZEKH7iSc9uUuMpVygTNDxtEsdMcBKpqYiyVyTln8/xKsqXSL4RA10MYmqfvFsMZWUwQUgdl5tor910/XrAXHXJY50zH0CwekUXszOdvO7s3WvrG4lt3goqq2WDcaeDzizV93+Ih+lVl9PebTtMxCyO4fxw7Q==</ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIDIjCCAgqgAwIBAgIES6idsjANBgkqhkiG9w0BAQUFADBTMQswCQYDVQQGEwJFUzEOMAwGA1UE + CAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxvY2Fs + LWRlbW8wHhcNMTMwODI4MTY0NzM1WhcNMTUwODI4MTY0NzM1WjBTMQswCQYDVQQGEwJFUzEOMAwG + A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExEzARBgNVBAMMCmxv + Y2FsLWRlbW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCx+7zEQUbt8Ot9dByR5TuY + NPmTwaKhECtnkxYAx9tl+Ga3kFiv+dOSeDoQOhxkICG1ZMaG0Gtk0EQWjscC1cLwDXpAOdhOm5xh + ndFHxa3V3Y3zomFZA7A3nwP8wt17wDrc1xi2Ye8VrwO7Vjb/F8Rgutlcrvq+LF4g9nQLoRiKUq8w + NFvDlvhBbLr8hMVBMY/jY7tSQ85qLqKUkWRcoDttJjgWZoO1vpBS4m+FywtYdOoHnN6fv4Dvf1r2 + rNLgebgBvSfwznxiulwW6FBLasYX0rYKP7RfwG8TJ+FumOgAjADj2LdwK25RZNg44XU2V1z1Fp37 + fNXhfo08LpdD1ueFAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBADMRGTWOmadZyCoJNluV+M7LopjC + 9WpFUj76X0cAoNXmt12zYqYe8hjRmBr6l2V/FXT3/TyWET1nILG46zwwAxslw3b2LvkhU+9QcuB8 + yC8TCJJ0kgsTZ/EUZPSbwUG7Nn2jkMiyjlyKcjSCQOzEKQyR1xYwyZG40+BPeGbYjmRgm6kcmCxY + USWoPwNyfke9gNT80f0pUj7wJ9YwWbTIz1rhf/h7rxoMYypXo+JXwaXW/Ra8v1uDcwfKpE5ZgwAU + nubLXF4A+H7/N7ZvB5XDwJ4W+99nuPsKfwacD8m1sflTXcEPzzhOq6iQ9anJT94/pMctnp827zXA + y66jvDrin5I=</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Extensions> + <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> + <stork:spCountry>IS</stork:spCountry> + <storkp:eIDSectorShare>false</storkp:eIDSectorShare> + <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> + <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> + <storkp:RequestedAttributes> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/docRequest" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:anyType">IS/IS/fbea6e68-0393-401b-b616-f767fff9418c</stork:AttributeValue> + </stork:RequestedAttribute> + </storkp:RequestedAttributes> + </saml2p:Extensions> + <saml2:Subject> + <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/> + </saml2:Subject> </saml2p:AttributeQuery>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml index becc689fe..5c04f5c93 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml @@ -1,66 +1,66 @@ <?xml version="1.0" encoding="UTF-8"?> <saml2p:AttributeQuery xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" - Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_f6c8fc355b9f125cb5283f038e1b3cdf" - IssueInstant="2013-10-03T10:28:15.449Z" Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignatureValue>hhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==</ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw - YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v - LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG - A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv - Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab - ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU - 0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n - 6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 - y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z - 9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F - 6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM - pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT - /NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq - yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 - Ppm8IFVTk8mYfX8/jw==</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Extensions> - <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> - <storkp:eIDSectorShare>false</storkp:eIDSectorShare> - <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> - <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> - <storkp:RequestedAttributes> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="false" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">16</stork:AttributeValue> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">18</stork:AttributeValue> - </stork:RequestedAttribute> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">Sveinbjörn</stork:AttributeValue> - </stork:RequestedAttribute> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue> - </stork:RequestedAttribute> - </storkp:RequestedAttributes> - </saml2p:Extensions> - <saml2:Subject> - <saml2:SubjectConfirmation - Method="urn:oasis:names:tc:SAML:1.0:cm:sender-vouches" /> - </saml2:Subject> + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" + xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" + Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_f6c8fc355b9f125cb5283f038e1b3cdf" + IssueInstant="2013-10-03T10:28:15.449Z" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignatureValue>hhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==</ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw + YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v + LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG + A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv + Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab + ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU + 0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n + 6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 + y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z + 9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F + 6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM + pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT + /NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq + yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 + Ppm8IFVTk8mYfX8/jw==</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Extensions> + <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> + <storkp:eIDSectorShare>false</storkp:eIDSectorShare> + <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> + <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> + <storkp:RequestedAttributes> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="false" /> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">16</stork:AttributeValue> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">18</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">Sveinbjörn</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true"> + <stork:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">ES/IS/1234567890</stork:AttributeValue> + </stork:RequestedAttribute> + </storkp:RequestedAttributes> + </saml2p:Extensions> + <saml2:Subject> + <saml2:SubjectConfirmation + Method="urn:oasis:names:tc:SAML:1.0:cm:sender-vouches" /> + </saml2:Subject> </saml2p:AttributeQuery>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml index 7ea486812..79c59f5ed 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml @@ -1,124 +1,124 @@ <?xml version="1.0" encoding="UTF-8"?> <saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:obtained" - Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_483140d440fc4eef8e949ace49669f2e" - InResponseTo="_0a22c1120bf2de912714c24e99dd38ed" IssueInstant="2013-10-08T09:11:17.255Z" - Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignedInfo> - <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> - <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> - <ds:Reference URI="#_483140d440fc4eef8e949ace49669f2e"> - <ds:Transforms> - <ds:Transform - Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> - <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> - <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" - PrefixList="xs" /> - </ds:Transform> - </ds:Transforms> - <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> - <ds:DigestValue>yMOVS1T/yRiVh3L6IBM9rR9Ie3w=</ds:DigestValue> - </ds:Reference> - </ds:SignedInfo> - <ds:SignatureValue>d8e/RyNNPmnHRIzTIuRSnW6B60oWGBGxjRua/HvNxTuod0qSarYJxEedhY9Wl1Z9WYXlry28FuKjp3DA3HhzNaVd7A7QpFqNC4dnizSVWFjxlhmoE/Uv3Y/ha9P/fk6nbtHCSKW4kHSX7QfFLeggcLmUG0IULRF8UmRdQ0WerCl0aSZZeSp8J3LsFBPeWCRSwXgfiLn+RehggzZmQU6g0ssxrpnsYEAtjAiOli+YVQGuumsZGaJ8zHA/DgJ2FTGovNUyfuSUFLhd9nLlSqFs2Avnx0Ck7Q1dxDO5truOm6e285YLHqLaGdetFyPQAj/Z4w4RJ5u5X6d7rhBjTfRAAw==</ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw - YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v - LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG - A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv - Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab - ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU - 0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n - 6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 - y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z - 9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F - 6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM - pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT - /NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq - yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 - Ppm8IFVTk8mYfX8/jw==</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Status> - <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" /> - <saml2p:StatusMessage>urn:oasis:names:tc:SAML:2.0:status:Success</saml2p:StatusMessage> - </saml2p:Status> - <saml2:Assertion ID="_9ed05849dee5c154e62fa9e3ba53e9f3" - IssueInstant="2013-10-08T09:11:17.255Z" Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer> - <saml2:Subject> - <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" - NameQualifier="http://C-PEPS.gov.xx">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</saml2:NameID> - <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> - <saml2:SubjectConfirmationData - Address="111.222.333.444" InResponseTo="_0a22c1120bf2de912714c24e99dd38ed" - NotOnOrAfter="2013-10-08T09:16:17.255Z" /> - </saml2:SubjectConfirmation> - </saml2:Subject> - <saml2:Conditions NotBefore="2013-10-08T09:11:17.255Z" - NotOnOrAfter="2013-10-08T09:16:17.255Z"> - <saml2:AudienceRestriction> - <saml2:Audience>http://S-PEPS.gov.xx</saml2:Audience> - </saml2:AudienceRestriction> - <saml2:OneTimeUse /> - </saml2:Conditions> - <saml2:AuthnStatement AuthnInstant="2013-10-08T09:11:17.255Z"> - <saml2:SubjectLocality Address="111.222.333.444" /> - <saml2:AuthnContext> - <saml2:AuthnContextDecl /> - </saml2:AuthnContext> - </saml2:AuthnStatement> - <saml2:AttributeStatement> - <saml2:Attribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - stork:AttributeStatus="Available"> - <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">16/12/2008</saml2:AttributeValue> - </saml2:Attribute> - <saml2:Attribute - Name="http://www.stork.gov.eu/1.0/canonicalResidenceAddress" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - stork:AttributeStatus="Available"> - <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType"> - <stork:postalCode xsi:type="xs:anyType">105</stork:postalCode> - <stork:state xsi:type="xs:anyType">IS</stork:state> - <stork:streetNumber xsi:type="xs:anyType">10</stork:streetNumber> - <stork:streetName xsi:type="xs:anyType">Gudrunartun</stork:streetName> - <stork:town xsi:type="xs:anyType">Reykjavik</stork:town> - </saml2:AttributeValue> - </saml2:Attribute> - <saml2:Attribute Name="http://www.stork.gov.eu/1.0/newAttribute2" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - stork:AttributeStatus="Available"> - <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType"> - <stork:value3 xsi:type="xs:anyType">value3</stork:value3> - <stork:value4 xsi:type="xs:anyType">value4</stork:value4> - <stork:value1 xsi:type="xs:anyType">value1</stork:value1> - <stork:value2 xsi:type="xs:anyType">value2</stork:value2> - </saml2:AttributeValue> - </saml2:Attribute> - <saml2:Attribute Name="http://www.stork.gov.eu/1.0/isAgeOver" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - stork:AttributeStatus="Available"> - <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">16</saml2:AttributeValue> - <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">18</saml2:AttributeValue> - </saml2:Attribute> - <saml2:Attribute Name="http://www.stork.gov.eu/1.0/eIdentifier" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - stork:AttributeStatus="Available"> - <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:type="xs:anyType">123456789IS</saml2:AttributeValue> - </saml2:Attribute> - </saml2:AttributeStatement> - </saml2:Assertion> + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" + xmlns:xs="http://www.w3.org/2001/XMLSchema" Consent="urn:oasis:names:tc:SAML:2.0:consent:obtained" + Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" ID="_483140d440fc4eef8e949ace49669f2e" + InResponseTo="_0a22c1120bf2de912714c24e99dd38ed" IssueInstant="2013-10-08T09:11:17.255Z" + Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> + <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> + <ds:Reference URI="#_483140d440fc4eef8e949ace49669f2e"> + <ds:Transforms> + <ds:Transform + Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> + <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" + PrefixList="xs" /> + </ds:Transform> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> + <ds:DigestValue>yMOVS1T/yRiVh3L6IBM9rR9Ie3w=</ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue>d8e/RyNNPmnHRIzTIuRSnW6B60oWGBGxjRua/HvNxTuod0qSarYJxEedhY9Wl1Z9WYXlry28FuKjp3DA3HhzNaVd7A7QpFqNC4dnizSVWFjxlhmoE/Uv3Y/ha9P/fk6nbtHCSKW4kHSX7QfFLeggcLmUG0IULRF8UmRdQ0WerCl0aSZZeSp8J3LsFBPeWCRSwXgfiLn+RehggzZmQU6g0ssxrpnsYEAtjAiOli+YVQGuumsZGaJ8zHA/DgJ2FTGovNUyfuSUFLhd9nLlSqFs2Avnx0Ck7Q1dxDO5truOm6e285YLHqLaGdetFyPQAj/Z4w4RJ5u5X6d7rhBjTfRAAw==</ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw + YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRgwFgYDVQQDDA9sb2NhbC1kZW1v + LWNlcnQwHhcNMTAwMzIzMTA1MzM4WhcNMTAwNjAxMTA1MzM4WjBYMQswCQYDVQQGEwJFUzEOMAwG + A1UECAwFU3BhaW4xDzANBgNVBAcMBk1hZHJpZDEOMAwGA1UECgwFSW5kcmExGDAWBgNVBAMMD2xv + Y2FsLWRlbW8tY2VydDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJfdQ1/mkM9sqqab + ri8qqqX4s0J6UEEXyF+0AjLU8RC4WMeYFSZ5tfwnyLsoXY0/9bZLXnBxSibQYaf4SnpZJhlVA4sU + 0d8qyEWA2OvXGDCm7uspGHG3CRQa7fpHsmHmfIAqho9XDlwpwJdx5gK4Edc6aArcMQfjqMhy1s1n + 6Of1i1lMGGsGrERIRY7biIQu/8nITbHH18sUAZMG1u/Q0Avi9O3LWyswHXUouZ818fWwG6xru2N5 + y6vtVO/SL3doRSdqYkEms93TgxTtaKg8XNe24zhNTte6nvWLaKesi2KzZGC57HU47HBFEs8NWk7z + 9BDf8uLyPz9VDahwVKzMto8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAgpuReXQ7Dsfdoe5zzy2F + 6kn1qqtMkRGsBPKnDFCI/GkIZpBiqlfwdh6sipnFKWfKEDlPKN1kEhbkDR2GA1Cp4F4ZSL/HumZM + pWabRhDxhTPvHIFbbShPDJY93+jw/yQeaWgMuhw3WzdH9TrVoRZH0Q7sG1pIJo5/6IogIZwFvJHT + /NDutKmurU6Lw8Vnde8PfnQd+FTEhz0SEGyKkWjAuhGbJfseBy/z3L+MJq1rdSQ9PF7wXDvWNzJq + yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 + Ppm8IFVTk8mYfX8/jw==</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Status> + <saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" /> + <saml2p:StatusMessage>urn:oasis:names:tc:SAML:2.0:status:Success</saml2p:StatusMessage> + </saml2p:Status> + <saml2:Assertion ID="_9ed05849dee5c154e62fa9e3ba53e9f3" + IssueInstant="2013-10-08T09:11:17.255Z" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://C-PEPS.gov.xx</saml2:Issuer> + <saml2:Subject> + <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" + NameQualifier="http://C-PEPS.gov.xx">urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</saml2:NameID> + <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"> + <saml2:SubjectConfirmationData + Address="111.222.333.444" InResponseTo="_0a22c1120bf2de912714c24e99dd38ed" + NotOnOrAfter="2013-10-08T09:16:17.255Z" /> + </saml2:SubjectConfirmation> + </saml2:Subject> + <saml2:Conditions NotBefore="2013-10-08T09:11:17.255Z" + NotOnOrAfter="2013-10-08T09:16:17.255Z"> + <saml2:AudienceRestriction> + <saml2:Audience>http://S-PEPS.gov.xx</saml2:Audience> + </saml2:AudienceRestriction> + <saml2:OneTimeUse /> + </saml2:Conditions> + <saml2:AuthnStatement AuthnInstant="2013-10-08T09:11:17.255Z"> + <saml2:SubjectLocality Address="111.222.333.444" /> + <saml2:AuthnContext> + <saml2:AuthnContextDecl /> + </saml2:AuthnContext> + </saml2:AuthnStatement> + <saml2:AttributeStatement> + <saml2:Attribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + stork:AttributeStatus="Available"> + <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">16/12/2008</saml2:AttributeValue> + </saml2:Attribute> + <saml2:Attribute + Name="http://www.stork.gov.eu/1.0/canonicalResidenceAddress" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + stork:AttributeStatus="Available"> + <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType"> + <stork:postalCode xsi:type="xs:anyType">105</stork:postalCode> + <stork:state xsi:type="xs:anyType">IS</stork:state> + <stork:streetNumber xsi:type="xs:anyType">10</stork:streetNumber> + <stork:streetName xsi:type="xs:anyType">Gudrunartun</stork:streetName> + <stork:town xsi:type="xs:anyType">Reykjavik</stork:town> + </saml2:AttributeValue> + </saml2:Attribute> + <saml2:Attribute Name="http://www.stork.gov.eu/1.0/newAttribute2" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + stork:AttributeStatus="Available"> + <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType"> + <stork:value3 xsi:type="xs:anyType">value3</stork:value3> + <stork:value4 xsi:type="xs:anyType">value4</stork:value4> + <stork:value1 xsi:type="xs:anyType">value1</stork:value1> + <stork:value2 xsi:type="xs:anyType">value2</stork:value2> + </saml2:AttributeValue> + </saml2:Attribute> + <saml2:Attribute Name="http://www.stork.gov.eu/1.0/isAgeOver" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + stork:AttributeStatus="Available"> + <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">16</saml2:AttributeValue> + <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">18</saml2:AttributeValue> + </saml2:Attribute> + <saml2:Attribute Name="http://www.stork.gov.eu/1.0/eIdentifier" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + stork:AttributeStatus="Available"> + <saml2:AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:type="xs:anyType">123456789IS</saml2:AttributeValue> + </saml2:Attribute> + </saml2:AttributeStatement> + </saml2:Assertion> </saml2p:Response>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml index c48bfde95..93e778113 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml @@ -1,72 +1,72 @@ <?xml version="1.0" encoding="UTF-8"?> <saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" - Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" - ForceAuthn="true" ID="_e54eee285e7b8e2772875c406ec39674" IsPassive="false" - IssueInstant="2010-06-08T07:37:54.533Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" - ProviderName="University of Oxford" Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignedInfo> - <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> - <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> - <ds:Reference URI="#_e54eee285e7b8e2772875c406ec39674"> - <ds:Transforms> - <ds:Transform - Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> - <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> - <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" - PrefixList="ds saml2 saml2p stork storkp xs" /> - </ds:Transform> - </ds:Transforms> - <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> - <ds:DigestValue>yzsqaxBNicOrixBUno5cL0CBOpE=</ds:DigestValue> - </ds:Reference> - </ds:SignedInfo> - <ds:SignatureValue> - Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC - wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi - YIN/BUEtXkoYTjPtkmA= - </ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw - MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG - 9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu - h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r - /WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk - 3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K - eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq - KAoZgbUK0Zld3Dsheg==</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Extensions> - <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> - <stork:spSector>EDU001</stork:spSector> - <stork:spInstitution>OXF001</stork:spInstitution> - <stork:spApplication>APP001</stork:spApplication> - <stork:spCountry>EN</stork:spCountry> - <storkp:eIDSectorShare>true</storkp:eIDSectorShare> - <storkp:eIDCrossSectorShare>true</storkp:eIDCrossSectorShare> - <storkp:eIDCrossBorderShare>true</storkp:eIDCrossBorderShare> - <storkp:RequestedAttributes> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"> - <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">16</stork:AttributeValue> - <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">18</stork:AttributeValue> - </stork:RequestedAttribute> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="false" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - </storkp:RequestedAttributes> - </saml2p:Extensions> + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:assertion" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" + AssertionConsumerServiceURL="http://S-PEPS.gov.xx/PEPS/ColleagueResponse" + Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://C-PEPS.gov.xx/PEPS/ColleagueRequest" + ForceAuthn="true" ID="_e54eee285e7b8e2772875c406ec39674" IsPassive="false" + IssueInstant="2010-06-08T07:37:54.533Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" + ProviderName="University of Oxford" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignedInfo> + <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> + <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /> + <ds:Reference URI="#_e54eee285e7b8e2772875c406ec39674"> + <ds:Transforms> + <ds:Transform + Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> + <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> + <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" + PrefixList="ds saml2 saml2p stork storkp xs" /> + </ds:Transform> + </ds:Transforms> + <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /> + <ds:DigestValue>yzsqaxBNicOrixBUno5cL0CBOpE=</ds:DigestValue> + </ds:Reference> + </ds:SignedInfo> + <ds:SignatureValue> + Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC + wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi + YIN/BUEtXkoYTjPtkmA= + </ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw + MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG + 9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu + h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r + /WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk + 3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K + eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq + KAoZgbUK0Zld3Dsheg==</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Extensions> + <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> + <stork:spSector>EDU001</stork:spSector> + <stork:spInstitution>OXF001</stork:spInstitution> + <stork:spApplication>APP001</stork:spApplication> + <stork:spCountry>EN</stork:spCountry> + <storkp:eIDSectorShare>true</storkp:eIDSectorShare> + <storkp:eIDCrossSectorShare>true</storkp:eIDCrossSectorShare> + <storkp:eIDCrossBorderShare>true</storkp:eIDCrossBorderShare> + <storkp:RequestedAttributes> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/isAgeOver" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true"> + <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">16</stork:AttributeValue> + <stork:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">18</stork:AttributeValue> + </stork:RequestedAttribute> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="false" /> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/eIdentifier" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + </storkp:RequestedAttributes> + </saml2p:Extensions> </saml2p:AuthnRequest>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml index 8766f9a8b..cca0dbc27 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml @@ -1,47 +1,47 @@ <?xml version="1.0" encoding="UTF-8"?> <saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage" - Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://locahost:8080/PEPS/ServiceProvider" - ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false" - IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" - ProviderName="PT-SP" Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignatureValue> - S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR - Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC - Xt8p8tK3EoMocZse2hw= - </ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw - OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA - A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl - lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK - ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl - r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w - kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS - 3cyl/wz8</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Extensions> - <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> - <storkp:eIDSectorShare>false</storkp:eIDSectorShare> - <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> - <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> - <storkp:RequestedAttributes> - <stork:RequestedAttribute - Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - </storkp:RequestedAttributes> - </saml2p:Extensions> + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" + AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage" + Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://locahost:8080/PEPS/ServiceProvider" + ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false" + IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" + ProviderName="PT-SP" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignatureValue> + S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR + Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC + Xt8p8tK3EoMocZse2hw= + </ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw + OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA + A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl + lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK + ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl + r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w + kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS + 3cyl/wz8</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Extensions> + <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> + <storkp:eIDSectorShare>false</storkp:eIDSectorShare> + <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> + <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> + <storkp:RequestedAttributes> + <stork:RequestedAttribute + Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + </storkp:RequestedAttributes> + </saml2p:Extensions> </saml2p:AuthnRequest>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml index 1b1e1646c..db606145c 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml @@ -1,47 +1,47 @@ <?xml version="1.0" encoding="UTF-8"?> <saml2p:AuthnRequest xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" - xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" - AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage" - Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://localhost:8080/PEPS/ServiceProvider" - ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false" - IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" - ProviderName="PT-SP" Version="2.0"> - <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> - <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> - <ds:SignatureValue> - S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR - Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC - Xt8p8tK3EoMocZse2hw= - </ds:SignatureValue> - <ds:KeyInfo> - <ds:X509Data> - <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw - OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA - A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl - lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK - ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl - r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w - kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS - 3cyl/wz8</ds:X509Certificate> - </ds:X509Data> - </ds:KeyInfo> - </ds:Signature> - <saml2p:Extensions> - <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> - <storkp:eIDSectorShare>false</storkp:eIDSectorShare> - <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> - <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> - <storkp:RequestedAttributes> - <stork:RequestedAttribute - Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true" /> - </storkp:RequestedAttributes> - </saml2p:Extensions> + xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" + xmlns:stork="urn:eu:stork:names:tc:STORK:1.0:stork" xmlns:storkp="urn:eu:stork:names:tc:STORK:1.0:protocol" + AssertionConsumerServiceURL="http://localhost:8080/SP/ReturnPage" + Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified" Destination="http://localhost:8080/PEPS/ServiceProvider" + ForceAuthn="true" ID="_0c64ff85-1323-4618-847b-12d1983b86e4" IsPassive="false" + IssueInstant="2010-04-07T16:45:03.593Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" + ProviderName="PT-SP" Version="2.0"> + <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://S-PEPS.gov.xx</saml2:Issuer> + <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> + <ds:SignatureValue> + S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR + Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC + Xt8p8tK3EoMocZse2hw= + </ds:SignatureValue> + <ds:KeyInfo> + <ds:X509Data> + <ds:X509Certificate>MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw + OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA + A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl + lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK + ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl + r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w + kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS + 3cyl/wz8</ds:X509Certificate> + </ds:X509Data> + </ds:KeyInfo> + </ds:Signature> + <saml2p:Extensions> + <stork:QualityAuthenticationAssuranceLevel>3</stork:QualityAuthenticationAssuranceLevel> + <storkp:eIDSectorShare>false</storkp:eIDSectorShare> + <storkp:eIDCrossSectorShare>false</storkp:eIDCrossSectorShare> + <storkp:eIDCrossBorderShare>false</storkp:eIDCrossBorderShare> + <storkp:RequestedAttributes> + <stork:RequestedAttribute + Name="http://www.stork.gov.eu/1.0/nationalityCode" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/dateOfBirth" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + <stork:RequestedAttribute Name="http://www.stork.gov.eu/1.0/givenName" + NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" + isRequired="true" /> + </storkp:RequestedAttributes> + </saml2p:Extensions> </saml2p:AuthnRequest>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/logback-test.xml b/id/server/stork2-saml-engine/src/test/resources/logback-test.xml index 99d7d353a..84d48c00e 100644 --- a/id/server/stork2-saml-engine/src/test/resources/logback-test.xml +++ b/id/server/stork2-saml-engine/src/test/resources/logback-test.xml @@ -2,20 +2,20 @@ <!-- Basic configuration used until the IdP can load the real configuration --> <configuration> - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <layout class="ch.qos.logback.classic.PatternLayout"> - <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - </Pattern> - </layout> - </appender> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <layout class="ch.qos.logback.classic.PatternLayout"> + <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + </Pattern> + </layout> + </appender> - <logger name="eu.stork"> - <level value="DEBUG" /> - </logger> + <logger name="eu.stork"> + <level value="DEBUG" /> + </logger> - <root> - <appender-ref ref="STDOUT" /> - <level value="INFO" /> - </root> + <root> + <appender-ref ref="STDOUT" /> + <level value="INFO" /> + </root> </configuration>
\ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg b/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg index bd9f357ce..84f7050d1 100644 --- a/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg +++ b/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg @@ -1,21 +1,15 @@ -//ATTRIBUTE VALUE -//name name suffix of this provider instance -//library pathname of PKCS#11 implementation -//slotListIndex slot index - -//PREFIX DESCRIPTION -//CKO_ Object class -//CKA_ Attribute -//CKK_ Key type - -//attributes(operation, keytype, keyalgorithm) = { -// name1 = value1 -// [...] -//} - -name=nameProvider -library=library.dll -slotListIndex=0 +name=OpenDNSSEC +library = /usr/lib/softhsm/libsofthsm.so +slot = 0 +attributes(generate, *, *) = { + CKA_TOKEN = true +} +attributes(generate, CKO_CERTIFICATE, *) = { + CKA_PRIVATE = false +} +attributes(generate, CKO_PUBLIC_KEY, *) = { + CKA_PRIVATE = false +} attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={ CKA_VERIFY=true } |