From 6c7a6f8e222e4fb39a11c220b63e785f2037d428 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Thu, 16 Jan 2014 08:55:06 +0100 Subject: fix added real source of stork modules --- .../stork2-saml-engine/src/test/.svn/all-wcprops | 5 + id/server/stork2-saml-engine/src/test/.svn/entries | 34 + .../src/test/java/.svn/all-wcprops | 5 + .../stork2-saml-engine/src/test/java/.svn/entries | 31 + .../src/test/java/META-INF/MANIFEST.MF | 3 + .../src/test/java/eu/.svn/all-wcprops | 5 + .../src/test/java/eu/.svn/entries | 31 + .../src/test/java/eu/stork/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/.svn/entries | 31 + .../src/test/java/eu/stork/peps/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/peps/.svn/entries | 31 + .../test/java/eu/stork/peps/test/.svn/all-wcprops | 5 + .../src/test/java/eu/stork/peps/test/.svn/entries | 31 + .../eu/stork/peps/test/simple/.svn/all-wcprops | 47 + .../java/eu/stork/peps/test/simple/.svn/entries | 266 ++++++ .../.svn/text-base/SSETestUtils.java.svn-base | 173 ++++ .../.svn/text-base/SimpleBaseTest.java.svn-base | 62 ++ .../StorkAttrQueryRequestTest.java.svn-base | 790 +++++++++++++++++ .../StorkAttrQueryResponseTest.java.svn-base | 920 ++++++++++++++++++++ .../text-base/StorkAuthRequestTest.java.svn-base | 966 +++++++++++++++++++++ .../.svn/text-base/StorkResponseTest.java.svn-base | 931 ++++++++++++++++++++ .../.svn/text-base/package-info.java.svn-base | 20 + .../eu/stork/peps/test/simple/SSETestUtils.java | 173 ++++ .../eu/stork/peps/test/simple/SimpleBaseTest.java | 62 ++ .../test/simple/StorkAttrQueryRequestTest.java | 790 +++++++++++++++++ .../test/simple/StorkAttrQueryResponseTest.java | 920 ++++++++++++++++++++ .../peps/test/simple/StorkAuthRequestTest.java | 966 +++++++++++++++++++++ .../stork/peps/test/simple/StorkResponseTest.java | 931 ++++++++++++++++++++ .../eu/stork/peps/test/simple/package-info.java | 20 + .../src/test/resources/.svn/all-wcprops | 101 +++ .../src/test/resources/.svn/entries | 575 ++++++++++++ .../.svn/prop-base/keyStoreCountry0.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry1.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry2.jks.svn-base | 5 + .../.svn/prop-base/keyStoreCountry3.jks.svn-base | 5 + .../.svn/text-base/SamlEngine.xml.svn-base | 63 ++ .../.svn/text-base/SignModule_Conf0.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf1.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf2.xml.svn-base | 12 + .../.svn/text-base/SignModule_Conf3.xml.svn-base | 12 + .../.svn/text-base/SignModule_P11.xml.svn-base | 11 + .../text-base/StorkSamlEngine_Conf0.xml.svn-base | 91 ++ .../text-base/StorkSamlEngine_Conf1.xml.svn-base | 91 ++ .../text-base/StorkSamlEngine_Conf2.xml.svn-base | 64 ++ .../text-base/StorkSamlEngine_Conf3.xml.svn-base | 61 ++ .../.svn/text-base/keyStoreCountry0.jks.svn-base | Bin 0 -> 1376 bytes .../.svn/text-base/keyStoreCountry1.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/keyStoreCountry2.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/keyStoreCountry3.jks.svn-base | Bin 0 -> 1313 bytes .../.svn/text-base/logback-test.xml.svn-base | 23 + .../resources/.svn/text-base/p11Conf.cfg.svn-base | 24 + .../src/test/resources/SamlEngine.xml | 81 ++ .../src/test/resources/SignModule_Conf0.xml | 12 + .../src/test/resources/SignModule_Conf1.xml | 12 + .../src/test/resources/SignModule_Conf2.xml | 12 + .../src/test/resources/SignModule_Conf3.xml | 12 + .../src/test/resources/SignModule_P11.xml | 11 + .../src/test/resources/SignModule_demo.xml | 12 + .../src/test/resources/StorkSamlEngine_Conf0.xml | 91 ++ .../src/test/resources/StorkSamlEngine_Conf1.xml | 91 ++ .../src/test/resources/StorkSamlEngine_Conf2.xml | 64 ++ .../src/test/resources/StorkSamlEngine_Conf3.xml | 61 ++ .../src/test/resources/StorkSamlEngine_demo.xml | 91 ++ .../src/test/resources/data/.svn/all-wcprops | 5 + .../src/test/resources/data/.svn/entries | 31 + .../src/test/resources/data/eu/.svn/all-wcprops | 5 + .../src/test/resources/data/eu/.svn/entries | 31 + .../test/resources/data/eu/stork/.svn/all-wcprops | 5 + .../src/test/resources/data/eu/stork/.svn/entries | 31 + .../data/eu/stork/STORKSAMLEngine/.svn/all-wcprops | 41 + .../data/eu/stork/STORKSAMLEngine/.svn/entries | 232 +++++ .../.svn/text-base/AttrQueryRequest.xml.svn-base | 11 + .../AttrQueryRequestTagDelete.xml.svn-base | 15 + .../.svn/text-base/AttrQueryResponse.xml.svn-base | 10 + .../.svn/text-base/AuthnRequest.xml.svn-base | 26 + .../text-base/AuthnRequestTagDelete.xml.svn-base | 14 + .../AuthnRequestTagDeleteEncoded.xml.svn-base | 14 + .../eu/stork/STORKSAMLEngine/AttrQueryRequest.xml | 11 + .../STORKSAMLEngine/AttrQueryRequestTagDelete.xml | 15 + .../eu/stork/STORKSAMLEngine/AttrQueryResponse.xml | 10 + .../data/eu/stork/STORKSAMLEngine/AuthnRequest.xml | 26 + .../STORKSAMLEngine/AuthnRequestTagDelete.xml | 14 + .../AuthnRequestTagDeleteEncoded.xml | 14 + .../src/test/resources/keyStoreCountry0.jks | Bin 0 -> 1376 bytes .../src/test/resources/keyStoreCountry1.jks | Bin 0 -> 1313 bytes .../src/test/resources/keyStoreCountry2.jks | Bin 0 -> 1313 bytes .../src/test/resources/keyStoreCountry3.jks | Bin 0 -> 1313 bytes .../src/test/resources/logback-test.xml | 23 + .../src/test/resources/p11Conf.cfg | 24 + .../src/test/resources/storkDemoKeys.jks | Bin 0 -> 4592 bytes 90 files changed, 10589 insertions(+) create mode 100644 id/server/stork2-saml-engine/src/test/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java create mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf0.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf1.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf2.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_Conf3.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_P11.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf0.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf1.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf2.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_Conf3.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDeleteEncoded.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks create mode 100644 id/server/stork2-saml-engine/src/test/resources/logback-test.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/p11Conf.cfg create mode 100644 id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks (limited to 'id/server/stork2-saml-engine/src/test') 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 ages = new ArrayList(); + 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 ages = new ArrayList(); + 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(); + + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + 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 address = new HashMap(); + + 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 values = new HashMap(); + + 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 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 ages = new ArrayList(); + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + 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 address = new HashMap(); + + 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG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czpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + 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 ages = new ArrayList(); + 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 = "VGVzdCB0ZXh0"; + + 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 ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + paler.add(isAgeOver); + + final PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + final ArrayList signedDocs = new ArrayList(); + 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 ages = new ArrayList(); + 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(); + + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + 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 address = new HashMap(); + + 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 values = new HashMap(); + + 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 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 ages = new ArrayList(); + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + 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 address = new HashMap(); + + 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5z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MzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + 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 ages = new ArrayList(); + 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 ages = new ArrayList(); + 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(); + + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + 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 address = new HashMap(); + + 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 values = new HashMap(); + + 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 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 ages = new ArrayList(); + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + 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 address = new HashMap(); + + 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2Qy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cHM6Ly93d3cuY2F0Y2VydC5uZXQvdmVyQ0lDLTIgKGMpMDMsIE9VPVNlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8gRUNWLTIsIEw9UGFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + 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 ages = new ArrayList(); + 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 = "VGVzdCB0ZXh0"; + + 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 ages = new ArrayList(); + ages.add("16"); + ages.add("18"); + isAgeOver.setValue(ages); + paler.add(isAgeOver); + + final PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + final ArrayList signedDocs = new ArrayList(); + 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 ages = new ArrayList(); + 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(); + + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + 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 address = new HashMap(); + + 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 values = new HashMap(); + + 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 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 ages = new ArrayList(); + 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 date = new ArrayList(); + 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 idNumber = new ArrayList(); + idNumber.add("123456789PÑ"); + + final HashMap complex = new HashMap(); + 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 address = new HashMap(); + + 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDk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RlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; + + IPersonalAttributeList palist = new PersonalAttributeList(); + + PersonalAttribute signedDoc = new PersonalAttribute(); + signedDoc.setName("signedDoc"); + signedDoc.setIsRequired(false); + ArrayList signed = new ArrayList(); + signed.add(signedDocResponse); + signedDoc.setValue(signed); + palist.add(signedDoc); + + PersonalAttribute isAgeOver = new PersonalAttribute(); + isAgeOver.setName("isAgeOver"); + isAgeOver.setIsRequired(false); + ArrayList ages = new ArrayList(); + 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry0.jks + local-demo + local-demo + CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS + 529E05C8 + JKS + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry1.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry2.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry3.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ 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 @@ + + + + + HWModule sign with interface PKCS11. + p11Config.cfg + ******* + CN=XXXXXXXXX + xxxxxxxxxxxxxx + PKCS11 + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/unknown + \ 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base 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 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + + + + + SWModule sign with JKS. + projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks + local-demo + local-demo + CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS + 529E05C8 + JKS + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry1.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry2.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ 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 @@ + + + + + SWModule sign with JKS. + src/test/resources/keyStoreCountry3.jks + local-demo + local-demo + CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES + 529E04FF + JKS + \ 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 @@ + + + + + HWModule sign with interface PKCS11. + p11Config.cfg + ******* + CN=XXXXXXXXX + xxxxxxxxxxxxxx + PKCS11 + \ 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 @@ + + + + + SWModule sign with JKS. + projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks + local-demo + local-demo + CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES + 4BA89DB2 + JKS + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + obtained + + + entity + + + + HTTP-POST + + false + false + false + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + http://www.stork.gov.eu/1.0/unknown + \ 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 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + + \ 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 @@ +http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl +eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT +VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 +MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph +dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt +by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 +2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj +9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G +CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl +XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK +W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ 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 @@ +http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==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==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ 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 @@ +http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v +MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM +BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k +ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja +Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ +525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr +y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG +1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ 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 @@ +http://S-PEPS.gov.xx + + + + + + + + + +yzsqaxBNicOrixBUno5cL0CBOpE= + + + +Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC +wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi +YIN/BUEtXkoYTjPtkmA= + +MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw +MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu +h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r +/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk +3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K +eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq +KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ 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 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ 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 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ 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 @@ +http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl +eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT +VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 +MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph +dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt +by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 +2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj +9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G +CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl +XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK +W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ 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 @@ +http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1jNqrPl1jjA0dP76m5SIVSqF8XcDR306ZB9GLJywOHKba0lxGLsXOAzJ+8u9jeixJ6VZKFqZg2Fhl/saKbg==MIIDJzCCAg8CBEuonbIwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UEBhMCRVMxDjAMBgN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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 @@ +http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw +YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v +MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM +BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k +ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja +Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ +525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG +SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr +y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG +1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ 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 @@ +http://S-PEPS.gov.xx + + + + + + + + + +yzsqaxBNicOrixBUno5cL0CBOpE= + + + +Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC +wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi +YIN/BUEtXkoYTjPtkmA= + +MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw +MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG +9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu +h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r +/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk +3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K +eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq +KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ 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 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ 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 @@ +http://S-PEPS.gov.xx + +S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR +Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC +Xt8p8tK3EoMocZse2hw= + +MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw +OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA +A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl +lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK +ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl +r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w +kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS +3cyl/wz83falsefalsefalse \ 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry0.jks 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry1.jks 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry2.jks 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/keyStoreCountry3.jks 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 @@ + + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + + + + + + \ 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 Binary files /dev/null and b/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks differ -- cgit v1.2.3 From 9cb68043945f53246928443cea723b58ee2b1c24 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Tue, 21 Jan 2014 14:38:35 +0100 Subject: updated samlengine --- .../stork2-saml-engine/src/test/.svn/all-wcprops | 5 - id/server/stork2-saml-engine/src/test/.svn/entries | 34 - .../src/test/java/.svn/all-wcprops | 5 - .../stork2-saml-engine/src/test/java/.svn/entries | 31 - .../src/test/java/META-INF/MANIFEST.MF | 3 - .../src/test/java/eu/.svn/all-wcprops | 5 - .../src/test/java/eu/.svn/entries | 31 - .../src/test/java/eu/stork/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/.svn/entries | 31 - .../src/test/java/eu/stork/peps/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/peps/.svn/entries | 31 - .../test/java/eu/stork/peps/test/.svn/all-wcprops | 5 - .../src/test/java/eu/stork/peps/test/.svn/entries | 31 - .../eu/stork/peps/test/simple/.svn/all-wcprops | 47 - .../java/eu/stork/peps/test/simple/.svn/entries | 266 ------ .../.svn/text-base/SSETestUtils.java.svn-base | 173 ---- .../.svn/text-base/SimpleBaseTest.java.svn-base | 62 -- .../StorkAttrQueryRequestTest.java.svn-base | 790 ----------------- .../StorkAttrQueryResponseTest.java.svn-base | 920 -------------------- .../text-base/StorkAuthRequestTest.java.svn-base | 966 --------------------- .../.svn/text-base/StorkResponseTest.java.svn-base | 931 -------------------- .../.svn/text-base/package-info.java.svn-base | 20 - .../eu/stork/peps/test/simple/SSETestUtils.java | 173 ---- .../eu/stork/peps/test/simple/SimpleBaseTest.java | 62 -- .../test/simple/StorkAttrQueryRequestTest.java | 790 ----------------- .../test/simple/StorkAttrQueryResponseTest.java | 920 -------------------- .../peps/test/simple/StorkAuthRequestTest.java | 966 --------------------- .../stork/peps/test/simple/StorkResponseTest.java | 931 -------------------- .../eu/stork/peps/test/simple/package-info.java | 20 - .../src/test/resources/.svn/all-wcprops | 101 --- .../src/test/resources/.svn/entries | 575 ------------ .../.svn/prop-base/keyStoreCountry0.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry1.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry2.jks.svn-base | 5 - .../.svn/prop-base/keyStoreCountry3.jks.svn-base | 5 - .../.svn/text-base/SamlEngine.xml.svn-base | 63 -- .../.svn/text-base/SignModule_Conf0.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf1.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf2.xml.svn-base | 12 - .../.svn/text-base/SignModule_Conf3.xml.svn-base | 12 - .../.svn/text-base/SignModule_P11.xml.svn-base | 11 - .../text-base/StorkSamlEngine_Conf0.xml.svn-base | 91 -- .../text-base/StorkSamlEngine_Conf1.xml.svn-base | 91 -- .../text-base/StorkSamlEngine_Conf2.xml.svn-base | 64 -- .../text-base/StorkSamlEngine_Conf3.xml.svn-base | 61 -- .../.svn/text-base/keyStoreCountry0.jks.svn-base | Bin 1376 -> 0 bytes .../.svn/text-base/keyStoreCountry1.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/keyStoreCountry2.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/keyStoreCountry3.jks.svn-base | Bin 1313 -> 0 bytes .../.svn/text-base/logback-test.xml.svn-base | 23 - .../resources/.svn/text-base/p11Conf.cfg.svn-base | 24 - .../src/test/resources/SamlEngine.xml | 60 -- .../src/test/resources/data/.svn/all-wcprops | 5 - .../src/test/resources/data/.svn/entries | 31 - .../src/test/resources/data/eu/.svn/all-wcprops | 5 - .../src/test/resources/data/eu/.svn/entries | 31 - .../test/resources/data/eu/stork/.svn/all-wcprops | 5 - .../src/test/resources/data/eu/stork/.svn/entries | 31 - .../data/eu/stork/STORKSAMLEngine/.svn/all-wcprops | 41 - .../data/eu/stork/STORKSAMLEngine/.svn/entries | 232 ----- .../.svn/text-base/AttrQueryRequest.xml.svn-base | 11 - .../AttrQueryRequestTagDelete.xml.svn-base | 15 - .../.svn/text-base/AttrQueryResponse.xml.svn-base | 10 - .../.svn/text-base/AuthnRequest.xml.svn-base | 26 - .../text-base/AuthnRequestTagDelete.xml.svn-base | 14 - .../AuthnRequestTagDeleteEncoded.xml.svn-base | 14 - .../eu/stork/STORKSAMLEngine/AttrQueryRequest.xml | 27 +- .../eu/stork/STORKSAMLEngine/AttrQueryResponse.xml | 25 +- 68 files changed, 31 insertions(+), 9983 deletions(-) delete mode 100644 id/server/stork2-saml-engine/src/test/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java delete mode 100644 id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base delete mode 100644 id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base (limited to 'id/server/stork2-saml-engine/src/test') diff --git a/id/server/stork2-saml-engine/src/test/.svn/all-wcprops b/id/server/stork2-saml-engine/src/test/.svn/all-wcprops deleted file mode 100644 index ead80d4e8..000000000 --- a/id/server/stork2-saml-engine/src/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 1b6d0b3e1..000000000 --- a/id/server/stork2-saml-engine/src/test/.svn/entries +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index 56c8ee113..000000000 --- a/id/server/stork2-saml-engine/src/test/java/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index ca124ed28..000000000 --- a/id/server/stork2-saml-engine/src/test/java/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 5e9495128..000000000 --- a/id/server/stork2-saml-engine/src/test/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index e00b13d5a..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index cc3e19816..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index ac0852630..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 66d2ea82a..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 5555d11e2..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index e20bc1c1d..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index ee98ec5bd..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index a7074362f..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 063e2de18..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/all-wcprops +++ /dev/null @@ -1,47 +0,0 @@ -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 deleted file mode 100644 index 0fbc1b254..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/entries +++ /dev/null @@ -1,266 +0,0 @@ -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 deleted file mode 100644 index b1443bb0e..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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 deleted file mode 100644 index 97fa4b7cc..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7fa305d3b..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base +++ /dev/null @@ -1,790 +0,0 @@ -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 ages = new ArrayList(); - 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 deleted file mode 100644 index 27c6cfe39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base +++ /dev/null @@ -1,920 +0,0 @@ -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 ages = new ArrayList(); - 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(); - - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - 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 address = new HashMap(); - - 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 values = new HashMap(); - - 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 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 ages = new ArrayList(); - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - 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 address = new HashMap(); - - 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1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kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - 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 deleted file mode 100644 index 7223ab483..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base +++ /dev/null @@ -1,966 +0,0 @@ -/* - * 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 ages = new ArrayList(); - 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 = "VGVzdCB0ZXh0"; - - 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 ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - paler.add(isAgeOver); - - final PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - final ArrayList signedDocs = new ArrayList(); - 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 deleted file mode 100644 index 481cbc28c..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base +++ /dev/null @@ -1,931 +0,0 @@ -/* - * 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 ages = new ArrayList(); - 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(); - - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - 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 address = new HashMap(); - - 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 values = new HashMap(); - - 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 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 ages = new ArrayList(); - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - 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 address = new HashMap(); - - 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+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edDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - 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 deleted file mode 100644 index 34fed0e39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 deleted file mode 100644 index b1443bb0e..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SSETestUtils.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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 deleted file mode 100644 index 97fa4b7cc..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/SimpleBaseTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 deleted file mode 100644 index 7fa305d3b..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.java +++ /dev/null @@ -1,790 +0,0 @@ -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 ages = new ArrayList(); - 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 deleted file mode 100644 index 27c6cfe39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.java +++ /dev/null @@ -1,920 +0,0 @@ -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 ages = new ArrayList(); - 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(); - - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - 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 address = new HashMap(); - - 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 values = new HashMap(); - - 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 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 ages = new ArrayList(); - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - 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 address = new HashMap(); - - 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThiY2MtNDhhMC05Yjc3LTBlOTk5N2JkZDA1OCI+PGRzOlRyYW5zZm9ybXM+PGRzOlRyYW5zZm9ybSBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyNiYXNlNjQiLz48L2RzOlRyYW5zZm9ybXM+PGRzOkRpZ2VzdE1ldGhvZCBBbGdvcml0aG09Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1s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Jc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - 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 deleted file mode 100644 index 7223ab483..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.java +++ /dev/null @@ -1,966 +0,0 @@ -/* - * 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 ages = new ArrayList(); - 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 = "VGVzdCB0ZXh0"; - - 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 ages = new ArrayList(); - ages.add("16"); - ages.add("18"); - isAgeOver.setValue(ages); - paler.add(isAgeOver); - - final PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - final ArrayList signedDocs = new ArrayList(); - 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 deleted file mode 100644 index 481cbc28c..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/StorkResponseTest.java +++ /dev/null @@ -1,931 +0,0 @@ -/* - * 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 ages = new ArrayList(); - 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(); - - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - 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 address = new HashMap(); - - 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 values = new HashMap(); - - 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 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 ages = new ArrayList(); - 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 date = new ArrayList(); - 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 idNumber = new ArrayList(); - idNumber.add("123456789PÑ"); - - final HashMap complex = new HashMap(); - 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 address = new HashMap(); - - 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 = " urn:oasis:names:tc:dss:1.0:resultmajor:Success PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJ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WltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+ "; - - IPersonalAttributeList palist = new PersonalAttributeList(); - - PersonalAttribute signedDoc = new PersonalAttribute(); - signedDoc.setName("signedDoc"); - signedDoc.setIsRequired(false); - ArrayList signed = new ArrayList(); - signed.add(signedDocResponse); - signedDoc.setValue(signed); - palist.add(signedDoc); - - PersonalAttribute isAgeOver = new PersonalAttribute(); - isAgeOver.setName("isAgeOver"); - isAgeOver.setIsRequired(false); - ArrayList ages = new ArrayList(); - 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 deleted file mode 100644 index 34fed0e39..000000000 --- a/id/server/stork2-saml-engine/src/test/java/eu/stork/peps/test/simple/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 deleted file mode 100644 index fe8b26f95..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/all-wcprops +++ /dev/null @@ -1,101 +0,0 @@ -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 deleted file mode 100644 index 1afc5a426..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/entries +++ /dev/null @@ -1,575 +0,0 @@ -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 deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry0.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry1.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry2.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 5e9587e65..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/prop-base/keyStoreCountry3.jks.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 6bb61ae29..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SamlEngine.xml.svn-base +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ 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 deleted file mode 100644 index eb9ed6f5d..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf0.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry0.jks - local-demo - local-demo - CN=saml-demo-cert,OU=STORK2,O=Advania,L=Reykjavik,ST=Reykjavik,C=IS - 529E05C8 - JKS - \ 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 deleted file mode 100644 index af68d33aa..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf1.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry1.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ 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 deleted file mode 100644 index b13cb390a..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf2.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry2.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ 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 deleted file mode 100644 index ed933020a..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_Conf3.xml.svn-base +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - src/test/resources/keyStoreCountry3.jks - local-demo - local-demo - CN=local-demo, O=Indra, L=Madrid, ST=Spain, C=ES - 529E04FF - JKS - \ 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 deleted file mode 100644 index 64eb426c8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/SignModule_P11.xml.svn-base +++ /dev/null @@ -1,11 +0,0 @@ - - - - - HWModule sign with interface PKCS11. - p11Config.cfg - ******* - CN=XXXXXXXXX - xxxxxxxxxxxxxx - PKCS11 - \ 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 deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf0.xml.svn-base +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ 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 deleted file mode 100644 index 0a28a5de8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf1.xml.svn-base +++ /dev/null @@ -1,91 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - - \ 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 deleted file mode 100644 index 435ef4b82..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf2.xml.svn-base +++ /dev/null @@ -1,64 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - \ 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 deleted file mode 100644 index bec8934f8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/StorkSamlEngine_Conf3.xml.svn-base +++ /dev/null @@ -1,61 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - obtained - - - entity - - - - HTTP-POST - - false - false - false - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - http://www.stork.gov.eu/1.0/unknown - \ 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 deleted file mode 100644 index 289e952fe..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry0.jks.svn-base and /dev/null 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 deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry1.jks.svn-base and /dev/null 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 deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry2.jks.svn-base and /dev/null 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 deleted file mode 100644 index 5399bf689..000000000 Binary files a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/keyStoreCountry3.jks.svn-base and /dev/null 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 deleted file mode 100644 index ff900e124..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/logback-test.xml.svn-base +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - \ 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 deleted file mode 100644 index b712219c1..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/.svn/text-base/p11Conf.cfg.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//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 index 6b0482795..d9dcb34f8 100644 --- a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml +++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml @@ -17,65 +17,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ 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 deleted file mode 100644 index 3843fc6b7..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 2eb50bbe8..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 56d18dd28..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 798ea16b3..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 16ec86311..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/all-wcprops +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 8ec7f9903..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/.svn/entries +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 178273e8c..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/all-wcprops +++ /dev/null @@ -1,41 +0,0 @@ -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 deleted file mode 100644 index 16e2ccd8d..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/entries +++ /dev/null @@ -1,232 +0,0 @@ -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 deleted file mode 100644 index 852727dc5..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequest.xml.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl -eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT -VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 -MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph -dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt -by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 -2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj -9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl -XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK -W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ 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 deleted file mode 100644 index 9f9fe5156..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryRequestTagDelete.xml.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -http://S-PEPS.gov.xxhhQXDKNrJJ3Yy/pkZNZF4GlWrA/Xsx4CH9chgVa5HK4qZQvFXvZwegdw6U7rm7qv0zmI4xaLTv/bpmqJzEPfY3sIvrDRu9EouEKwtjbMbcvVQsx7I+j0yy7/cBcQJe3lRwQwyvazfYVbnSeGFxBN6WOHPqv6uInaQO/hXkicT3tBtm8o3UgUDY6c8wIMuD5A0hWTkL6z6f893AbdN85OQYAdHItNsQWeLOIeiGC918X7qqTfhFtBAB2oGVjlsSEqWox1j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rdSQ9PF7wXDvWNzJq -yaNBUWWBV1TskvkNZXcaguroVPy2XhA1aixlAajWEXLk6Uuj5UYqalrV/reNYvDvY0BV2CIn51r7 -Ppm8IFVTk8mYfX8/jw==3falsefalsefalse1618SveinbjörnES/IS/1234567890 \ 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 deleted file mode 100644 index b7e578c2d..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AttrQueryResponse.xml.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v -MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM -BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k -ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja -Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ -525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG -SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr -y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG -1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ 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 deleted file mode 100644 index c822702df..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequest.xml.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -http://S-PEPS.gov.xx - - - - - - - - - -yzsqaxBNicOrixBUno5cL0CBOpE= - - - -Xycll1PF7hh3Xdykpr6nIr8Q6PQ6OxLIBBBugoGpAm/V4Hu7tKakHJp8TgtRWZ30jG5eolOXnJkC -wiaTVUFaQz7cNn27syRJkdA+eYlz9doiwUJ5eD1cAyddZYsNPpSeAj5UK45oN0qCH+/pI9mRw8Oi -YIN/BUEtXkoYTjPtkmA= - -MIIBmDCCAQECBEuWisIwDQYJKoZIhvcNAQEFBQAwEzERMA8GA1UEAxMIY291bnRyeTEwHhcNMTAw -MzA5MTc1MjAyWhcNMTAwNjA3MTc1MjAyWjATMREwDwYDVQQDEwhjb3VudHJ5MTCBnzANBgkqhkiG -9w0BAQEFAAOBjQAwgYkCgYEAnb2gcchwxvJBclcsfCBWJnYefLJYQnDGCQ3RUtYZc26JznnLXclu -h1XfLJlWgYk/pFKz7B9KfJztal47c6mBfisnxjhdcLqcbXOuRIm7E8TZPzdbHEd60WHPDv20jr+r -/WkOQs12tKQMbgDX2wtBBcJODLYCDiYa1oQsnyhdOGkCAwEAATANBgkqhkiG9w0BAQUFAAOBgQBk -3luVRc0EqEE1zZeYvRPi5a2yOZfI9H+/rXI1qNLwmICnuJX++ukUbqJHm/FV1iSPM9O9oqzifJ/K -eKL5EcUugJ76Tu5XO8za2FoJvYr+jIZDsEkCg+OSzcp/eljiWAIh2enZcQ/ON6QxWXeSNJPH0xOq -KAoZgbUK0Zld3Dsheg==3EDU001OXF001APP001ENtruetruetrue1618 \ 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 deleted file mode 100644 index 2a54c7d59..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDelete.xml.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ 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 deleted file mode 100644 index 3239cf6e7..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/.svn/text-base/AuthnRequestTagDeleteEncoded.xml.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -http://S-PEPS.gov.xx - -S6nY97RSCUJXq3HZ5obSLCI341LvtAA3vHjR1FWxrIMDPACQMqlNWBYNnRP1RiZiJV6x0RieH+SR -Vkiy03jYyhr0XkwAE5Wd6Huf+zIbeTXjZkdQj7JpAXoB+ky4G/+L0deamvsP3eO7ZJ4grady4gmC -Xt8p8tK3EoMocZse2hw= - -MIIBkTCB+wIESpT8bTANBgkqhkiG9w0BAQUFADAQMQ4wDAYDVQQDEwVzdG9yazAeFw0wOTA4MjYw -OTEyMTNaFw0wOTExMjQwOTEyMTNaMBAxDjAMBgNVBAMTBXN0b3JrMIGfMA0GCSqGSIb3DQEBAQUA -A4GNADCBiQKBgQDK/QL8NuMd41I1lObObeRA6DaM8bjeYqIz5mg5WnnZv4jlcK7Gq89Lk6htXRFl -lAXpDYhI3zolMIMHEMZ3zQQPc7lgTV6Bbz9uD2YTJ9Kx55e8Y6Y49DO+TiiejGJxTzTFUcuBJHaK -ipuvLVd1a8N3RAnaGSUOozhrTqxba82mEwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAFJgeS18nhUl -r7WnvSn9FlkI94U//Hk3iZLc3/cScTu7D7Y/J0eUq4TF8PsSzWX5khGuqrTkswNgfEtl2IpACQ2w -kB8+RxeRNdddQlGHlO4ZqnpvxXBwSouiy2yUeAo0y++vMFm6DO4sxfk8eTtimPDo5SzBtjtGtbqS -3cyl/wz83falsefalsefalse \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml index 852727dc5..511919167 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml @@ -1,11 +1,16 @@ -http://S-PEPS.gov.xxyV0IRPZSAh6PRmjZ1vaPVU6z/zg=bVgqD3CtVQ3eRE/2Xx8Wr5UMkxNk2GBjo70H+PvMCSlIymZjyje79Xi7sJg/eEj0fAGb0go+gfQGQVRYweanFFwqTcinz8XoF2slPosg/8BBq+1vWDDxtbdvg4jOzgvIlAWkDrwHwMOeg0mWCma5ev2nJx8qF8MX5cEfbSkczXI=MIICVDCCAb0CBFKeBcgwDQYJKoZIhvcNAQEFBQAwcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJl -eWtqYXZpazESMBAGA1UEBwwJUmV5a2phdmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZT -VE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVtby1jZXJ0MB4XDTEzMTIwMzE2MjQ0MFoXDTIzMTIwMTE2 -MjQ0MFowcTELMAkGA1UEBhMCSVMxEjAQBgNVBAgMCVJleWtqYXZpazESMBAGA1UEBwwJUmV5a2ph -dmlrMRAwDgYDVQQKDAdBZHZhbmlhMQ8wDQYDVQQLDAZTVE9SSzIxFzAVBgNVBAMMDnNhbWwtZGVt -by1jZXJ0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUhM/yeonkcmLA82MJeRM36WOelr55 -2SE0xBSt+n6CFmem5qRRAleP7n8vzXwCsnvs3HZtiEYBhl+k1ktp5MkZAh4zKPzChKW3JZBm37mj -9/1QBKINCMCsIR8ppUEU8EyYxOVx83sggv110BNB0CkSp7YRE45QSL6/gSg/iSlHmQIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBAGYjXnRO7YsEp7g40Nldg+kGBCgMHOoDUTcbCrory1XL2E8eHHQgNfQl -XQ+a9QPTBRAeDZ83mPkXv6OEDNmReKIZVWd4vcjcKaZxraQU8MgifyO3wz25uAHAR+hvBHn6whsK -W9BoMNzFTV0xrsZVW8CNRHsiR6Yh6fwkGO2brhrr3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file +http://S-PEPS.gov.xxBgPDTVCv7BhiWIs6HsC06jaHaag=dIC61bGi6Jqp1zSVojpjaVq9WaZcDtNImXgo1Dyze5/hJA07Sy4TaHu+/IuLEC99aLjM6rxh2UUNqpPaQCFlF5eVkVv/c4gHEZVyevhjJKTidqmnuhlI78PGMx2thfxFsHsPcqHqOzy1Z6w18K1ds6APQP+aXI9TNKis+pykn4nJititYuiSseD0VY0F4QnXx+U6k3raoi1CAFE5fe7EuI/KfxuhhQLAbLq90Vm8R94ITBjfSS25mXstXNe9zppTSjDB42ld1TjDovDwXAn5OxiZasIEb5m68sRlxgoQ/2/+ZdYNNINFLAwkCbb8MiCbGASd626Bme0Kx+ropeWdxw==MIIDXjCCAkagAwIBAgIEUk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sF1YRbIrr2OqEVE6M6DUx+pAQOd2uogV3AMT9D5MYpckI1jx/o/Tto7ju74nIVOskDiN +K0FR8izxcT0HixM=3falsefalsefalse1618SveinbjornES/IS/1234567890 \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml index b7e578c2d..1ff7fbeeb 100644 --- a/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml +++ b/id/server/stork2-saml-engine/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml @@ -1,10 +1,15 @@ -http://C-PEPS.gov.xx1/Vy066o+9GL0ah5FsUU9ddh4/Q=aLnFnTtAOWeBnCMazs8yYEwwQtRBmOl9idpOY8gFHdC6zdvozEEN5O2iYnuozbIJ6fSle+GCPFW2g/XlDAni1TvqX5ed65oDRYxGaF9atW9ZiZJGZSVkGEP6hWOMDYl0on3jTsdmBY54ss4H4zYqb1OwgldQhSeOI70Uh53ut+M=MIICGDCCAYECBFKeBP8wDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgMBVNw -YWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1kZW1v -MB4XDTEzMTIwMzE2MjExOVoXDTIzMTIwMTE2MjExOVowUzELMAkGA1UEBhMCRVMxDjAMBgNVBAgM -BVNwYWluMQ8wDQYDVQQHDAZNYWRyaWQxDjAMBgNVBAoMBUluZHJhMRMwEQYDVQQDDApsb2NhbC1k -ZW1vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuiK9M7zf3YgS0lsowvMm72QN+9Gx9UDja -Ykip2ZLpaV7d5J4FjLlXsJBEL8V3IwJrFrbpbe8yZCNx9Y5p7fUYBopv9Wa2Y54FNUPQ6FjPOw7/ -525KdwY2Addrk74bITfs6U03q+TWQmzGVObFOeKR36dHXZTPDZpqJ3uxqODUXQIDAQABMA0GCSqG -SIb3DQEBBQUAA4GBAEjNnqCaWVDBsN3trKmaNuB6chqXa6UvBMJiDDlXScnRsT8vKydynu+IJKtr -y9tWuegMoEnsezvv5hBoGRYGFuKJ9vDdVXfwcUI/Gd0ec55QGqg9veN9aZEIeWfU7lJnhdgMdRVG -1CMYDZxNo4Kpytc5gSKwZExmuwiQrw34ras1urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file +http://C-PEPS.gov.xxyMOVS1T/yRiVh3L6IBM9rR9Ie3w=d8e/RyNNPmnHRIzTIuRSnW6B60oWGBGxjRua/HvNxTuod0qSarYJxEedhY9Wl1Z9WYXlry28FuKjp3DA3HhzNaVd7A7QpFqNC4dnizSVWFjxlhmoE/Uv3Y/ha9P/fk6nbtHCSKW4kHSX7QfFLeggcLmUG0IULRF8UmRdQ0WerCl0aSZZeSp8J3LsFBPeWCRSwXgfiLn+RehggzZmQU6g0ssxrpnsYEAtjAiOli+YVQGuumsZGaJ8zHA/DgJ2FTGovNUyfuSUFLhd9nLlSqFs2Avnx0Ck7Q1dxDO5truOm6e285YLHqLaGdetFyPQAj/Z4w4RJ5u5X6d7rhBjTfRAAw==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==urn:oasis:names:tc:SAML:2.0:status:Successhttp://C-PEPS.gov.xxurn:oasis:names:tc:SAML:1.1:nameid-format:unspecifiedhttp://S-PEPS.gov.xx16/12/2008105IS10GudrunartunReykjavikvalue3value4value1value21618123456789IS \ No newline at end of file -- cgit v1.2.3 From 133f63cef5bffb06e57896a1e83383a414d932df Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Sun, 26 Jan 2014 17:01:41 +0100 Subject: attribute name handling is more samlengine like --- .../stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'id/server/stork2-saml-engine/src/test') 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 index 0a28a5de8..f8fc4f91a 100644 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml @@ -87,5 +87,7 @@ http://www.stork.gov.eu/1.0/newAttribute2 http://www.stork.gov.eu/1.0/hasDegree http://www.stork.gov.eu/1.0/mandateContent + http://www.stork.gov.eu/1.0/representative + http://www.stork.gov.eu/1.0/represented \ No newline at end of file -- cgit v1.2.3 From 85a983b556baaaa45ea79a4da232a1a72d323708 Mon Sep 17 00:00:00 2001 From: Florian Reimair Date: Wed, 29 Jan 2014 15:13:42 +0100 Subject: enhanced samlengine for floating config location --- .../src/test/resources/SamlEngine.xml | 6 +- .../src/test/resources/SignModule_demo.xml | 12 --- .../src/test/resources/SignModule_outgoing.xml | 12 +++ .../src/test/resources/StorkSamlEngine_demo.xml | 93 ---------------------- .../test/resources/StorkSamlEngine_outgoing.xml | 93 ++++++++++++++++++++++ 5 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml delete mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml create mode 100644 id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml (limited to 'id/server/stork2-saml-engine/src/test') diff --git a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml index d9dcb34f8..48fd9adff 100644 --- a/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml +++ b/id/server/stork2-saml-engine/src/test/resources/SamlEngine.xml @@ -3,10 +3,10 @@ - + - + @@ -14,7 +14,7 @@ - + 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 deleted file mode 100644 index c7cee3af4..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/SignModule_demo.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - SWModule sign with JKS. - projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks - local-demo - local-demo - CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES - 4BA89DB2 - JKS - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml b/id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml new file mode 100644 index 000000000..c7cee3af4 --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/SignModule_outgoing.xml @@ -0,0 +1,12 @@ + + + + + SWModule sign with JKS. + projects/stork2/code/moa-idspss/id/server/stork2-saml-engine/src/test/resources/storkDemoKeys.jks + local-demo + local-demo + CN=local-demo-cert, O=Indra, L=Madrid, ST=Spain, C=ES + 4BA89DB2 + JKS + \ 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 deleted file mode 100644 index f8fc4f91a..000000000 --- a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_demo.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - SAML constants for AuthnRequests and Responses. - - - unspecified - - - obtained - - - entity - - - - HTTP-POST - - - - - - - - - - false - - - true - - - http://S-PEPS.gov.xx - - - http://C-PEPS.gov.xx - - - 300 - - - false - - - - http://www.stork.gov.eu/1.0/eIdentifier - http://www.stork.gov.eu/1.0/givenName - http://www.stork.gov.eu/1.0/surname - http://www.stork.gov.eu/1.0/inheritedFamilyName - http://www.stork.gov.eu/1.0/adoptedFamilyName - http://www.stork.gov.eu/1.0/gender - http://www.stork.gov.eu/1.0/dateOfBirth - http://www.stork.gov.eu/1.0/countryCodeOfBirth - http://www.stork.gov.eu/1.0/nationalityCode - http://www.stork.gov.eu/1.0/maritalStatus - http://www.stork.gov.eu/1.0/residenceAddress - http://www.stork.gov.eu/1.0/eMail - http://www.stork.gov.eu/1.0/academicTitle - http://www.stork.gov.eu/1.0/pseudonym - http://www.stork.gov.eu/1.0/age - http://www.stork.gov.eu/1.0/isAgeOver - - http://www.stork.gov.eu/1.0/textResidenceAddress - http://www.stork.gov.eu/1.0/canonicalResidenceAddress - - http://www.stork.gov.eu/1.0/title - http://www.stork.gov.eu/1.0/residencePermit - - http://www.stork.gov.eu/1.0/signedDoc - http://www.stork.gov.eu/1.0/citizen509Certificate - - http://www.stork.gov.eu/1.0/newAttribute1 - http://www.stork.gov.eu/1.0/newAttribute2 - http://www.stork.gov.eu/1.0/hasDegree - http://www.stork.gov.eu/1.0/mandateContent - http://www.stork.gov.eu/1.0/representative - http://www.stork.gov.eu/1.0/represented - - \ No newline at end of file diff --git a/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml new file mode 100644 index 000000000..f8fc4f91a --- /dev/null +++ b/id/server/stork2-saml-engine/src/test/resources/StorkSamlEngine_outgoing.xml @@ -0,0 +1,93 @@ + + + + + SAML constants for AuthnRequests and Responses. + + + unspecified + + + obtained + + + entity + + + + HTTP-POST + + + + + + + + + + false + + + true + + + http://S-PEPS.gov.xx + + + http://C-PEPS.gov.xx + + + 300 + + + false + + + + http://www.stork.gov.eu/1.0/eIdentifier + http://www.stork.gov.eu/1.0/givenName + http://www.stork.gov.eu/1.0/surname + http://www.stork.gov.eu/1.0/inheritedFamilyName + http://www.stork.gov.eu/1.0/adoptedFamilyName + http://www.stork.gov.eu/1.0/gender + http://www.stork.gov.eu/1.0/dateOfBirth + http://www.stork.gov.eu/1.0/countryCodeOfBirth + http://www.stork.gov.eu/1.0/nationalityCode + http://www.stork.gov.eu/1.0/maritalStatus + http://www.stork.gov.eu/1.0/residenceAddress + http://www.stork.gov.eu/1.0/eMail + http://www.stork.gov.eu/1.0/academicTitle + http://www.stork.gov.eu/1.0/pseudonym + http://www.stork.gov.eu/1.0/age + http://www.stork.gov.eu/1.0/isAgeOver + + http://www.stork.gov.eu/1.0/textResidenceAddress + http://www.stork.gov.eu/1.0/canonicalResidenceAddress + + http://www.stork.gov.eu/1.0/title + http://www.stork.gov.eu/1.0/residencePermit + + http://www.stork.gov.eu/1.0/signedDoc + http://www.stork.gov.eu/1.0/citizen509Certificate + + http://www.stork.gov.eu/1.0/newAttribute1 + http://www.stork.gov.eu/1.0/newAttribute2 + http://www.stork.gov.eu/1.0/hasDegree + http://www.stork.gov.eu/1.0/mandateContent + http://www.stork.gov.eu/1.0/representative + http://www.stork.gov.eu/1.0/represented + + \ No newline at end of file -- cgit v1.2.3