aboutsummaryrefslogtreecommitdiff
path: root/id/server/stork2-saml-engine/src/test
diff options
context:
space:
mode:
authorFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-01-16 08:55:06 +0100
committerFlorian Reimair <florian.reimair@iaik.tugraz.at>2014-01-27 16:37:40 +0100
commit6c7a6f8e222e4fb39a11c220b63e785f2037d428 (patch)
tree2628e16ffc7296a2d6a8a3e9c2200dbc9f1536bd /id/server/stork2-saml-engine/src/test
parent8276884b9c45315df5fa951ce53b3d35f4983b22 (diff)
downloadmoa-id-spss-6c7a6f8e222e4fb39a11c220b63e785f2037d428.tar.gz
moa-id-spss-6c7a6f8e222e4fb39a11c220b63e785f2037d428.tar.bz2
moa-id-spss-6c7a6f8e222e4fb39a11c220b63e785f2037d428.zip
fix added real source of stork modules
Diffstat (limited to 'id/server/stork2-saml-engine/src/test')
-rw-r--r--id/server/stork2-saml-engine/src/test/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/.svn/entries34
-rw-r--r--id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/java/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF3
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops47
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries266
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base173
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base62
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base790
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base920
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base966
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base931
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base20
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java173
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java62
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java790
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java920
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java966
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java931
-rw-r--r--id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java20
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops101
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/entries575
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base63
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base11
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base91
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base91
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base64
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base61
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-basebin0 -> 1376 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-basebin0 -> 1313 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-basebin0 -> 1313 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-basebin0 -> 1313 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base23
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base24
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml81
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml11
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml12
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml91
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml91
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml64
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml61
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml91
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops5
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries31
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops41
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries232
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base11
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base15
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base10
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base26
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml11
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml15
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml10
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml26
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml14
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jksbin0 -> 1376 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jksbin0 -> 1313 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jksbin0 -> 1313 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jksbin0 -> 1313 bytes
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/logback-test.xml23
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg24
-rw-r--r--id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jksbin0 -> 4592 bytes
90 files changed, 10589 insertions, 0 deletions
diff --git a/id/server/stork2-saml-engine/src/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/.svn/all-wcprops
new file mode 100644
index 000000000..ead80d4e8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test
+END
diff --git a/id/server/stork2-saml-engine/src/test/.svn/entries b/id/server/stork2-saml-engine/src/test/.svn/entries
new file mode 100644
index 000000000..1b6d0b3e1
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/.svn/entries
@@ -0,0 +1,34 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+resources
+dir
+
+java
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops
new file mode 100644
index 000000000..56c8ee113
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java
+END
diff --git a/id/server/stork2-saml-engine/src/test/java/.svn/entries b/id/server/stork2-saml-engine/src/test/java/.svn/entries
new file mode 100644
index 000000000..ca124ed28
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+eu
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF b/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..5e9495128
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops
new file mode 100644
index 000000000..e00b13d5a
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu
+END
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries
new file mode 100644
index 000000000..cc3e19816
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+stork
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops
new file mode 100644
index 000000000..ac0852630
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork
+END
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries
new file mode 100644
index 000000000..66d2ea82a
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+peps
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops
new file mode 100644
index 000000000..5555d11e2
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps
+END
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries
new file mode 100644
index 000000000..e20bc1c1d
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+test
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops
new file mode 100644
index 000000000..ee98ec5bd
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test
+END
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries
new file mode 100644
index 000000000..a7074362f
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+simple
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops
new file mode 100644
index 000000000..063e2de18
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops
@@ -0,0 +1,47 @@
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple
+END
+StorkResponseTest.java
+K 25
+svn:wc:ra_dav:version-url
+V 111
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java
+END
+StorkAttrQueryResponseTest.java
+K 25
+svn:wc:ra_dav:version-url
+V 119
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java
+END
+SimpleBaseTest.java
+K 25
+svn:wc:ra_dav:version-url
+V 107
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java
+END
+package-info.java
+K 25
+svn:wc:ra_dav:version-url
+V 105
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/package-info.java
+END
+SSETestUtils.java
+K 25
+svn:wc:ra_dav:version-url
+V 105
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java
+END
+StorkAttrQueryRequestTest.java
+K 25
+svn:wc:ra_dav:version-url
+V 119
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java
+END
+StorkAuthRequestTest.java
+K 25
+svn:wc:ra_dav:version-url
+V 114
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java
+END
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries
new file mode 100644
index 000000000..0fbc1b254
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries
@@ -0,0 +1,266 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/java/eu/stork/peps/test/simple
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+SSETestUtils.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+f9c51e04914afb9a99d52e642c8a6a42
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+5521
+
+StorkAttrQueryRequestTest.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+66e336a173f22c2ba55b933157c703c8
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+25393
+
+StorkAuthRequestTest.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+c1e89785bc4af791adb9760fd42b7d56
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+31301
+
+StorkResponseTest.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+016c270fa1231e25cc1ccf67d0ebf6cf
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+39179
+
+StorkAttrQueryResponseTest.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+44021c766949a57b10b61cd466a57b55
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+39559
+
+SimpleBaseTest.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+6effea1d03de1bd17fd8d07d3778df58
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1871
+
+package-info.java
+file
+
+
+
+
+2013-12-20T12:27:57.274475Z
+3cd87d2f80f4a5a4f42ab5bc844dd2f3
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+811
+
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base
new file mode 100644
index 000000000..b1443bb0e
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base
@@ -0,0 +1,173 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.commons.io.IOUtils;
+import org.bouncycastle.util.encoders.Base64;
+import org.opensaml.Configuration;
+import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.io.Marshaller;
+import org.opensaml.xml.io.MarshallerFactory;
+import org.opensaml.xml.io.MarshallingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * The Class SSETestUtils.
+ */
+public final class SSETestUtils {
+
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SSETestUtils.class.getName());
+
+ /**
+ * Instantiates a new sSE test utils.
+ */
+ private SSETestUtils() {
+ }
+
+ /**
+ * Prints the tree DOM.
+ *
+ * @param samlToken the SAML token
+ * @param isIndent the is indent
+ *
+ * @return the string
+ * @throws TransformerException the exception
+ */
+ public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException {
+ // set up a transformer
+ final TransformerFactory transfac = TransformerFactory.newInstance();
+ final Transformer trans = transfac.newTransformer();
+ trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent));
+
+ // create string from XML tree
+ final StringWriter stringWriter = new StringWriter();
+ final StreamResult result = new StreamResult(stringWriter);
+ final DOMSource source = new DOMSource(samlToken);
+ trans.transform(source, result);
+ final String xmlString = stringWriter.toString();
+
+ return xmlString;
+ }
+
+ /**
+ * Marshall.
+ *
+ * @param samlToken the SAML token
+ *
+ * @return the byte[]
+ *
+ * @throws MarshallingException the marshalling exception
+ * @throws ParserConfigurationException the parser configuration exception
+ * @throws TransformerException the transformer exception
+ */
+ public static byte[] marshall(final XMLObject samlToken)
+ throws MarshallingException, ParserConfigurationException,
+ TransformerException {
+
+ final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory
+ .newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ dbf.setNamespaceAware(true);
+ dbf.setIgnoringComments(true);
+ final javax.xml.parsers.DocumentBuilder docBuild = dbf
+ .newDocumentBuilder();
+
+ // Get the marshaller factory
+ final MarshallerFactory marshallerFactory = Configuration
+ .getMarshallerFactory();
+
+ // Get the Subject marshaller
+ final Marshaller marshaller = marshallerFactory
+ .getMarshaller(samlToken);
+
+ final Document doc = docBuild.newDocument();
+
+ // Marshall the SAML token
+ marshaller.marshall(samlToken, doc);
+
+ // Obtain a byte array representation of the marshalled SAML object
+ final DOMSource domSource = new DOMSource(doc);
+ final StringWriter writer = new StringWriter();
+ final StreamResult result = new StreamResult(writer);
+ final TransformerFactory transFact = TransformerFactory.newInstance();
+ final Transformer transformer = transFact.newTransformer();
+ transformer.transform(domSource, result);
+
+ return writer.toString().getBytes();
+ }
+
+ /**
+ * Encode SAML token.
+ *
+ * @param samlToken the SAML token
+ *
+ * @return the string
+ */
+ public static String encodeSAMLToken(final byte[] samlToken) {
+ return new String(Base64.encode(samlToken));
+ }
+
+ /**
+ * Read stork SAML from file.
+ *
+ * @param resource the resource
+ *
+ * @return the byte[]
+ * @throws IOException the exception
+ *
+ */
+ public static byte[] readStorkSamlFromFile(final String resource)
+ throws IOException {
+ InputStream inputStream = null;
+ byte[] bytes;
+
+ try {
+ inputStream = StorkAuthRequestTest.class
+ .getResourceAsStream(resource);
+
+ // Create the byte array to hold the data
+ bytes = new byte[(int) inputStream.available()];
+ inputStream.read(bytes);
+ } catch (IOException e) {
+ LOG.error("Error read from file: " + resource);
+ throw e;
+ } finally {
+ IOUtils.closeQuietly(inputStream);
+ }
+ return bytes;
+
+ }
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base
new file mode 100644
index 000000000..97fa4b7cc
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import org.junit.Test;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+
+/**
+ * The Class SimpleBaseTest. Defines a set of test the initialization of the
+ * SAML engine.
+ */
+public class SimpleBaseTest extends TestCase {
+
+ /**
+ * Test SAML engine correct configuration name.
+ */
+ @Test
+ public final void testSamlEngineCorrectInit() {
+ Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1"));
+ }
+
+ /**
+ * Test SAML engine error configuration name.
+ */
+ @Test
+ public final void testSamlEngineErrorNameConf() {
+ Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR"));
+ }
+
+ /**
+ * Test SAML engine error name null.
+ */
+ @Test
+ public final void testSamlEngineErrorNameNull() {
+ Assert.assertNull(STORKSAMLEngine.getInstance(null));
+ }
+
+ /**
+ * Test SAML engine correct name configuration with spaces.
+ */
+ @Test
+ public final void testSamlEngineErrorNameSpaces() {
+ Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 "));
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base
new file mode 100644
index 000000000..7fa305d3b
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base
@@ -0,0 +1,790 @@
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.STORKAttrQueryRequest;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+public class StorkAttrQueryRequestTest {
+
+ /** The engines. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+ private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0");
+ private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2");
+ private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3");
+
+
+ /**
+ * Instantiates a new stork authentication request test.
+ */
+ public StorkAttrQueryRequestTest() {
+ pal = new PersonalAttributeList();
+
+ final PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ final ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ final PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ final PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ eIDNumber.setValue(Arrays.asList("ES/IS/1234567890"));
+ pal.add(eIDNumber);
+
+ final PersonalAttribute givenName = new PersonalAttribute();
+ givenName.setName("givenName");
+ givenName.setIsRequired(true);
+ givenName.setValue(Arrays.asList("Sveinbjorn"));
+ pal.add(givenName);
+
+ destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest";
+ //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+
+ }
+
+ /** The destination. */
+ private String destination;
+
+ /** The service provider sector. */
+ private String spSector;
+
+ /** The service provider institution. */
+ private String spInstitution;
+
+ /** The service provider application. */
+ private String spApplication;
+
+ /** The service provider country. */
+ private String spCountry;
+
+ /** The service provider id. */
+ private String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The List of Personal Attributes. */
+ private IPersonalAttributeList pal;
+
+ /** The attribute query request. */
+ private static byte[] attrRequest;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkAttrQueryRequestTest.class.getName());
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+ }
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // new parameters
+ request.setEIDSectorShare(false);
+ request.setEIDCrossSectorShare(false);
+ request.setEIDCrossBorderShare(false);
+
+ STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request);
+ byte[] reqByte = req1.getTokenSaml();
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"));
+ output.write(reqByte);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new STORKSAMLEngineException(e);
+ } finally {
+ try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); }
+ }
+
+
+
+
+ LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
+
+ request.setCitizenCountryCode("IS");
+ LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
+ }
+
+ /**
+ * Test generate authentication request error personal attribute name error.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestPALsErr1() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("attrNotValid");
+ worngAttr.setIsRequired(true);
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+
+ // news parameters
+ request.setEIDSectorShare(false);
+ request.setEIDCrossSectorShare(false);
+ request.setEIDCrossBorderShare(false);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+ /**
+ * Test generate authentication request error personal attribute value error.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestPALsErr2() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute attrNotValid = new PersonalAttribute();
+ attrNotValid.setName("attrNotValid");
+ attrNotValid.setIsRequired(true);
+ palWrong.add(attrNotValid);
+
+
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request authentication assurance level
+ * negative value.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestQaalErr1() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(-1);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider sector null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestSectorErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider institution null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestInstitutionrErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(null);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestApplicationErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(null);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider country null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestCountryErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(null);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request error with quality authentication
+ * assurance level wrong.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestQaalErr2() {
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(0);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request personal attribute list null value.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestPALErr1() {
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(null);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request null parameter.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestNullParam()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAttrQueryRequest(null);
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request error bytes encode.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestErrorEncode()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAttrQueryRequest("messageError".getBytes());
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml();
+
+ final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest);
+
+ assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
+
+ }
+
+ /**
+ * Test validate data authenticate request. Verified parameters after
+ * validation.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest);
+
+ assertEquals("Sestination incorrect: ", request.getDestination(), destination);
+
+ assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false);
+
+ assertEquals("QAAL incorrect: ", request.getQaa(), QAAL);
+ assertEquals("SPSector incorrect: ", request.getSpSector(), spSector);
+ assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null);
+ assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication);
+ assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null);
+
+ }
+
+ /**
+ * Test validate file attribute query request. Validate from XML file.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAttrQueryRequest() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml");
+
+ try {
+ engine.validateSTORKAttrQueryRequest(bytes);
+ fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate file authentication request tag delete.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAttrRequestTagDelete() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml");
+
+ try {
+ engine.validateSTORKAttrQueryRequest(bytes);
+ fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+
+ }
+ }
+
+ /**
+ * Test validate authentication request not trusted token.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestNotTrustedErr1()
+ throws STORKSAMLEngineException {
+
+ try {
+ final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine
+ .getInstance("CONF2");
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineNotTrusted
+ .generateSTORKAttrQueryRequest(request).getTokenSaml();
+
+ engine.validateSTORKAttrQueryRequest(authReqNotTrust);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test validate authentication request trusted.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestTrusted()
+ throws STORKSAMLEngineException {
+
+ final STORKSAMLEngine engineTrusted = STORKSAMLEngine
+ .getInstance("CONF3");
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest(
+ request).getTokenSaml();
+
+ // engine ("CONF1") no have trust certificate from "CONF2"
+ engine.validateSTORKAttrQueryRequest(authReqNotTrust);
+
+ }
+
+
+
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestNADA() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(null);
+ request.setSpApplication(null);
+ request.setSpCountry(null);
+
+ try {
+
+ engine.validateSTORKAttrQueryRequest(attrRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test validate authentication request with unknown elements.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute unknown = new PersonalAttribute();
+ unknown.setName("unknown");
+ unknown.setIsRequired(true);
+ pAttList.add(unknown);
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+
+ req = engine3.generateSTORKAttrQueryRequest(request);
+
+ req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
+
+ assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown"));
+ assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier"));
+
+ }
+
+ /**
+ * Test generate Request with required elements by default
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+ STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest();
+ STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest();
+
+ reqTrue = engine.generateSTORKAttrQueryRequest(request);
+ reqFalse = engine2.generateSTORKAttrQueryRequest(request);
+ req = engine3.generateSTORKAttrQueryRequest(request);
+
+
+ String token = new String(req.getTokenSaml());
+ String reqTrueToken = new String(reqTrue.getTokenSaml());
+ String reqFalseToken = new String(reqFalse.getTokenSaml());
+
+ assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired"));
+ assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired"));
+ assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired"));
+
+ }
+
+ /**
+ * Test validating attribute query and getting alias used to save
+ * the saml trusted certificate into trustore
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+
+ req = engine3.generateSTORKAttrQueryRequest(request);
+ req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+
+ req = engine2.generateSTORKAttrQueryRequest(request);
+ req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base
new file mode 100644
index 000000000..27c6cfe39
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base
@@ -0,0 +1,920 @@
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PEPSUtil;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.auth.commons.STORKAttrQueryRequest;
+import eu.stork.peps.auth.commons.STORKAttrQueryResponse;
+import eu.stork.peps.auth.commons.STORKAuthnRequest;
+import eu.stork.peps.auth.commons.STORKAuthnResponse;
+import eu.stork.peps.auth.commons.STORKStatusCode;
+import eu.stork.peps.auth.commons.STORKSubStatusCode;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+public class StorkAttrQueryResponseTest {
+
+ /** The engine. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+
+ /**
+ * Gets the engine.
+ *
+ * @return the engine
+ */
+ public static STORKSAMLEngine getEngine() {
+ return engine;
+ }
+
+ /**
+ * Sets the engine.
+ *
+ * @param newEngine the new engine
+ */
+ public static void setEngine(final STORKSAMLEngine newEngine) {
+ StorkAttrQueryResponseTest.engine = newEngine;
+ }
+
+ /** The destination. */
+ private static String destination;
+
+ /** The service provider sector. */
+ private static String spSector;
+
+ /** The service provider institution. */
+ private static String spInstitution;
+
+ /** The service provider application. */
+ private static String spApplication;
+
+ /** The service provider country. */
+ private static String spCountry;
+
+ /** The service provider id. */
+ private static String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The state. */
+ private static String state = "IS";
+
+ /** The town. */
+ private static String town = "Reykjavik";
+
+ /** The postal code. */
+ private static String postalCode = "105";
+
+ /** The street name. */
+ private static String streetName = "Gudrunartun";
+
+ /** The street number. */
+ private static String streetNumber = "10";
+
+ /** The List of Personal Attributes. */
+ private static IPersonalAttributeList pal;
+
+ /** The assertion consumer URL. */
+ private static String assertConsumerUrl;
+
+ /** The attribute query request. */
+ private static byte[] attrQueryRequest;
+
+ /** The attribute query response. */
+ private static byte[] attrQueryResponse;
+
+ /** The attribute query request. */
+ private static STORKAttrQueryRequest attrQueryenRequest;
+
+ /** The attribute query response. */
+ private static STORKAttrQueryResponse attrQeuryenResponse;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkAttrQueryResponseTest.class.getName());
+
+ /**
+ * Instantiates a new stork response test.
+ */
+ public StorkAttrQueryResponseTest() {
+ super();
+ }
+
+ /** The IP address. */
+ private static String ipAddress;
+
+ /** The destination URL. */
+ private static String destinationUrl;
+
+ /** The is hashing. */
+ private final boolean isHashing = Boolean.TRUE;
+
+ /** The is not hashing. */
+ private final boolean isNotHashing = Boolean.FALSE;
+
+ /** The ERROR text. */
+ private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!";
+
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+
+ pal = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ final PersonalAttribute givenName = new PersonalAttribute();
+ givenName.setName("givenName");
+ givenName.setIsRequired(true);
+ pal.add(givenName);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ pal.add(canRessAddress);
+
+ PersonalAttribute newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ pal.add(newAttribute);
+
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "EN";
+
+ spId = "EDU001-APP001-APP001";
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+ request.setDestination(destination);
+ //request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ //request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request)
+ .getTokenSaml();
+
+ attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ fail("Error create STORKAuthnRequest");
+ }
+
+ ipAddress = "111.222.333.444";
+
+ destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+
+ pal = new PersonalAttributeList();
+
+ isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ages = new ArrayList<String>();
+
+ ages.add("16");
+ ages.add("18");
+
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(isAgeOver);
+
+ dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(dateOfBirth);
+
+ eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789IS");
+ eIDNumber.setValue(idNumber);
+ eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(eIDNumber);
+
+ canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+
+ canRessAddress.setComplexValue(address);
+ pal.add(canRessAddress);
+
+ newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> values = new HashMap<String, String>();
+
+ values.put("value1", "value1");
+ values.put("value2", "value2");
+ values.put("value3", "value3");
+ values.put("value4", "value4");
+
+ newAttribute.setComplexValue(values);
+ pal.add(newAttribute);
+
+ }
+
+ /**
+ * Test generate attribute query request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ final STORKAttrQueryResponse storkResponse = getEngine()
+ .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
+ destinationUrl, isNotHashing);
+
+ attrQueryResponse = storkResponse.getTokenSaml();
+
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml"));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(attrQueryResponse);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse));
+
+
+ }
+
+ /**
+ * Test validation id parameter mandatory.
+ */
+ @Test
+ public final void testResponseMandatoryId() {
+ final String identifier = attrQueryenRequest.getSamlId();
+ attrQueryenRequest.setSamlId(null);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, destinationUrl, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response in response to err1.
+ */
+ @Test
+ public final void testResponseMandatoryIssuer() {
+
+ final String issuer = attrQueryenRequest.getIssuer();
+ attrQueryenRequest.setIssuer(null);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, destinationUrl, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setIssuer(issuer);
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test generate attribute query response assertion consumer null.
+ */
+ /*@Test
+ public final void testResponseMandatoryAssertionConsumerServiceURL() {
+ final String asserConsumerUrl = attrQueryenRequest
+ .getAssertionConsumerServiceURL();
+ attrQueryenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response IP address null.
+ */
+ @Test
+ public final void testResponseValidationIP() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null,
+ destinationUrl, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response with personal attribute list null.
+ */
+ @Test
+ public final void testResponseMandatoryPersonalAttributeList() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(null);
+
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, destinationUrl, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate attribute query response token null.
+ */
+ @Test
+ public final void testResponseInvalidParametersToken() {
+ try {
+ getEngine().validateSTORKAttrQueryResponse(null, ipAddress);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate attribute query response IP null.
+ */
+ @Test
+ public final void STORKAttrQueryResponse() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response parameter name wrong.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttr() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("AttrWrong");
+ wrongList.add(worngAttr);
+
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrSimpleValue() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoValue() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoName() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null complex value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrComplexValue() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setComplexValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test validate attribute query response IP distinct and disabled validation
+ * IP.
+ */
+ @Test
+ public final void testResponseInvalidParametersIPDistinct() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // ipAddrValidation = false
+ // Subject Confirmation Bearer.
+
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1");
+ } catch (STORKSAMLEngineException e) {
+ fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!");
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test response invalid parameters invalid token.
+ */
+ @Test
+ public final void testResponseInvalidParametersTokenMsg() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // Subject Confirmation Bearer.
+ getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(),
+ ipAddress);
+ fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate attribute query response is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ /*@Test
+ public final void testValidateAuthenticationResponseIsFail()
+ throws STORKSAMLEngineException {
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail());
+ }
+
+ /**
+ * Test validate attribute query response destination.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseDestination()
+ throws STORKSAMLEngineException {
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertEquals("Destination incorrect: ",
+ attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId());
+ }
+
+ /**
+ * Test validate attribute query response values.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseValuesComplex()
+ throws STORKSAMLEngineException {
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES");
+
+ final Iterator<PersonalAttribute> iterator = attrQeuryenResponse
+ .getPersonalAttributeList().iterator();
+
+ while (iterator.hasNext()) {
+ final PersonalAttribute attribute = iterator.next();
+ if (attribute.getName().equalsIgnoreCase(
+ "canonicalResidenceAddress")) {
+ assertEquals("State incorrect: ", state, attribute
+ .getComplexValue().get("state"));
+ assertEquals("Town incorrect: ", town, attribute
+ .getComplexValue().get("town"));
+ assertEquals("Postal code incorrect: ", postalCode, attribute
+ .getComplexValue().get("postalCode"));
+ assertEquals("Street name incorrect: ", streetName, attribute
+ .getComplexValue().get("streetName"));
+ assertEquals("Street number incorrect: ", streetNumber,
+ attribute.getComplexValue().get("streetNumber"));
+ }
+ }
+ }
+
+ /**
+ * Test generate attribute query response fail in response to it's null.
+ * @throws STORKSAMLEngineException
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test //( expected=STORKSAMLEngineException.class)
+ public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException {
+ final String identifier = attrQueryenRequest.getSamlId();
+ attrQueryenRequest.setSamlId(null);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ //throw new STORKSAMLEngineException(e);
+ }
+ }
+
+ /**
+ * Test generate attribute query response fail assertion consumer URL err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ /*@Test
+ public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull()
+ throws STORKSAMLEngineException {
+
+ final String assertConsumerUrl = attrQueryenRequest
+ .getAssertionConsumerServiceURL();
+ attrQueryenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response fail code error err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryResponseFailCodeErrorNull()
+ throws STORKSAMLEngineException {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setStatusCode(null);
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test generate attribute query request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException {
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(dateOfBirth);
+
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+
+ final HashMap<String, String> complex = new HashMap<String, String>();
+ complex.put("one", "two");
+
+ //eIDNumber.setValue(null);
+ //eIDNumber.setValue(idNumber);
+ //eIDNumber.setComplexValue(complex);
+
+ eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString());
+ palist.add(eIDNumber);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+
+ canRessAddress.setComplexValue(address);
+ palist.add(canRessAddress);
+
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAttrQueryResponse storkResponse = getEngine()
+ .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
+ destinationUrl, isNotHashing);
+
+ attrQueryResponse = storkResponse.getTokenSaml();
+ LOG.info("Request id: " + attrQueryenRequest.getSamlId());
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse));
+
+
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId());
+ LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo());
+ LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry());
+
+ }
+
+
+
+
+
+ /**
+ * Test validate attribute query response fail is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryResponseFailIsFail()
+ throws STORKSAMLEngineException {
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("message");
+
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+
+ LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse));
+
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry());
+ assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail());
+ }
+
+ /**
+ * Test generate/validate response with signedDoc
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryResponseWithSignedDoc()
+ throws STORKSAMLEngineException {
+
+ String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0ia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pTaWduYXR1cmU+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute signedDoc = new PersonalAttribute();
+ signedDoc.setName("signedDoc");
+ signedDoc.setIsRequired(false);
+ ArrayList<String> signed = new ArrayList<String>();
+ signed.add(signedDocResponse);
+ signedDoc.setValue(signed);
+ palist.add(signedDoc);
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ palist.add(isAgeOver);
+
+ attrQueryenRequest.setPersonalAttributeList(palist);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAttrQueryResponse storkResponse = getEngine()
+ .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
+ destinationUrl, isNotHashing);
+
+ attrQueryResponse = storkResponse.getTokenSaml();
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse
+ .getPersonalAttributeList().get("signedDoc").getValue().get(0)
+ .equals(signedDocResponse));
+
+ }
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base
new file mode 100644
index 000000000..7223ab483
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base
@@ -0,0 +1,966 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.STORKAuthnRequest;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+/**
+ * The Class StorkAuthRequestTest defines a class to .
+ */
+public class StorkAuthRequestTest {
+
+ /** The engines. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+ private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2");
+ private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3");
+
+
+ /**
+ * Instantiates a new stork authentication request test.
+ */
+ public StorkAuthRequestTest() {
+ pal = new PersonalAttributeList();
+
+ final PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ final ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ final PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ final PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+
+ spName = "University of Oxford";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "EN";
+
+ spId = "EDU001-OXF001-APP001";
+
+ }
+
+ /** The destination. */
+ private String destination;
+
+ /** The service provider name. */
+ private String spName;
+
+ /** The service provider sector. */
+ private String spSector;
+
+ /** The service provider institution. */
+ private String spInstitution;
+
+ /** The service provider application. */
+ private String spApplication;
+
+ /** The service provider country. */
+ private String spCountry;
+
+ /** The service provider id. */
+ private String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The List of Personal Attributes. */
+ private IPersonalAttributeList pal;
+
+ /** The assertion consumer URL. */
+ private String assertConsumerUrl;
+
+ /** The authentication request. */
+ private static byte[] authRequest;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkAuthRequestTest.class.getName());
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+ }
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnRequest() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ //engine.generateSTORKAuthnRequest(request);
+
+ LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml()));
+ request.setCitizenCountryCode("ES");
+ LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml()));
+ }
+
+
+ /**
+ * Test generate authentication request error personal attribute name error.
+ */
+ @Test
+ public final void testGenerateAuthnRequestPALsErr1() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("attrNotValid");
+ worngAttr.setIsRequired(true);
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+ /**
+ * Test generate authentication request error personal attribute value error.
+ */
+ @Test
+ public final void testGenerateAuthnRequestPALsErr2() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute attrNotValid = new PersonalAttribute();
+ attrNotValid.setName("attrNotValid");
+ attrNotValid.setIsRequired(true);
+ palWrong.add(attrNotValid);
+
+
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request error provider name null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestSPNAmeErr1() {
+
+
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(null);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try
+ {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ catch (STORKSAMLEngineException e)
+ {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request authentication assurance level
+ * negative value.
+ */
+ @Test
+ public final void testGenerateAuthnRequestQaalErr1() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(-1);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider sector null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestSectorErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider institution null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestInstitutionrErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(null);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestApplicationErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(null);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider country null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestCountryErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(null);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request error with quality authentication
+ * assurance level wrong.
+ */
+ @Test
+ public final void testGenerateAuthnRequestQaalErr2() {
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(0);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request personal attribute list null value.
+ */
+ @Test
+ public final void testGenerateAuthnRequestPALErr1() {
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(null);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request error with assertion consumer URL
+ * null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestAssertionConsumerErr1() {
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(null);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request null parameter.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestNullParam()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAuthnRequest(null);
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request error bytes encode.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestErrorEncode()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAuthnRequest("messageError".getBytes());
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequest() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml();
+
+ final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest);
+
+ assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
+
+ }
+
+ /**
+ * Test validate data authenticate request. Verified parameters after
+ * validation.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest);
+
+ assertEquals("Sestination incorrect: ", request.getDestination(), destination);
+
+ assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false);
+
+ assertEquals("Service provider incorrect: ", request.getProviderName(), spName);
+ assertEquals("QAAL incorrect: ", request.getQaa(), QAAL);
+ assertEquals("SPSector incorrect: ", request.getSpSector(), spSector);
+ assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null);
+ assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication);
+ assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl);
+
+ assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry);
+ assertEquals("SP Id incorrect: ", request.getSPID(), spId);
+ assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES");
+
+ }
+
+ /**
+ * Test validate file authentication request. Validate from XML file.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAuthnRequest() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml");
+
+ try {
+ engine.validateSTORKAuthnRequest(bytes);
+ fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate file authentication request tag delete.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAuthnRequestTagDelete() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml");
+
+ try {
+ engine.validateSTORKAuthnRequest(bytes);
+ fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+
+ }
+ }
+
+ /**
+ * Test validate authentication request not trusted token.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestNotTrustedErr1()
+ throws STORKSAMLEngineException {
+
+ try {
+ final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine
+ .getInstance("CONF2");
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineNotTrusted
+ .generateSTORKAuthnRequest(request).getTokenSaml();
+
+ engine.validateSTORKAuthnRequest(authReqNotTrust);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test validate authentication request trusted.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestTrusted()
+ throws STORKSAMLEngineException {
+
+ final STORKSAMLEngine engineTrusted = STORKSAMLEngine
+ .getInstance("CONF3");
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest(
+ request).getTokenSaml();
+
+ // engine ("CONF1") no have trust certificate from "CONF2"
+ engine.validateSTORKAuthnRequest(authReqNotTrust);
+
+ }
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestNADA() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(null);
+ request.setSpApplication(null);
+ request.setSpCountry(null);
+
+ try {
+ engine.validateSTORKAuthnRequest(authRequest);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate authentication request with unknown elements.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute unknown = new PersonalAttribute();
+ unknown.setName("unknown");
+ unknown.setIsRequired(true);
+ pAttList.add(unknown);
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+
+ req = engine3.generateSTORKAuthnRequest(request);
+
+ req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
+
+ assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown"));
+ assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier"));
+
+ }
+
+ /**
+ * Test generate Request with required elements by default
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+ STORKAuthnRequest reqTrue = new STORKAuthnRequest();
+ STORKAuthnRequest reqFalse = new STORKAuthnRequest();
+
+ reqTrue = engine.generateSTORKAuthnRequest(request);
+ reqFalse = engine2.generateSTORKAuthnRequest(request);
+ req = engine3.generateSTORKAuthnRequest(request);
+
+
+ String token = new String(req.getTokenSaml());
+ String reqTrueToken = new String(reqTrue.getTokenSaml());
+ String reqFalseToken = new String(reqFalse.getTokenSaml());
+
+ assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired"));
+ assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired"));
+ assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired"));
+
+ }
+
+ /**
+ * Test validating request and getting alias used to save
+ * the saml trusted certificate into trustore
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+
+ req = engine3.generateSTORKAuthnRequest(request);
+ req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+
+ req = engine2.generateSTORKAuthnRequest(request);
+ req = engine2.validateSTORKAuthnRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+
+
+
+ }
+
+ /**
+ * Test generating/validating request with signedDoc
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnRequestWithSignedDoc()
+ throws STORKSAMLEngineException {
+
+ String signedDocRequest = "<dss:SignRequest xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"_d96b62a87d18f1095170c1f44c90b5fd\"><dss:InputDocuments><dss:Document><dss:Base64Data MimeType=\"text/plain\">VGVzdCB0ZXh0</dss:Base64Data></dss:Document></dss:InputDocuments></dss:SignRequest>";
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ PersonalAttributeList paler = new PersonalAttributeList();
+
+ final PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ paler.add(eIDNumber);
+
+ final PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ final ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ paler.add(isAgeOver);
+
+ final PersonalAttribute signedDoc = new PersonalAttribute();
+ signedDoc.setName("signedDoc");
+ final ArrayList<String> signedDocs = new ArrayList<String>();
+ signedDocs.add(signedDocRequest);
+ signedDoc.setValue(signedDocs);
+ signedDoc.setIsRequired(false);
+ paler.add(signedDoc);
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(paler);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+
+ req = engine.generateSTORKAuthnRequest(request);
+ req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
+
+ assertTrue("SignedDoc request should be the same: ", req
+ .getPersonalAttributeList().get("signedDoc").getValue().get(0)
+ .equals(signedDocRequest));
+
+
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base
new file mode 100644
index 000000000..481cbc28c
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base
@@ -0,0 +1,931 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PEPSUtil;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.auth.commons.STORKAuthnRequest;
+import eu.stork.peps.auth.commons.STORKAuthnResponse;
+import eu.stork.peps.auth.commons.STORKStatusCode;
+import eu.stork.peps.auth.commons.STORKSubStatusCode;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+/**
+ * The Class AuthRequestTest.
+ */
+public class StorkResponseTest {
+
+ /** The engine. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+
+ /**
+ * Gets the engine.
+ *
+ * @return the engine
+ */
+ public static STORKSAMLEngine getEngine() {
+ return engine;
+ }
+
+ /**
+ * Sets the engine.
+ *
+ * @param newEngine the new engine
+ */
+ public static void setEngine(final STORKSAMLEngine newEngine) {
+ StorkResponseTest.engine = newEngine;
+ }
+
+ /** The destination. */
+ private static String destination;
+
+ /** The service provider name. */
+ private static String spName;
+
+ /** The service provider sector. */
+ private static String spSector;
+
+ /** The service provider institution. */
+ private static String spInstitution;
+
+ /** The service provider application. */
+ private static String spApplication;
+
+ /** The service provider country. */
+ private static String spCountry;
+
+ /** The service provider id. */
+ private static String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The state. */
+ private static String state = "ES";
+
+ /** The town. */
+ private static String town = "Madrid";
+
+ /** The municipality code. */
+ private static String municipalityCode = "MA001";
+
+ /** The postal code. */
+ private static String postalCode = "28038";
+
+ /** The street name. */
+ private static String streetName = "Marchamalo";
+
+ /** The street number. */
+ private static String streetNumber = "3";
+
+ /** The apartament number. */
+ private static String apartamentNumber = "5º E";
+
+ /** The List of Personal Attributes. */
+ private static IPersonalAttributeList pal;
+
+ /** The assertion consumer URL. */
+ private static String assertConsumerUrl;
+
+ /** The authentication request. */
+ private static byte[] authRequest;
+
+ /** The authentication response. */
+ private static byte[] authResponse;
+
+ /** The authentication request. */
+ private static STORKAuthnRequest authenRequest;
+
+ /** The authentication response. */
+ private static STORKAuthnResponse authnResponse;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkResponseTest.class.getName());
+
+ /**
+ * Instantiates a new stork response test.
+ */
+ public StorkResponseTest() {
+ super();
+ }
+
+ /** The IP address. */
+ private static String ipAddress;
+
+ /** The is hashing. */
+ private final boolean isHashing = Boolean.TRUE;
+
+ /** The is not hashing. */
+ private final boolean isNotHashing = Boolean.FALSE;
+
+ /** The ERROR text. */
+ private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!";
+
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+
+ pal = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ final PersonalAttribute givenName = new PersonalAttribute();
+ givenName.setName("givenName");
+ givenName.setIsRequired(true);
+ pal.add(givenName);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ pal.add(canRessAddress);
+
+ PersonalAttribute newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ pal.add(newAttribute);
+
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+ spName = "University Oxford";
+
+ spName = "University of Oxford";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "EN";
+
+ spId = "EDU001-APP001-APP001";
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ authRequest = getEngine().generateSTORKAuthnRequest(request)
+ .getTokenSaml();
+
+ authenRequest = getEngine().validateSTORKAuthnRequest(authRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ fail("Error create STORKAuthnRequest");
+ }
+
+ ipAddress = "111.222.333.444";
+
+ pal = new PersonalAttributeList();
+
+ isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ages = new ArrayList<String>();
+
+ ages.add("16");
+ ages.add("18");
+
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(isAgeOver);
+
+ dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(dateOfBirth);
+
+ eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+ eIDNumber.setValue(idNumber);
+ eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(eIDNumber);
+
+ canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("municipalityCode", municipalityCode);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+ address.put("apartamentNumber", apartamentNumber);
+
+ canRessAddress.setComplexValue(address);
+ pal.add(canRessAddress);
+
+ newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> values = new HashMap<String, String>();
+
+ values.put("value1", "value1");
+ values.put("value2", "value2");
+ values.put("value3", "value3");
+ values.put("value4", "value4");
+
+ newAttribute.setComplexValue(values);
+ pal.add(newAttribute);
+
+ }
+
+ /**
+ * Test generate authentication request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponse() throws STORKSAMLEngineException {
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ final STORKAuthnResponse storkResponse = getEngine()
+ .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
+ isNotHashing);
+
+ authResponse = storkResponse.getTokenSaml();
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse));
+ }
+
+ /**
+ * Test validation id parameter mandatory.
+ */
+ @Test
+ public final void testResponseMandatoryId() {
+ final String identifier = authenRequest.getSamlId();
+ authenRequest.setSamlId(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response in response to err1.
+ */
+ @Test
+ public final void testResponseMandatoryIssuer() {
+
+ final String issuer = authenRequest.getIssuer();
+ authenRequest.setIssuer(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setIssuer(issuer);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response assertion consumer null.
+ */
+ @Test
+ public final void testResponseMandatoryAssertionConsumerServiceURL() {
+ final String asserConsumerUrl = authenRequest
+ .getAssertionConsumerServiceURL();
+ authenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response IP address null.
+ */
+ @Test
+ public final void testResponseValidationIP() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response, null,
+ isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response with personal attribute list null.
+ */
+ @Test
+ public final void testResponseMandatoryPersonalAttributeList() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(null);
+
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication response token null.
+ */
+ @Test
+ public final void testResponseInvalidParametersToken() {
+ try {
+ getEngine().validateSTORKAuthnResponse(null, ipAddress);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication response IP null.
+ */
+ @Test
+ public final void testResponseInvalidParametersIP() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response parameter name wrong.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttr() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("AttrWrong");
+ wrongList.add(worngAttr);
+
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrSimpleValue() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoValue() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoName() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null complex value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrComplexValue() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setComplexValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test validate authentication response IP distinct and disabled validation
+ * IP.
+ */
+ @Test
+ public final void testResponseInvalidParametersIPDistinct() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // ipAddrValidation = false
+ // Subject Confirmation Bearer.
+
+ getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1");
+ fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test response invalid parameters invalid token.
+ */
+ @Test
+ public final void testResponseInvalidParametersTokenMsg() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // Subject Confirmation Bearer.
+ getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(),
+ ipAddress);
+ fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication response is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseIsFail()
+ throws STORKSAMLEngineException {
+ try {
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+ fail("Generate incorrect response");
+ } catch (Exception e) {
+ LOG.error("ERROR: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate authentication response destination.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseDestination()
+ throws STORKSAMLEngineException {
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ assertEquals("Destination incorrect: ",
+ authnResponse.getInResponseTo(), authenRequest.getSamlId());
+ }
+
+ /**
+ * Test validate authentication response values.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ public final void testValidateAuthenticationResponseValuesComplex()
+ throws STORKSAMLEngineException {
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ assertEquals("Country incorrect:", authnResponse.getCountry(), "EN");
+
+ final Iterator<PersonalAttribute> iterator = authnResponse
+ .getPersonalAttributeList().iterator();
+
+ while (iterator.hasNext()) {
+ final PersonalAttribute attribute = iterator.next();
+ if (attribute.getName().equalsIgnoreCase(
+ "canonicalResidenceAddress")) {
+ assertEquals("State incorrect: ", state, attribute
+ .getComplexValue().get("state"));
+ assertEquals("Municipality Code incorrect: ", municipalityCode,
+ attribute.getComplexValue().get("municipalityCode"));
+ assertEquals("Town incorrect: ", town, attribute
+ .getComplexValue().get("town"));
+ assertEquals("Postal code incorrect: ", postalCode, attribute
+ .getComplexValue().get("postalCode"));
+ assertEquals("Street name incorrect: ", streetName, attribute
+ .getComplexValue().get("streetName"));
+ assertEquals("Street number incorrect: ", streetNumber,
+ attribute.getComplexValue().get("streetNumber"));
+ assertEquals("Apartament number incorrect: ", apartamentNumber,
+ attribute.getComplexValue().get("apartamentNumber"));
+ }
+ }
+ }
+
+ /**
+ * Test generate authenticate response fail in response to it's null.
+ * @throws STORKSAMLEngineException
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test //( expected=STORKSAMLEngineException.class)
+ public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException {
+ final String identifier = authenRequest.getSamlId();
+ authenRequest.setSamlId(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ //throw new STORKSAMLEngineException(e);
+ }
+ }
+
+ /**
+ * Test generate authenticate response fail assertion consumer URL err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull()
+ throws STORKSAMLEngineException {
+
+ final String assertConsumerUrl = authenRequest
+ .getAssertionConsumerServiceURL();
+ authenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response fail code error err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponseFailCodeErrorNull()
+ throws STORKSAMLEngineException {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(null);
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test generate authentication request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnResponse() throws STORKSAMLEngineException {
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(dateOfBirth);
+
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+
+ final HashMap<String, String> complex = new HashMap<String, String>();
+ complex.put("one", "two");
+
+ //eIDNumber.setValue(null);
+ //eIDNumber.setValue(idNumber);
+ //eIDNumber.setComplexValue(complex);
+
+ eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString());
+ palist.add(eIDNumber);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("municipalityCode", municipalityCode);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+ address.put("apartamentNumber", apartamentNumber);
+
+ canRessAddress.setComplexValue(address);
+ palist.add(canRessAddress);
+
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAuthnResponse storkResponse = getEngine()
+ .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
+ isNotHashing);
+
+ authResponse = storkResponse.getTokenSaml();
+ LOG.info("Request id: " + authenRequest.getSamlId());
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse));
+
+
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ LOG.info("RESPONSE ID: " + authnResponse.getSamlId());
+ LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo());
+ LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry());
+
+ }
+
+
+
+
+
+ /**
+ * Test validate authentication response fail is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseFailIsFail()
+ throws STORKSAMLEngineException {
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("message");
+
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+
+ LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse));
+
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ LOG.info("COUNTRY: " + authnResponse.getCountry());
+ assertTrue("Generate incorrect response: ", authnResponse.isFail());
+ }
+
+ /**
+ * Test generate/validate response with signedDoc
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthenResponseWithSignedDoc()
+ throws STORKSAMLEngineException {
+
+ String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ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plY3Q+PC9kczpTaWduYXR1cmU+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute signedDoc = new PersonalAttribute();
+ signedDoc.setName("signedDoc");
+ signedDoc.setIsRequired(false);
+ ArrayList<String> signed = new ArrayList<String>();
+ signed.add(signedDocResponse);
+ signedDoc.setValue(signed);
+ palist.add(signedDoc);
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ palist.add(isAgeOver);
+
+ authenRequest.setPersonalAttributeList(palist);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAuthnResponse storkResponse = getEngine()
+ .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
+ isNotHashing);
+
+ authResponse = storkResponse.getTokenSaml();
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ assertTrue("SignedDoc response should be the same: ", authnResponse
+ .getPersonalAttributeList().get("signedDoc").getValue().get(0)
+ .equals(signedDocResponse));
+
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base
new file mode 100644
index 000000000..34fed0e39
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base
@@ -0,0 +1,20 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+/**
+ * Provides the classes necessary to create a SAML message.
+ * @since 1.0
+ */
+package eu.stork.peps.test.simple; \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java
new file mode 100644
index 000000000..b1443bb0e
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.commons.io.IOUtils;
+import org.bouncycastle.util.encoders.Base64;
+import org.opensaml.Configuration;
+import org.opensaml.xml.XMLObject;
+import org.opensaml.xml.io.Marshaller;
+import org.opensaml.xml.io.MarshallerFactory;
+import org.opensaml.xml.io.MarshallingException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * The Class SSETestUtils.
+ */
+public final class SSETestUtils {
+
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SSETestUtils.class.getName());
+
+ /**
+ * Instantiates a new sSE test utils.
+ */
+ private SSETestUtils() {
+ }
+
+ /**
+ * Prints the tree DOM.
+ *
+ * @param samlToken the SAML token
+ * @param isIndent the is indent
+ *
+ * @return the string
+ * @throws TransformerException the exception
+ */
+ public static String printTreeDOM(final Element samlToken, final boolean isIndent) throws TransformerException {
+ // set up a transformer
+ final TransformerFactory transfac = TransformerFactory.newInstance();
+ final Transformer trans = transfac.newTransformer();
+ trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ trans.setOutputProperty(OutputKeys.INDENT, String.valueOf(isIndent));
+
+ // create string from XML tree
+ final StringWriter stringWriter = new StringWriter();
+ final StreamResult result = new StreamResult(stringWriter);
+ final DOMSource source = new DOMSource(samlToken);
+ trans.transform(source, result);
+ final String xmlString = stringWriter.toString();
+
+ return xmlString;
+ }
+
+ /**
+ * Marshall.
+ *
+ * @param samlToken the SAML token
+ *
+ * @return the byte[]
+ *
+ * @throws MarshallingException the marshalling exception
+ * @throws ParserConfigurationException the parser configuration exception
+ * @throws TransformerException the transformer exception
+ */
+ public static byte[] marshall(final XMLObject samlToken)
+ throws MarshallingException, ParserConfigurationException,
+ TransformerException {
+
+ final javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory
+ .newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ dbf.setNamespaceAware(true);
+ dbf.setIgnoringComments(true);
+ final javax.xml.parsers.DocumentBuilder docBuild = dbf
+ .newDocumentBuilder();
+
+ // Get the marshaller factory
+ final MarshallerFactory marshallerFactory = Configuration
+ .getMarshallerFactory();
+
+ // Get the Subject marshaller
+ final Marshaller marshaller = marshallerFactory
+ .getMarshaller(samlToken);
+
+ final Document doc = docBuild.newDocument();
+
+ // Marshall the SAML token
+ marshaller.marshall(samlToken, doc);
+
+ // Obtain a byte array representation of the marshalled SAML object
+ final DOMSource domSource = new DOMSource(doc);
+ final StringWriter writer = new StringWriter();
+ final StreamResult result = new StreamResult(writer);
+ final TransformerFactory transFact = TransformerFactory.newInstance();
+ final Transformer transformer = transFact.newTransformer();
+ transformer.transform(domSource, result);
+
+ return writer.toString().getBytes();
+ }
+
+ /**
+ * Encode SAML token.
+ *
+ * @param samlToken the SAML token
+ *
+ * @return the string
+ */
+ public static String encodeSAMLToken(final byte[] samlToken) {
+ return new String(Base64.encode(samlToken));
+ }
+
+ /**
+ * Read stork SAML from file.
+ *
+ * @param resource the resource
+ *
+ * @return the byte[]
+ * @throws IOException the exception
+ *
+ */
+ public static byte[] readStorkSamlFromFile(final String resource)
+ throws IOException {
+ InputStream inputStream = null;
+ byte[] bytes;
+
+ try {
+ inputStream = StorkAuthRequestTest.class
+ .getResourceAsStream(resource);
+
+ // Create the byte array to hold the data
+ bytes = new byte[(int) inputStream.available()];
+ inputStream.read(bytes);
+ } catch (IOException e) {
+ LOG.error("Error read from file: " + resource);
+ throw e;
+ } finally {
+ IOUtils.closeQuietly(inputStream);
+ }
+ return bytes;
+
+ }
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java
new file mode 100644
index 000000000..97fa4b7cc
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import org.junit.Test;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+
+/**
+ * The Class SimpleBaseTest. Defines a set of test the initialization of the
+ * SAML engine.
+ */
+public class SimpleBaseTest extends TestCase {
+
+ /**
+ * Test SAML engine correct configuration name.
+ */
+ @Test
+ public final void testSamlEngineCorrectInit() {
+ Assert.assertNotNull(STORKSAMLEngine.getInstance("CONF1"));
+ }
+
+ /**
+ * Test SAML engine error configuration name.
+ */
+ @Test
+ public final void testSamlEngineErrorNameConf() {
+ Assert.assertNull(STORKSAMLEngine.getInstance("CONF_ERROR"));
+ }
+
+ /**
+ * Test SAML engine error name null.
+ */
+ @Test
+ public final void testSamlEngineErrorNameNull() {
+ Assert.assertNull(STORKSAMLEngine.getInstance(null));
+ }
+
+ /**
+ * Test SAML engine correct name configuration with spaces.
+ */
+ @Test
+ public final void testSamlEngineErrorNameSpaces() {
+ Assert.assertNotNull(STORKSAMLEngine.getInstance(" CONF1 "));
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java
new file mode 100644
index 000000000..7fa305d3b
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java
@@ -0,0 +1,790 @@
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.STORKAttrQueryRequest;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+public class StorkAttrQueryRequestTest {
+
+ /** The engines. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+ private static STORKSAMLEngine engine0 = STORKSAMLEngine.getInstance("CONF0");
+ private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2");
+ private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3");
+
+
+ /**
+ * Instantiates a new stork authentication request test.
+ */
+ public StorkAttrQueryRequestTest() {
+ pal = new PersonalAttributeList();
+
+ final PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ final ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ final PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ final PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ eIDNumber.setValue(Arrays.asList("ES/IS/1234567890"));
+ pal.add(eIDNumber);
+
+ final PersonalAttribute givenName = new PersonalAttribute();
+ givenName.setName("givenName");
+ givenName.setIsRequired(true);
+ givenName.setValue(Arrays.asList("Sveinbjorn"));
+ pal.add(givenName);
+
+ destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest";
+ //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+
+ }
+
+ /** The destination. */
+ private String destination;
+
+ /** The service provider sector. */
+ private String spSector;
+
+ /** The service provider institution. */
+ private String spInstitution;
+
+ /** The service provider application. */
+ private String spApplication;
+
+ /** The service provider country. */
+ private String spCountry;
+
+ /** The service provider id. */
+ private String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The List of Personal Attributes. */
+ private IPersonalAttributeList pal;
+
+ /** The attribute query request. */
+ private static byte[] attrRequest;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkAttrQueryRequestTest.class.getName());
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+ }
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // new parameters
+ request.setEIDSectorShare(false);
+ request.setEIDCrossSectorShare(false);
+ request.setEIDCrossBorderShare(false);
+
+ STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request);
+ byte[] reqByte = req1.getTokenSaml();
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"));
+ output.write(reqByte);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new STORKSAMLEngineException(e);
+ } finally {
+ try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); }
+ }
+
+
+
+
+ LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
+
+ request.setCitizenCountryCode("IS");
+ LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
+ }
+
+ /**
+ * Test generate authentication request error personal attribute name error.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestPALsErr1() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("attrNotValid");
+ worngAttr.setIsRequired(true);
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+
+ // news parameters
+ request.setEIDSectorShare(false);
+ request.setEIDCrossSectorShare(false);
+ request.setEIDCrossBorderShare(false);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+ /**
+ * Test generate authentication request error personal attribute value error.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestPALsErr2() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute attrNotValid = new PersonalAttribute();
+ attrNotValid.setName("attrNotValid");
+ attrNotValid.setIsRequired(true);
+ palWrong.add(attrNotValid);
+
+
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request authentication assurance level
+ * negative value.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestQaalErr1() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(-1);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider sector null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestSectorErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider institution null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestInstitutionrErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(null);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestApplicationErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(null);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider country null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestCountryErr() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(null);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request error with quality authentication
+ * assurance level wrong.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestQaalErr2() {
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(0);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request personal attribute list null value.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestPALErr1() {
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(null);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ engine.generateSTORKAttrQueryRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request null parameter.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestNullParam()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAttrQueryRequest(null);
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request error bytes encode.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestErrorEncode()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAttrQueryRequest("messageError".getBytes());
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml();
+
+ final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest);
+
+ assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
+
+ }
+
+ /**
+ * Test validate data authenticate request. Verified parameters after
+ * validation.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest);
+
+ assertEquals("Sestination incorrect: ", request.getDestination(), destination);
+
+ assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false);
+
+ assertEquals("QAAL incorrect: ", request.getQaa(), QAAL);
+ assertEquals("SPSector incorrect: ", request.getSpSector(), spSector);
+ assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null);
+ assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication);
+ assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null);
+
+ }
+
+ /**
+ * Test validate file attribute query request. Validate from XML file.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAttrQueryRequest() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml");
+
+ try {
+ engine.validateSTORKAttrQueryRequest(bytes);
+ fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate file authentication request tag delete.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAttrRequestTagDelete() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml");
+
+ try {
+ engine.validateSTORKAttrQueryRequest(bytes);
+ fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+
+ }
+ }
+
+ /**
+ * Test validate authentication request not trusted token.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestNotTrustedErr1()
+ throws STORKSAMLEngineException {
+
+ try {
+ final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine
+ .getInstance("CONF2");
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineNotTrusted
+ .generateSTORKAttrQueryRequest(request).getTokenSaml();
+
+ engine.validateSTORKAttrQueryRequest(authReqNotTrust);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test validate authentication request trusted.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestTrusted()
+ throws STORKSAMLEngineException {
+
+ final STORKSAMLEngine engineTrusted = STORKSAMLEngine
+ .getInstance("CONF3");
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest(
+ request).getTokenSaml();
+
+ // engine ("CONF1") no have trust certificate from "CONF2"
+ engine.validateSTORKAttrQueryRequest(authReqNotTrust);
+
+ }
+
+
+
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestNADA() {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(null);
+ request.setSpApplication(null);
+ request.setSpCountry(null);
+
+ try {
+
+ engine.validateSTORKAttrQueryRequest(attrRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test validate authentication request with unknown elements.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute unknown = new PersonalAttribute();
+ unknown.setName("unknown");
+ unknown.setIsRequired(true);
+ pAttList.add(unknown);
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+
+ req = engine3.generateSTORKAttrQueryRequest(request);
+
+ req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
+
+ assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown"));
+ assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier"));
+
+ }
+
+ /**
+ * Test generate Request with required elements by default
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+ STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest();
+ STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest();
+
+ reqTrue = engine.generateSTORKAttrQueryRequest(request);
+ reqFalse = engine2.generateSTORKAttrQueryRequest(request);
+ req = engine3.generateSTORKAttrQueryRequest(request);
+
+
+ String token = new String(req.getTokenSaml());
+ String reqTrueToken = new String(reqTrue.getTokenSaml());
+ String reqFalseToken = new String(reqFalse.getTokenSaml());
+
+ assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired"));
+ assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired"));
+ assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired"));
+
+ }
+
+ /**
+ * Test validating attribute query and getting alias used to save
+ * the saml trusted certificate into trustore
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+
+ request.setDestination(destination);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ STORKAttrQueryRequest req = new STORKAttrQueryRequest();
+
+ req = engine3.generateSTORKAttrQueryRequest(request);
+ req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+
+ req = engine2.generateSTORKAttrQueryRequest(request);
+ req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java
new file mode 100644
index 000000000..27c6cfe39
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java
@@ -0,0 +1,920 @@
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PEPSUtil;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.auth.commons.STORKAttrQueryRequest;
+import eu.stork.peps.auth.commons.STORKAttrQueryResponse;
+import eu.stork.peps.auth.commons.STORKAuthnRequest;
+import eu.stork.peps.auth.commons.STORKAuthnResponse;
+import eu.stork.peps.auth.commons.STORKStatusCode;
+import eu.stork.peps.auth.commons.STORKSubStatusCode;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+public class StorkAttrQueryResponseTest {
+
+ /** The engine. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+
+ /**
+ * Gets the engine.
+ *
+ * @return the engine
+ */
+ public static STORKSAMLEngine getEngine() {
+ return engine;
+ }
+
+ /**
+ * Sets the engine.
+ *
+ * @param newEngine the new engine
+ */
+ public static void setEngine(final STORKSAMLEngine newEngine) {
+ StorkAttrQueryResponseTest.engine = newEngine;
+ }
+
+ /** The destination. */
+ private static String destination;
+
+ /** The service provider sector. */
+ private static String spSector;
+
+ /** The service provider institution. */
+ private static String spInstitution;
+
+ /** The service provider application. */
+ private static String spApplication;
+
+ /** The service provider country. */
+ private static String spCountry;
+
+ /** The service provider id. */
+ private static String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The state. */
+ private static String state = "IS";
+
+ /** The town. */
+ private static String town = "Reykjavik";
+
+ /** The postal code. */
+ private static String postalCode = "105";
+
+ /** The street name. */
+ private static String streetName = "Gudrunartun";
+
+ /** The street number. */
+ private static String streetNumber = "10";
+
+ /** The List of Personal Attributes. */
+ private static IPersonalAttributeList pal;
+
+ /** The assertion consumer URL. */
+ private static String assertConsumerUrl;
+
+ /** The attribute query request. */
+ private static byte[] attrQueryRequest;
+
+ /** The attribute query response. */
+ private static byte[] attrQueryResponse;
+
+ /** The attribute query request. */
+ private static STORKAttrQueryRequest attrQueryenRequest;
+
+ /** The attribute query response. */
+ private static STORKAttrQueryResponse attrQeuryenResponse;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkAttrQueryResponseTest.class.getName());
+
+ /**
+ * Instantiates a new stork response test.
+ */
+ public StorkAttrQueryResponseTest() {
+ super();
+ }
+
+ /** The IP address. */
+ private static String ipAddress;
+
+ /** The destination URL. */
+ private static String destinationUrl;
+
+ /** The is hashing. */
+ private final boolean isHashing = Boolean.TRUE;
+
+ /** The is not hashing. */
+ private final boolean isNotHashing = Boolean.FALSE;
+
+ /** The ERROR text. */
+ private static final String ERROR_TXT = "generateAttrQueryResponse(...) should've thrown an STORKSAMLEngineException!";
+
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+
+ pal = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ final PersonalAttribute givenName = new PersonalAttribute();
+ givenName.setName("givenName");
+ givenName.setIsRequired(true);
+ pal.add(givenName);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ pal.add(canRessAddress);
+
+ PersonalAttribute newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ pal.add(newAttribute);
+
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "EN";
+
+ spId = "EDU001-APP001-APP001";
+
+ final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
+ request.setDestination(destination);
+ //request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ //request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("IS");
+
+ try {
+ attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request)
+ .getTokenSaml();
+
+ attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ fail("Error create STORKAuthnRequest");
+ }
+
+ ipAddress = "111.222.333.444";
+
+ destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+
+ pal = new PersonalAttributeList();
+
+ isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ages = new ArrayList<String>();
+
+ ages.add("16");
+ ages.add("18");
+
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(isAgeOver);
+
+ dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(dateOfBirth);
+
+ eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789IS");
+ eIDNumber.setValue(idNumber);
+ eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(eIDNumber);
+
+ canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+
+ canRessAddress.setComplexValue(address);
+ pal.add(canRessAddress);
+
+ newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> values = new HashMap<String, String>();
+
+ values.put("value1", "value1");
+ values.put("value2", "value2");
+ values.put("value3", "value3");
+ values.put("value4", "value4");
+
+ newAttribute.setComplexValue(values);
+ pal.add(newAttribute);
+
+ }
+
+ /**
+ * Test generate attribute query request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException {
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ final STORKAttrQueryResponse storkResponse = getEngine()
+ .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
+ destinationUrl, isNotHashing);
+
+ attrQueryResponse = storkResponse.getTokenSaml();
+
+ FileOutputStream output = null;
+
+ try {
+ output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml"));
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ output.write(attrQueryResponse);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse));
+
+
+ }
+
+ /**
+ * Test validation id parameter mandatory.
+ */
+ @Test
+ public final void testResponseMandatoryId() {
+ final String identifier = attrQueryenRequest.getSamlId();
+ attrQueryenRequest.setSamlId(null);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, destinationUrl, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response in response to err1.
+ */
+ @Test
+ public final void testResponseMandatoryIssuer() {
+
+ final String issuer = attrQueryenRequest.getIssuer();
+ attrQueryenRequest.setIssuer(null);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, destinationUrl, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setIssuer(issuer);
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test generate attribute query response assertion consumer null.
+ */
+ /*@Test
+ public final void testResponseMandatoryAssertionConsumerServiceURL() {
+ final String asserConsumerUrl = attrQueryenRequest
+ .getAssertionConsumerServiceURL();
+ attrQueryenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response IP address null.
+ */
+ @Test
+ public final void testResponseValidationIP() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null,
+ destinationUrl, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response with personal attribute list null.
+ */
+ @Test
+ public final void testResponseMandatoryPersonalAttributeList() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(null);
+
+
+ try {
+ getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
+ ipAddress, destinationUrl, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate attribute query response token null.
+ */
+ @Test
+ public final void testResponseInvalidParametersToken() {
+ try {
+ getEngine().validateSTORKAttrQueryResponse(null, ipAddress);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate attribute query response IP null.
+ */
+ @Test
+ public final void STORKAttrQueryResponse() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response parameter name wrong.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttr() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("AttrWrong");
+ wrongList.add(worngAttr);
+
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrSimpleValue() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoValue() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoName() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate attribute query response set null complex value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrComplexValue() {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setComplexValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test validate attribute query response IP distinct and disabled validation
+ * IP.
+ */
+ @Test
+ public final void testResponseInvalidParametersIPDistinct() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // ipAddrValidation = false
+ // Subject Confirmation Bearer.
+
+ getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1");
+ } catch (STORKSAMLEngineException e) {
+ fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!");
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test response invalid parameters invalid token.
+ */
+ @Test
+ public final void testResponseInvalidParametersTokenMsg() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // Subject Confirmation Bearer.
+ getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(),
+ ipAddress);
+ fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate attribute query response is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ /*@Test
+ public final void testValidateAuthenticationResponseIsFail()
+ throws STORKSAMLEngineException {
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail());
+ }
+
+ /**
+ * Test validate attribute query response destination.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseDestination()
+ throws STORKSAMLEngineException {
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertEquals("Destination incorrect: ",
+ attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId());
+ }
+
+ /**
+ * Test validate attribute query response values.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseValuesComplex()
+ throws STORKSAMLEngineException {
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES");
+
+ final Iterator<PersonalAttribute> iterator = attrQeuryenResponse
+ .getPersonalAttributeList().iterator();
+
+ while (iterator.hasNext()) {
+ final PersonalAttribute attribute = iterator.next();
+ if (attribute.getName().equalsIgnoreCase(
+ "canonicalResidenceAddress")) {
+ assertEquals("State incorrect: ", state, attribute
+ .getComplexValue().get("state"));
+ assertEquals("Town incorrect: ", town, attribute
+ .getComplexValue().get("town"));
+ assertEquals("Postal code incorrect: ", postalCode, attribute
+ .getComplexValue().get("postalCode"));
+ assertEquals("Street name incorrect: ", streetName, attribute
+ .getComplexValue().get("streetName"));
+ assertEquals("Street number incorrect: ", streetNumber,
+ attribute.getComplexValue().get("streetNumber"));
+ }
+ }
+ }
+
+ /**
+ * Test generate attribute query response fail in response to it's null.
+ * @throws STORKSAMLEngineException
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test //( expected=STORKSAMLEngineException.class)
+ public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException {
+ final String identifier = attrQueryenRequest.getSamlId();
+ attrQueryenRequest.setSamlId(null);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ //throw new STORKSAMLEngineException(e);
+ }
+ }
+
+ /**
+ * Test generate attribute query response fail assertion consumer URL err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ /*@Test
+ public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull()
+ throws STORKSAMLEngineException {
+
+ final String assertConsumerUrl = attrQueryenRequest
+ .getAssertionConsumerServiceURL();
+ attrQueryenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate attribute query response fail code error err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryResponseFailCodeErrorNull()
+ throws STORKSAMLEngineException {
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setStatusCode(null);
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+ fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test generate attribute query request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException {
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(dateOfBirth);
+
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+
+ final HashMap<String, String> complex = new HashMap<String, String>();
+ complex.put("one", "two");
+
+ //eIDNumber.setValue(null);
+ //eIDNumber.setValue(idNumber);
+ //eIDNumber.setComplexValue(complex);
+
+ eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString());
+ palist.add(eIDNumber);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+
+ canRessAddress.setComplexValue(address);
+ palist.add(canRessAddress);
+
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAttrQueryResponse storkResponse = getEngine()
+ .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
+ destinationUrl, isNotHashing);
+
+ attrQueryResponse = storkResponse.getTokenSaml();
+ LOG.info("Request id: " + attrQueryenRequest.getSamlId());
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse));
+
+
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId());
+ LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo());
+ LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry());
+
+ }
+
+
+
+
+
+ /**
+ * Test validate attribute query response fail is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAttrQueryResponseFailIsFail()
+ throws STORKSAMLEngineException {
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("message");
+
+ attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
+ response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
+
+ LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse));
+
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry());
+ assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail());
+ }
+
+ /**
+ * Test generate/validate response with signedDoc
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAttrQueryResponseWithSignedDoc()
+ throws STORKSAMLEngineException {
+
+ String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJP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0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute signedDoc = new PersonalAttribute();
+ signedDoc.setName("signedDoc");
+ signedDoc.setIsRequired(false);
+ ArrayList<String> signed = new ArrayList<String>();
+ signed.add(signedDocResponse);
+ signedDoc.setValue(signed);
+ palist.add(signedDoc);
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ palist.add(isAgeOver);
+
+ attrQueryenRequest.setPersonalAttributeList(palist);
+
+ final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAttrQueryResponse storkResponse = getEngine()
+ .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
+ destinationUrl, isNotHashing);
+
+ attrQueryResponse = storkResponse.getTokenSaml();
+ attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
+ ipAddress);
+
+ assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse
+ .getPersonalAttributeList().get("signedDoc").getValue().get(0)
+ .equals(signedDocResponse));
+
+ }
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java
new file mode 100644
index 000000000..7223ab483
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java
@@ -0,0 +1,966 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.STORKAuthnRequest;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+/**
+ * The Class StorkAuthRequestTest defines a class to .
+ */
+public class StorkAuthRequestTest {
+
+ /** The engines. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+ private static STORKSAMLEngine engine2 = STORKSAMLEngine.getInstance("CONF2");
+ private static STORKSAMLEngine engine3 = STORKSAMLEngine.getInstance("CONF3");
+
+
+ /**
+ * Instantiates a new stork authentication request test.
+ */
+ public StorkAuthRequestTest() {
+ pal = new PersonalAttributeList();
+
+ final PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ final ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ final PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ final PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+
+ spName = "University of Oxford";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "EN";
+
+ spId = "EDU001-OXF001-APP001";
+
+ }
+
+ /** The destination. */
+ private String destination;
+
+ /** The service provider name. */
+ private String spName;
+
+ /** The service provider sector. */
+ private String spSector;
+
+ /** The service provider institution. */
+ private String spInstitution;
+
+ /** The service provider application. */
+ private String spApplication;
+
+ /** The service provider country. */
+ private String spCountry;
+
+ /** The service provider id. */
+ private String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The List of Personal Attributes. */
+ private IPersonalAttributeList pal;
+
+ /** The assertion consumer URL. */
+ private String assertConsumerUrl;
+
+ /** The authentication request. */
+ private static byte[] authRequest;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkAuthRequestTest.class.getName());
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+ }
+
+ /**
+ * Test generate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnRequest() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ //engine.generateSTORKAuthnRequest(request);
+
+ LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml()));
+ request.setCitizenCountryCode("ES");
+ LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml()));
+ }
+
+
+ /**
+ * Test generate authentication request error personal attribute name error.
+ */
+ @Test
+ public final void testGenerateAuthnRequestPALsErr1() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("attrNotValid");
+ worngAttr.setIsRequired(true);
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+ /**
+ * Test generate authentication request error personal attribute value error.
+ */
+ @Test
+ public final void testGenerateAuthnRequestPALsErr2() {
+
+ final IPersonalAttributeList palWrong = new PersonalAttributeList();
+
+ final PersonalAttribute attrNotValid = new PersonalAttribute();
+ attrNotValid.setName("attrNotValid");
+ attrNotValid.setIsRequired(true);
+ palWrong.add(attrNotValid);
+
+
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(palWrong);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request error provider name null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestSPNAmeErr1() {
+
+
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(null);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try
+ {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ catch (STORKSAMLEngineException e)
+ {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request authentication assurance level
+ * negative value.
+ */
+ @Test
+ public final void testGenerateAuthnRequestQaalErr1() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(-1);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider sector null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestSectorErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider institution null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestInstitutionrErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(null);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestApplicationErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(null);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request service provider country null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestCountryErr() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(null);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test generate authentication request error with quality authentication
+ * assurance level wrong.
+ */
+ @Test
+ public final void testGenerateAuthnRequestQaalErr2() {
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(0);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request personal attribute list null value.
+ */
+ @Test
+ public final void testGenerateAuthnRequestPALErr1() {
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(null);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication request error with assertion consumer URL
+ * null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestAssertionConsumerErr1() {
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(null);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ engine.generateSTORKAuthnRequest(request);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request null parameter.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestNullParam()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAuthnRequest(null);
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request error bytes encode.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestErrorEncode()
+ throws STORKSAMLEngineException {
+ try {
+ engine.validateSTORKAuthnRequest("messageError".getBytes());
+ fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication request.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequest() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml();
+
+ final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest);
+
+ assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
+
+ }
+
+ /**
+ * Test validate data authenticate request. Verified parameters after
+ * validation.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest);
+
+ assertEquals("Sestination incorrect: ", request.getDestination(), destination);
+
+ assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false);
+ assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false);
+ assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false);
+
+ assertEquals("Service provider incorrect: ", request.getProviderName(), spName);
+ assertEquals("QAAL incorrect: ", request.getQaa(), QAAL);
+ assertEquals("SPSector incorrect: ", request.getSpSector(), spSector);
+ assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null);
+ assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication);
+ assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl);
+
+ assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry);
+ assertEquals("SP Id incorrect: ", request.getSPID(), spId);
+ assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES");
+
+ }
+
+ /**
+ * Test validate file authentication request. Validate from XML file.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAuthnRequest() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml");
+
+ try {
+ engine.validateSTORKAuthnRequest(bytes);
+ fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate file authentication request tag delete.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public final void testValidateFileAuthnRequestTagDelete() throws Exception {
+
+ final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml");
+
+ try {
+ engine.validateSTORKAuthnRequest(bytes);
+ fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error(e.getMessage());
+
+ }
+ }
+
+ /**
+ * Test validate authentication request not trusted token.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestNotTrustedErr1()
+ throws STORKSAMLEngineException {
+
+ try {
+ final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine
+ .getInstance("CONF2");
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineNotTrusted
+ .generateSTORKAuthnRequest(request).getTokenSaml();
+
+ engine.validateSTORKAuthnRequest(authReqNotTrust);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!");
+ }
+ }
+
+ /**
+ * Test validate authentication request trusted.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestTrusted()
+ throws STORKSAMLEngineException {
+
+ final STORKSAMLEngine engineTrusted = STORKSAMLEngine
+ .getInstance("CONF3");
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+
+ final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest(
+ request).getTokenSaml();
+
+ // engine ("CONF1") no have trust certificate from "CONF2"
+ engine.validateSTORKAuthnRequest(authReqNotTrust);
+
+ }
+
+ /**
+ * Test generate authentication request service provider application null.
+ */
+ @Test
+ public final void testGenerateAuthnRequestNADA() {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(null);
+ request.setSpInstitution(null);
+ request.setSpApplication(null);
+ request.setSpCountry(null);
+
+ try {
+ engine.validateSTORKAuthnRequest(authRequest);
+ fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
+
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate authentication request with unknown elements.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute unknown = new PersonalAttribute();
+ unknown.setName("unknown");
+ unknown.setIsRequired(true);
+ pAttList.add(unknown);
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+
+ req = engine3.generateSTORKAuthnRequest(request);
+
+ req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
+
+ assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown"));
+ assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier"));
+
+ }
+
+ /**
+ * Test generate Request with required elements by default
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+ STORKAuthnRequest reqTrue = new STORKAuthnRequest();
+ STORKAuthnRequest reqFalse = new STORKAuthnRequest();
+
+ reqTrue = engine.generateSTORKAuthnRequest(request);
+ reqFalse = engine2.generateSTORKAuthnRequest(request);
+ req = engine3.generateSTORKAuthnRequest(request);
+
+
+ String token = new String(req.getTokenSaml());
+ String reqTrueToken = new String(reqTrue.getTokenSaml());
+ String reqFalseToken = new String(reqFalse.getTokenSaml());
+
+ assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired"));
+ assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired"));
+ assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired"));
+
+ }
+
+ /**
+ * Test validating request and getting alias used to save
+ * the saml trusted certificate into trustore
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException {
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ IPersonalAttributeList pAttList = new PersonalAttributeList();
+
+ final PersonalAttribute eIdentifier = new PersonalAttribute();
+ eIdentifier.setName("eIdentifier");
+ eIdentifier.setIsRequired(true);
+ pAttList.add(eIdentifier);
+
+ request.setPersonalAttributeList(pAttList);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+
+ req = engine3.generateSTORKAuthnRequest(request);
+ req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+
+ req = engine2.generateSTORKAuthnRequest(request);
+ req = engine2.validateSTORKAuthnRequest(req.getTokenSaml());
+ assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
+
+
+
+ }
+
+ /**
+ * Test generating/validating request with signedDoc
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnRequestWithSignedDoc()
+ throws STORKSAMLEngineException {
+
+ String signedDocRequest = "<dss:SignRequest xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"_d96b62a87d18f1095170c1f44c90b5fd\"><dss:InputDocuments><dss:Document><dss:Base64Data MimeType=\"text/plain\">VGVzdCB0ZXh0</dss:Base64Data></dss:Document></dss:InputDocuments></dss:SignRequest>";
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+
+ PersonalAttributeList paler = new PersonalAttributeList();
+
+ final PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ paler.add(eIDNumber);
+
+ final PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ final ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ paler.add(isAgeOver);
+
+ final PersonalAttribute signedDoc = new PersonalAttribute();
+ signedDoc.setName("signedDoc");
+ final ArrayList<String> signedDocs = new ArrayList<String>();
+ signedDocs.add(signedDocRequest);
+ signedDoc.setValue(signedDocs);
+ signedDoc.setIsRequired(false);
+ paler.add(signedDoc);
+
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(paler);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // new parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ STORKAuthnRequest req = new STORKAuthnRequest();
+
+ req = engine.generateSTORKAuthnRequest(request);
+ req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
+
+ assertTrue("SignedDoc request should be the same: ", req
+ .getPersonalAttributeList().get("signedDoc").getValue().get(0)
+ .equals(signedDocRequest));
+
+
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java
new file mode 100644
index 000000000..481cbc28c
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java
@@ -0,0 +1,931 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+package eu.stork.peps.test.simple;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.junit.Test;
+import org.opensaml.xml.parse.BasicParserPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PEPSUtil;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.auth.commons.STORKAuthnRequest;
+import eu.stork.peps.auth.commons.STORKAuthnResponse;
+import eu.stork.peps.auth.commons.STORKStatusCode;
+import eu.stork.peps.auth.commons.STORKSubStatusCode;
+import eu.stork.peps.auth.engine.STORKSAMLEngine;
+import eu.stork.peps.exceptions.STORKSAMLEngineException;
+
+/**
+ * The Class AuthRequestTest.
+ */
+public class StorkResponseTest {
+
+ /** The engine. */
+ private static STORKSAMLEngine engine = STORKSAMLEngine.getInstance("CONF1");
+
+ /**
+ * Gets the engine.
+ *
+ * @return the engine
+ */
+ public static STORKSAMLEngine getEngine() {
+ return engine;
+ }
+
+ /**
+ * Sets the engine.
+ *
+ * @param newEngine the new engine
+ */
+ public static void setEngine(final STORKSAMLEngine newEngine) {
+ StorkResponseTest.engine = newEngine;
+ }
+
+ /** The destination. */
+ private static String destination;
+
+ /** The service provider name. */
+ private static String spName;
+
+ /** The service provider sector. */
+ private static String spSector;
+
+ /** The service provider institution. */
+ private static String spInstitution;
+
+ /** The service provider application. */
+ private static String spApplication;
+
+ /** The service provider country. */
+ private static String spCountry;
+
+ /** The service provider id. */
+ private static String spId;
+
+ /** The quality authentication assurance level. */
+ private static final int QAAL = 3;
+
+ /** The state. */
+ private static String state = "ES";
+
+ /** The town. */
+ private static String town = "Madrid";
+
+ /** The municipality code. */
+ private static String municipalityCode = "MA001";
+
+ /** The postal code. */
+ private static String postalCode = "28038";
+
+ /** The street name. */
+ private static String streetName = "Marchamalo";
+
+ /** The street number. */
+ private static String streetNumber = "3";
+
+ /** The apartament number. */
+ private static String apartamentNumber = "5º E";
+
+ /** The List of Personal Attributes. */
+ private static IPersonalAttributeList pal;
+
+ /** The assertion consumer URL. */
+ private static String assertConsumerUrl;
+
+ /** The authentication request. */
+ private static byte[] authRequest;
+
+ /** The authentication response. */
+ private static byte[] authResponse;
+
+ /** The authentication request. */
+ private static STORKAuthnRequest authenRequest;
+
+ /** The authentication response. */
+ private static STORKAuthnResponse authnResponse;
+
+ /** The Constant LOG. */
+ private static final Logger LOG = LoggerFactory
+ .getLogger(StorkResponseTest.class.getName());
+
+ /**
+ * Instantiates a new stork response test.
+ */
+ public StorkResponseTest() {
+ super();
+ }
+
+ /** The IP address. */
+ private static String ipAddress;
+
+ /** The is hashing. */
+ private final boolean isHashing = Boolean.TRUE;
+
+ /** The is not hashing. */
+ private final boolean isNotHashing = Boolean.FALSE;
+
+ /** The ERROR text. */
+ private static final String ERROR_TXT = "generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!";
+
+
+ /** Parser manager used to parse XML. */
+ private static BasicParserPool parser;
+
+
+
+ static {
+ parser = new BasicParserPool();
+ parser.setNamespaceAware(true);
+
+ pal = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ pal.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ pal.add(dateOfBirth);
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ pal.add(eIDNumber);
+
+ final PersonalAttribute givenName = new PersonalAttribute();
+ givenName.setName("givenName");
+ givenName.setIsRequired(true);
+ pal.add(givenName);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ pal.add(canRessAddress);
+
+ PersonalAttribute newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ pal.add(newAttribute);
+
+ destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
+ assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
+ spName = "University Oxford";
+
+ spName = "University of Oxford";
+ spSector = "EDU001";
+ spInstitution = "OXF001";
+ spApplication = "APP001";
+ spCountry = "EN";
+
+ spId = "EDU001-APP001-APP001";
+
+ final STORKAuthnRequest request = new STORKAuthnRequest();
+ request.setDestination(destination);
+ request.setProviderName(spName);
+ request.setQaa(QAAL);
+ request.setPersonalAttributeList(pal);
+ request.setAssertionConsumerServiceURL(assertConsumerUrl);
+
+ // news parameters
+ request.setSpSector(spSector);
+ request.setSpInstitution(spInstitution);
+ request.setSpApplication(spApplication);
+ request.setSpCountry(spCountry);
+ request.setSPID(spId);
+ request.setCitizenCountryCode("ES");
+
+ try {
+ authRequest = getEngine().generateSTORKAuthnRequest(request)
+ .getTokenSaml();
+
+ authenRequest = getEngine().validateSTORKAuthnRequest(authRequest);
+
+ } catch (STORKSAMLEngineException e) {
+ fail("Error create STORKAuthnRequest");
+ }
+
+ ipAddress = "111.222.333.444";
+
+ pal = new PersonalAttributeList();
+
+ isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ages = new ArrayList<String>();
+
+ ages.add("16");
+ ages.add("18");
+
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(isAgeOver);
+
+ dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(dateOfBirth);
+
+ eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+ eIDNumber.setValue(idNumber);
+ eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ pal.add(eIDNumber);
+
+ canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("municipalityCode", municipalityCode);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+ address.put("apartamentNumber", apartamentNumber);
+
+ canRessAddress.setComplexValue(address);
+ pal.add(canRessAddress);
+
+ newAttribute = new PersonalAttribute();
+ newAttribute.setName("newAttribute2");
+ newAttribute.setIsRequired(true);
+ newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> values = new HashMap<String, String>();
+
+ values.put("value1", "value1");
+ values.put("value2", "value2");
+ values.put("value3", "value3");
+ values.put("value4", "value4");
+
+ newAttribute.setComplexValue(values);
+ pal.add(newAttribute);
+
+ }
+
+ /**
+ * Test generate authentication request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponse() throws STORKSAMLEngineException {
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ final STORKAuthnResponse storkResponse = getEngine()
+ .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
+ isNotHashing);
+
+ authResponse = storkResponse.getTokenSaml();
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse));
+ }
+
+ /**
+ * Test validation id parameter mandatory.
+ */
+ @Test
+ public final void testResponseMandatoryId() {
+ final String identifier = authenRequest.getSamlId();
+ authenRequest.setSamlId(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response in response to err1.
+ */
+ @Test
+ public final void testResponseMandatoryIssuer() {
+
+ final String issuer = authenRequest.getIssuer();
+ authenRequest.setIssuer(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setIssuer(issuer);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response assertion consumer null.
+ */
+ @Test
+ public final void testResponseMandatoryAssertionConsumerServiceURL() {
+ final String asserConsumerUrl = authenRequest
+ .getAssertionConsumerServiceURL();
+ authenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response IP address null.
+ */
+ @Test
+ public final void testResponseValidationIP() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response, null,
+ isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response with personal attribute list null.
+ */
+ @Test
+ public final void testResponseMandatoryPersonalAttributeList() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(null);
+
+
+ try {
+ getEngine().generateSTORKAuthnResponse(authenRequest, response,
+ ipAddress, isHashing);
+ fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication response token null.
+ */
+ @Test
+ public final void testResponseInvalidParametersToken() {
+ try {
+ getEngine().validateSTORKAuthnResponse(null, ipAddress);
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication response IP null.
+ */
+ @Test
+ public final void testResponseInvalidParametersIP() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setPersonalAttributeList(pal);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response parameter name wrong.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttr() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("AttrWrong");
+ wrongList.add(worngAttr);
+
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrSimpleValue() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoValue() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrNoName() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+ /**
+ * Test validate authentication response set null complex value into attribute.
+ */
+ @Test
+ public final void testResponseInvalidParametersAttrComplexValue() {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ final IPersonalAttributeList wrongList = new PersonalAttributeList();
+
+ final PersonalAttribute worngAttr = new PersonalAttribute();
+ worngAttr.setName("isAgeOver");
+ worngAttr.setComplexValue(null);
+ wrongList.add(worngAttr);
+
+ response.setPersonalAttributeList(wrongList);
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ // In Conf1 ipValidate is false
+ getEngine().validateSTORKAuthnResponse(authResponse, null);
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test validate authentication response IP distinct and disabled validation
+ * IP.
+ */
+ @Test
+ public final void testResponseInvalidParametersIPDistinct() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // ipAddrValidation = false
+ // Subject Confirmation Bearer.
+
+ getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1");
+ fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test response invalid parameters invalid token.
+ */
+ @Test
+ public final void testResponseInvalidParametersTokenMsg() {
+ try {
+ // ipAddress origin "111.222.333.444"
+ // Subject Confirmation Bearer.
+ getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(),
+ ipAddress);
+ fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test validate authentication response is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseIsFail()
+ throws STORKSAMLEngineException {
+ try {
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+ fail("Generate incorrect response");
+ } catch (Exception e) {
+ LOG.error("ERROR: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Test validate authentication response destination.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseDestination()
+ throws STORKSAMLEngineException {
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ assertEquals("Destination incorrect: ",
+ authnResponse.getInResponseTo(), authenRequest.getSamlId());
+ }
+
+ /**
+ * Test validate authentication response values.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ public final void testValidateAuthenticationResponseValuesComplex()
+ throws STORKSAMLEngineException {
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ assertEquals("Country incorrect:", authnResponse.getCountry(), "EN");
+
+ final Iterator<PersonalAttribute> iterator = authnResponse
+ .getPersonalAttributeList().iterator();
+
+ while (iterator.hasNext()) {
+ final PersonalAttribute attribute = iterator.next();
+ if (attribute.getName().equalsIgnoreCase(
+ "canonicalResidenceAddress")) {
+ assertEquals("State incorrect: ", state, attribute
+ .getComplexValue().get("state"));
+ assertEquals("Municipality Code incorrect: ", municipalityCode,
+ attribute.getComplexValue().get("municipalityCode"));
+ assertEquals("Town incorrect: ", town, attribute
+ .getComplexValue().get("town"));
+ assertEquals("Postal code incorrect: ", postalCode, attribute
+ .getComplexValue().get("postalCode"));
+ assertEquals("Street name incorrect: ", streetName, attribute
+ .getComplexValue().get("streetName"));
+ assertEquals("Street number incorrect: ", streetNumber,
+ attribute.getComplexValue().get("streetNumber"));
+ assertEquals("Apartament number incorrect: ", apartamentNumber,
+ attribute.getComplexValue().get("apartamentNumber"));
+ }
+ }
+ }
+
+ /**
+ * Test generate authenticate response fail in response to it's null.
+ * @throws STORKSAMLEngineException
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test //( expected=STORKSAMLEngineException.class)
+ public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException {
+ final String identifier = authenRequest.getSamlId();
+ authenRequest.setSamlId(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail(ERROR_TXT);
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setSamlId(identifier);
+ LOG.error("Error");
+ //throw new STORKSAMLEngineException(e);
+ }
+ }
+
+ /**
+ * Test generate authenticate response fail assertion consumer URL err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull()
+ throws STORKSAMLEngineException {
+
+ final String assertConsumerUrl = authenRequest
+ .getAssertionConsumerServiceURL();
+ authenRequest.setAssertionConsumerServiceURL(null);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl);
+ LOG.error("Error");
+ }
+ }
+
+ /**
+ * Test generate authentication response fail code error err1.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthnResponseFailCodeErrorNull()
+ throws STORKSAMLEngineException {
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(null);
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("");
+
+ try {
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+ fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
+ } catch (STORKSAMLEngineException e) {
+ LOG.error("Error");
+ }
+ }
+
+
+
+
+ /**
+ * Test generate authentication request without errors.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthnResponse() throws STORKSAMLEngineException {
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(true);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(isAgeOver);
+
+ PersonalAttribute dateOfBirth = new PersonalAttribute();
+ dateOfBirth.setName("dateOfBirth");
+ dateOfBirth.setIsRequired(false);
+ final ArrayList<String> date = new ArrayList<String>();
+ date.add("16/12/2008");
+ dateOfBirth.setValue(date);
+ dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ palist.add(dateOfBirth);
+
+
+ PersonalAttribute eIDNumber = new PersonalAttribute();
+ eIDNumber.setName("eIdentifier");
+ eIDNumber.setIsRequired(true);
+
+ final ArrayList<String> idNumber = new ArrayList<String>();
+ idNumber.add("123456789PÑ");
+
+ final HashMap<String, String> complex = new HashMap<String, String>();
+ complex.put("one", "two");
+
+ //eIDNumber.setValue(null);
+ //eIDNumber.setValue(idNumber);
+ //eIDNumber.setComplexValue(complex);
+
+ eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString());
+ palist.add(eIDNumber);
+
+ PersonalAttribute canRessAddress = new PersonalAttribute();
+ canRessAddress.setName("canonicalResidenceAddress");
+ canRessAddress.setIsRequired(true);
+ canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
+ final HashMap<String, String> address = new HashMap<String, String>();
+
+ address.put("state", state);
+ address.put("municipalityCode", municipalityCode);
+ address.put("town", town);
+ address.put("postalCode", postalCode);
+ address.put("streetName", streetName);
+ address.put("streetNumber", streetNumber);
+ address.put("apartamentNumber", apartamentNumber);
+
+ canRessAddress.setComplexValue(address);
+ palist.add(canRessAddress);
+
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAuthnResponse storkResponse = getEngine()
+ .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
+ isNotHashing);
+
+ authResponse = storkResponse.getTokenSaml();
+ LOG.info("Request id: " + authenRequest.getSamlId());
+
+ LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse));
+
+
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ LOG.info("RESPONSE ID: " + authnResponse.getSamlId());
+ LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo());
+ LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry());
+
+ }
+
+
+
+
+
+ /**
+ * Test validate authentication response fail is fail.
+ *
+ * @throws STORKSAMLEngineException the STORKSAML engine exception
+ */
+ @Test
+ public final void testValidateAuthenticationResponseFailIsFail()
+ throws STORKSAMLEngineException {
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+ response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
+ response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
+ response.setMessage("message");
+
+ authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
+ response, ipAddress, isNotHashing).getTokenSaml();
+
+ LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse));
+
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ LOG.info("COUNTRY: " + authnResponse.getCountry());
+ assertTrue("Generate incorrect response: ", authnResponse.isFail());
+ }
+
+ /**
+ * Test generate/validate response with signedDoc
+ *
+ * @throws STORKSAMLEngineException
+ * the STORKSAML engine exception
+ */
+ @Test
+ public final void testGenerateAuthenResponseWithSignedDoc()
+ throws STORKSAMLEngineException {
+
+ String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzO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A4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
+
+ IPersonalAttributeList palist = new PersonalAttributeList();
+
+ PersonalAttribute signedDoc = new PersonalAttribute();
+ signedDoc.setName("signedDoc");
+ signedDoc.setIsRequired(false);
+ ArrayList<String> signed = new ArrayList<String>();
+ signed.add(signedDocResponse);
+ signedDoc.setValue(signed);
+ palist.add(signedDoc);
+
+ PersonalAttribute isAgeOver = new PersonalAttribute();
+ isAgeOver.setName("isAgeOver");
+ isAgeOver.setIsRequired(false);
+ ArrayList<String> ages = new ArrayList<String>();
+ ages.add("16");
+ ages.add("18");
+ isAgeOver.setValue(ages);
+ palist.add(isAgeOver);
+
+ authenRequest.setPersonalAttributeList(palist);
+
+ final STORKAuthnResponse response = new STORKAuthnResponse();
+
+ response.setPersonalAttributeList(palist);
+
+ final STORKAuthnResponse storkResponse = getEngine()
+ .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
+ isNotHashing);
+
+ authResponse = storkResponse.getTokenSaml();
+ authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
+ ipAddress);
+
+ assertTrue("SignedDoc response should be the same: ", authnResponse
+ .getPersonalAttributeList().get("signedDoc").getValue().get(0)
+ .equals(signedDocResponse));
+
+ }
+
+}
diff --git a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java
new file mode 100644
index 000000000..34fed0e39
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence. You may
+ * obtain a copy of the Licence at:
+ *
+ * http://www.osor.eu/eupl/european-union-public-licence-eupl-v.1.1
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * Licence for the specific language governing permissions and limitations under
+ * the Licence.
+ */
+
+/**
+ * Provides the classes necessary to create a SAML message.
+ * @since 1.0
+ */
+package eu.stork.peps.test.simple; \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops
new file mode 100644
index 000000000..fe8b26f95
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops
@@ -0,0 +1,101 @@
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources
+END
+keyStoreCountry1.jks
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry1.jks
+END
+keyStoreCountry2.jks
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry2.jks
+END
+keyStoreCountry3.jks
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry3.jks
+END
+p11Conf.cfg
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/p11Conf.cfg
+END
+logback-test.xml
+K 25
+svn:wc:ra_dav:version-url
+V 83
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/logback-test.xml
+END
+SamlEngine.xml
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/SamlEngine.xml
+END
+SignModule_P11.xml
+K 25
+svn:wc:ra_dav:version-url
+V 85
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/SignModule_P11.xml
+END
+StorkSamlEngine_Conf0.xml
+K 25
+svn:wc:ra_dav:version-url
+V 92
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf0.xml
+END
+StorkSamlEngine_Conf1.xml
+K 25
+svn:wc:ra_dav:version-url
+V 92
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf1.xml
+END
+SignModule_Conf0.xml
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf0.xml
+END
+StorkSamlEngine_Conf2.xml
+K 25
+svn:wc:ra_dav:version-url
+V 92
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf2.xml
+END
+SignModule_Conf1.xml
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf1.xml
+END
+StorkSamlEngine_Conf3.xml
+K 25
+svn:wc:ra_dav:version-url
+V 92
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/StorkSamlEngine_Conf3.xml
+END
+SignModule_Conf2.xml
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf2.xml
+END
+SignModule_Conf3.xml
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/SignModule_Conf3.xml
+END
+keyStoreCountry0.jks
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/keyStoreCountry0.jks
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/.svn/entries
new file mode 100644
index 000000000..1afc5a426
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/entries
@@ -0,0 +1,575 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+data
+dir
+
+logback-test.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+9645eaa7005e2fd5856a650a46e58b75
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+530
+
+SamlEngine.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+e2a6926fe3dabd0b07ea0c7f61a5c9a9
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2236
+
+SignModule_P11.xml
+file
+
+
+
+
+2013-12-20T12:27:57.254475Z
+13d70d84e25f491976cbbd9a0e3edafe
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+436
+
+StorkSamlEngine_Conf0.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+4ec0bc5ac4fafef57b60184cded62f9f
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3912
+
+StorkSamlEngine_Conf1.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+4ec0bc5ac4fafef57b60184cded62f9f
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3912
+
+SignModule_Conf0.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+ad61baa5b5d5a0c648b2e4c05b637add
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+541
+
+StorkSamlEngine_Conf2.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+7092c091691b1862d989f856cdc57b82
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2827
+
+SignModule_Conf1.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+16be2497f59cbd9c57acc81b783ecff1
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+522
+
+StorkSamlEngine_Conf3.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+44066ee14d9b2a03f7ee2f72c965c287
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2774
+
+SignModule_Conf2.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+fb7a26c03ef7400fe296b7d60837dff0
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+522
+
+SignModule_Conf3.xml
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+128795cf3937e23a2af256cc5db88b84
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+540
+
+keyStoreCountry0.jks
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+241d66f1af1a3937dfbbcccc7b7432c8
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1376
+
+keyStoreCountry1.jks
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+821660c55e39b47f7cd6c750e366531d
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1313
+
+keyStoreCountry2.jks
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+821660c55e39b47f7cd6c750e366531d
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1313
+
+keyStoreCountry3.jks
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+821660c55e39b47f7cd6c750e366531d
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1313
+
+p11Conf.cfg
+file
+
+
+
+
+2013-12-20T12:27:57.250475Z
+d7154f1fb90d3edbad739f703a30ff3d
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+510
+
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base
new file mode 100644
index 000000000..5e9587e65
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base
new file mode 100644
index 000000000..5e9587e65
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base
new file mode 100644
index 000000000..5e9587e65
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base
new file mode 100644
index 000000000..5e9587e65
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base
new file mode 100644
index 000000000..6bb61ae29
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<instances>
+
+ <!-- Configuration name-->
+ <instance name="CONF0">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf0.xml" />
+ </configuration>
+
+ <!-- Settings module signature-->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_Conf0.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF1 ******************** -->
+ <!-- Configuration name-->
+ <instance name="CONF1">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf1.xml" />
+ </configuration>
+
+ <!-- Settings module signature-->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_Conf1.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF2 ******************** -->
+
+ <instance name="CONF2">
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf2.xml" />
+ </configuration>
+
+ <configuration name="SignatureConf">
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <parameter name="fileConfiguration" value="SignModule_Conf2.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF3 ******************** -->
+
+ <instance name="CONF3">
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf3.xml" />
+ </configuration>
+
+ <configuration name="SignatureConf">
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <parameter name="fileConfiguration" value="SignModule_Conf3.xml" />
+ </configuration>
+ </instance>
+
+</instances> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base
new file mode 100644
index 000000000..eb9ed6f5d
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry0.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS</entry>
+ <entry key="serialNumber">529E05C8</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base
new file mode 100644
index 000000000..af68d33aa
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry1.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">529E04FF</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base
new file mode 100644
index 000000000..b13cb390a
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry2.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">529E04FF</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base
new file mode 100644
index 000000000..ed933020a
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry3.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">529E04FF</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base
new file mode 100644
index 000000000..64eb426c8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>HWModule sign with interface PKCS11.</comment>
+ <entry key="configurationFile">p11Config.cfg</entry>
+ <entry key="keyPassword">*******</entry>
+ <entry key="issuer">CN=XXXXXXXXX</entry>
+ <entry key="serialNumber">xxxxxxxxxxxxxx</entry>
+ <entry key="keystoreType">PKCS11</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base
new file mode 100644
index 000000000..0a28a5de8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base
new file mode 100644
index 000000000..0a28a5de8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base
new file mode 100644
index 000000000..435ef4b82
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base
new file mode 100644
index 000000000..bec8934f8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base
new file mode 100644
index 000000000..289e952fe
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base
new file mode 100644
index 000000000..5399bf689
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base
new file mode 100644
index 000000000..5399bf689
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base
new file mode 100644
index 000000000..5399bf689
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base
new file mode 100644
index 000000000..ff900e124
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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>
+
+ <logger name="eu.stork">
+ <level value="DEBUG" />
+ </logger>
+
+ <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/.svn/text-base/p11Conf.cfg.svn-base b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base
new file mode 100644
index 000000000..b712219c1
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base
@@ -0,0 +1,24 @@
+//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
+attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={
+ CKA_VERIFY=true
+}
+attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={
+ CKA_SIGN=true
+} \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml
new file mode 100644
index 000000000..6b0482795
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<instances>
+
+
+ <!-- Configuration name-->
+ <instance name="CONF0">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_demo.xml" />
+ </configuration>
+
+ <!-- Settings module signature-->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_demo.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF1 ******************** -->
+ <!-- Configuration name-->
+ <instance name="CONF00">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf0.xml" />
+ </configuration>
+
+ <!-- Settings module signature-->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_Conf0.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF1 ******************** -->
+ <!-- Configuration name-->
+ <instance name="CONF1">
+ <!-- Configurations parameters StorkSamlEngine -->
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf1.xml" />
+ </configuration>
+
+ <!-- Settings module signature-->
+ <configuration name="SignatureConf">
+ <!-- Specific signature module -->
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <!-- Settings specific module -->
+ <parameter name="fileConfiguration" value="SignModule_Conf1.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF2 ******************** -->
+
+ <instance name="CONF2">
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf2.xml" />
+ </configuration>
+
+ <configuration name="SignatureConf">
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <parameter name="fileConfiguration" value="SignModule_Conf2.xml" />
+ </configuration>
+ </instance>
+
+<!-- ******************** CONF3 ******************** -->
+
+ <instance name="CONF3">
+ <configuration name="SamlEngineConf">
+ <parameter name="fileConfiguration" value="StorkSamlEngine_Conf3.xml" />
+ </configuration>
+
+ <configuration name="SignatureConf">
+ <parameter name="class" value="eu.stork.peps.auth.engine.core.impl.SignSW" />
+ <parameter name="fileConfiguration" value="SignModule_Conf3.xml" />
+ </configuration>
+ </instance>
+
+</instances> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml
new file mode 100644
index 000000000..99c1b043d
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS</entry>
+ <entry key="serialNumber">529E05C8</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml
new file mode 100644
index 000000000..af68d33aa
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry1.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">529E04FF</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml
new file mode 100644
index 000000000..b13cb390a
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry2.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">529E04FF</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml
new file mode 100644
index 000000000..ed933020a
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">src/test/resources/keyStoreCountry3.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">529E04FF</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml
new file mode 100644
index 000000000..64eb426c8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>HWModule sign with interface PKCS11.</comment>
+ <entry key="configurationFile">p11Config.cfg</entry>
+ <entry key="keyPassword">*******</entry>
+ <entry key="issuer">CN=XXXXXXXXX</entry>
+ <entry key="serialNumber">xxxxxxxxxxxxxx</entry>
+ <entry key="keystoreType">PKCS11</entry>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml
new file mode 100644
index 000000000..c7cee3af4
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+
+<properties>
+ <comment>SWModule sign with JKS.</comment>
+ <entry key="keystorePath">projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks</entry>
+ <entry key="keyStorePassword">local-demo</entry>
+ <entry key="keyPassword">local-demo</entry>
+ <entry key="issuer">CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES</entry>
+ <entry key="serialNumber">4BA89DB2</entry>
+ <entry key="keystoreType">JKS</entry>
+</properties> \ No newline at end of file
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
new file mode 100644
index 000000000..0a28a5de8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+
+</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
new file mode 100644
index 000000000..0a28a5de8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+
+</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
new file mode 100644
index 000000000..435ef4b82
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+</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
new file mode 100644
index 000000000..bec8934f8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml
new file mode 100644
index 000000000..0a28a5de8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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>
+
+</properties> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops
new file mode 100644
index 000000000..3843fc6b7
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries
new file mode 100644
index 000000000..2eb50bbe8
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+eu
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops
new file mode 100644
index 000000000..56d18dd28
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 75
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries
new file mode 100644
index 000000000..798ea16b3
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+stork
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops
new file mode 100644
index 000000000..16ec86311
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops
@@ -0,0 +1,5 @@
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries
new file mode 100644
index 000000000..8ec7f9903
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries
@@ -0,0 +1,31 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+STORKSAMLEngine
+dir
+
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops
new file mode 100644
index 000000000..178273e8c
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops
@@ -0,0 +1,41 @@
+K 25
+svn:wc:ra_dav:version-url
+V 97
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine
+END
+AuthnRequestTagDelete.xml
+K 25
+svn:wc:ra_dav:version-url
+V 122
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml
+END
+AttrQueryRequestTagDelete.xml
+K 25
+svn:wc:ra_dav:version-url
+V 126
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml
+END
+AuthnRequest.xml
+K 25
+svn:wc:ra_dav:version-url
+V 113
+/CITnet/svn/STORK2/!svn/ver/22/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml
+END
+AttrQueryRequest.xml
+K 25
+svn:wc:ra_dav:version-url
+V 118
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml
+END
+AuthnRequestTagDeleteEncoded.xml
+K 25
+svn:wc:ra_dav:version-url
+V 129
+/CITnet/svn/STORK2/!svn/ver/56/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml
+END
+AttrQueryResponse.xml
+K 25
+svn:wc:ra_dav:version-url
+V 119
+/CITnet/svn/STORK2/!svn/ver/316/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml
+END
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries
new file mode 100644
index 000000000..16e2ccd8d
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries
@@ -0,0 +1,232 @@
+10
+
+dir
+357
+https://webgate.ec.europa.eu/CITnet/svn/STORK2/trunk/SamlEngine/src/test/resources/data/eu/stork/STORKSAMLEngine
+https://webgate.ec.europa.eu/CITnet/svn/STORK2
+
+
+
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+aa842e49-f825-43fc-93ba-11ee9fd5a035
+
+AttrQueryResponse.xml
+file
+
+
+
+
+2013-12-20T12:27:57.242475Z
+8f576c406bd8b2756899bbe1738e56d6
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+6092
+
+AuthnRequestTagDelete.xml
+file
+
+
+
+
+2013-12-20T12:27:57.242475Z
+13df3f7c9b0fb6e10ac782c43b8f3cdb
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2611
+
+AttrQueryRequestTagDelete.xml
+file
+
+
+
+
+2013-12-20T12:27:57.242475Z
+cd245752b96826be0c3b72e3428c6aac
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4045
+
+AuthnRequest.xml
+file
+
+
+
+
+2013-12-20T12:27:57.242475Z
+e993b1b24f5abbfa974485b0cbbc0211
+2013-07-25T08:47:40.940990Z
+6
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3898
+
+AttrQueryRequest.xml
+file
+
+
+
+
+2013-12-20T12:27:57.242475Z
+d78d68c7f18dc10e7cd7343954388987
+2013-12-16T15:04:09.136643Z
+316
+emsomavmi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4253
+
+AuthnRequestTagDeleteEncoded.xml
+file
+
+
+
+
+2013-12-20T12:27:57.242475Z
+c5122af357fd2a8339239853479b4aed
+2013-10-24T15:44:04.704923Z
+56
+emgrtargr
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2612
+
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base
new file mode 100644
index 000000000..852727dc5
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base
@@ -0,0 +1,11 @@
+<?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="_85e7875c2f6811921bf9369d0c53a231" IssueInstant="2013-12-16T09:29:34.986Z" 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="#_85e7875c2f6811921bf9369d0c53a231"><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>yV0IRPZSAh6PRmjZ1vaPVU6z/zg=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl
+eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT
+VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2
+MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph
+dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt
+by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55
+2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj
+9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G
+CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl
+XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK
+W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr</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></saml2p:AttributeQuery> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base
new file mode 100644
index 000000000..9f9fe5156
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base
@@ -0,0 +1,15 @@
+<?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/bpmqJzEPfY3sI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
+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/.svn/text-base/AttrQueryResponse.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base
new file mode 100644
index 000000000..b7e578c2d
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base
@@ -0,0 +1,10 @@
+<?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="_88e94fc799ffeaade7caf0f6b1607f42" InResponseTo="_5f6411178f905eda103c4e3fde993b84" IssueInstant="2013-12-16T09:29:35.408Z" 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="#_88e94fc799ffeaade7caf0f6b1607f42"><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>1/Vy066o+9GL0ah5FsUU9ddh4/Q=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw
+YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v
+MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM
+BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k
+ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja
+Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/
+525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG
+SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr
+y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG
+1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1</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="_17c6aa21fd1827cf98c82a3aa7829122" IssueInstant="2013-12-16T09:29:35.408Z" 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="_5f6411178f905eda103c4e3fde993b84" NotOnOrAfter="2013-12-16T09:34:35.408Z"/></saml2:SubjectConfirmation></saml2:Subject><saml2:Conditions NotBefore="2013-12-16T09:29:35.409Z" NotOnOrAfter="2013-12-16T09:34:35.408Z"><saml2:AudienceRestriction><saml2:Audience>http://S-PEPS.gov.xx</saml2:Audience></saml2:AudienceRestriction><saml2:OneTimeUse/></saml2:Conditions><saml2:AuthnStatement AuthnInstant="2013-12-16T09:29:35.409Z"><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/.svn/text-base/AuthnRequest.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base
new file mode 100644
index 000000000..c822702df
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base
@@ -0,0 +1,26 @@
+<?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></saml2p:AuthnRequest> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base
new file mode 100644
index 000000000..2a54c7d59
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base
@@ -0,0 +1,14 @@
+<?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></saml2p:AuthnRequest> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base
new file mode 100644
index 000000000..3239cf6e7
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base
@@ -0,0 +1,14 @@
+<?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></saml2p:AuthnRequest> \ 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
new file mode 100644
index 000000000..852727dc5
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml
@@ -0,0 +1,11 @@
+<?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="_85e7875c2f6811921bf9369d0c53a231" IssueInstant="2013-12-16T09:29:34.986Z" 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="#_85e7875c2f6811921bf9369d0c53a231"><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>yV0IRPZSAh6PRmjZ1vaPVU6z/zg=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl
+eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT
+VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2
+MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph
+dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt
+by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55
+2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj
+9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G
+CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl
+XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK
+W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr</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></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
new file mode 100644
index 000000000..9f9fe5156
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml
@@ -0,0 +1,15 @@
+<?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></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
new file mode 100644
index 000000000..b7e578c2d
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml
@@ -0,0 +1,10 @@
+<?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="_88e94fc799ffeaade7caf0f6b1607f42" InResponseTo="_5f6411178f905eda103c4e3fde993b84" IssueInstant="2013-12-16T09:29:35.408Z" 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="#_88e94fc799ffeaade7caf0f6b1607f42"><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>1/Vy066o+9GL0ah5FsUU9ddh4/Q=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw
+YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v
+MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM
+BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k
+ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja
+Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/
+525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG
+SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr
+y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG
+1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1</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="_17c6aa21fd1827cf98c82a3aa7829122" IssueInstant="2013-12-16T09:29:35.408Z" 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="_5f6411178f905eda103c4e3fde993b84" NotOnOrAfter="2013-12-16T09:34:35.408Z"/></saml2:SubjectConfirmation></saml2:Subject><saml2:Conditions NotBefore="2013-12-16T09:29:35.409Z" NotOnOrAfter="2013-12-16T09:34:35.408Z"><saml2:AudienceRestriction><saml2:Audience>http://S-PEPS.gov.xx</saml2:Audience></saml2:AudienceRestriction><saml2:OneTimeUse/></saml2:Conditions><saml2:AuthnStatement AuthnInstant="2013-12-16T09:29:35.409Z"><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
new file mode 100644
index 000000000..c822702df
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml
@@ -0,0 +1,26 @@
+<?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></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
new file mode 100644
index 000000000..2a54c7d59
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml
@@ -0,0 +1,14 @@
+<?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></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
new file mode 100644
index 000000000..3239cf6e7
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml
@@ -0,0 +1,14 @@
+<?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></saml2p:AuthnRequest> \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks
new file mode 100644
index 000000000..289e952fe
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks
new file mode 100644
index 000000000..5399bf689
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks
new file mode 100644
index 000000000..5399bf689
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks
Binary files differ
diff --git a/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks
new file mode 100644
index 000000000..5399bf689
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks
Binary files differ
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
new file mode 100644
index 000000000..ff900e124
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/logback-test.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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>
+
+ <logger name="eu.stork">
+ <level value="DEBUG" />
+ </logger>
+
+ <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
new file mode 100644
index 000000000..b712219c1
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg
@@ -0,0 +1,24 @@
+//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
+attributes(*,CKO_PUBLIC_KEY,CKK_RSA)={
+ CKA_VERIFY=true
+}
+attributes(*,CKO_PRIVATE_KEY,CKK_RSA)={
+ CKA_SIGN=true
+} \ No newline at end of file
diff --git a/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks b/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks
new file mode 100644
index 000000000..efaeac86c
--- /dev/null
+++ b/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks
Binary files differ