diff options
author | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2014-01-21 14:38:35 +0100 |
---|---|---|
committer | Florian Reimair <florian.reimair@iaik.tugraz.at> | 2014-01-27 16:38:56 +0100 |
commit | 9cb68043945f53246928443cea723b58ee2b1c24 (patch) | |
tree | c612cb928452d27d6fc5e3014d5f044fac643b22 /id/server/stork2-saml-engine/build/classes/test/java | |
parent | 6c7a6f8e222e4fb39a11c220b63e785f2037d428 (diff) | |
download | moa-id-spss-9cb68043945f53246928443cea723b58ee2b1c24.tar.gz moa-id-spss-9cb68043945f53246928443cea723b58ee2b1c24.tar.bz2 moa-id-spss-9cb68043945f53246928443cea723b58ee2b1c24.zip |
updated samlengine
Diffstat (limited to 'id/server/stork2-saml-engine/build/classes/test/java')
26 files changed, 0 insertions, 4355 deletions
diff --git a/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/.svn/all-wcprops deleted file mode 100644 index 56c8ee113..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/.svn/entries deleted file mode 100644 index ca124ed28..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/all-wcprops deleted file mode 100644 index e00b13d5a..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/.svn/entries deleted file mode 100644 index cc3e19816..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/all-wcprops deleted file mode 100644 index ac0852630..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/.svn/entries deleted file mode 100644 index 66d2ea82a..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/all-wcprops deleted file mode 100644 index 5555d11e2..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/.svn/entries deleted file mode 100644 index e20bc1c1d..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/all-wcprops deleted file mode 100644 index ee98ec5bd..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/test/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/.svn/entries deleted file mode 100644 index a7074362f..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/all-wcprops deleted file mode 100644 index 063e2de18..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/entries deleted file mode 100644 index 0fbc1b254..000000000 --- a/id/server/stork2-saml-engine/build/classes/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/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SSETestUtils.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/SimpleBaseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryRequestTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- pal.add(isAgeOver);
-
- final PersonalAttribute dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- pal.add(dateOfBirth);
-
- final PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- eIDNumber.setValue(Arrays.asList("ES/IS/1234567890"));
- pal.add(eIDNumber);
-
- final PersonalAttribute givenName = new PersonalAttribute();
- givenName.setName("givenName");
- givenName.setIsRequired(true);
- givenName.setValue(Arrays.asList("Sveinbjorn"));
- pal.add(givenName);
-
- destination = "http://A-PEPS.gov.xx/PEPS/AttributeColleagueRequest";
- //assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
-
- }
-
- /** The destination. */
- private String destination;
-
- /** The service provider sector. */
- private String spSector;
-
- /** The service provider institution. */
- private String spInstitution;
-
- /** The service provider application. */
- private String spApplication;
-
- /** The service provider country. */
- private String spCountry;
-
- /** The service provider id. */
- private String spId;
-
- /** The quality authentication assurance level. */
- private static final int QAAL = 3;
-
- /** The List of Personal Attributes. */
- private IPersonalAttributeList pal;
-
- /** The attribute query request. */
- private static byte[] attrRequest;
-
- /** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(StorkAttrQueryRequestTest.class.getName());
-
- /** Parser manager used to parse XML. */
- private static BasicParserPool parser;
-
- static {
- parser = new BasicParserPool();
- parser.setNamespaceAware(true);
- }
-
- /**
- * Test generate authentication request.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAttrQueryRequest() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // new parameters
- request.setEIDSectorShare(false);
- request.setEIDCrossSectorShare(false);
- request.setEIDCrossBorderShare(false);
-
- STORKAttrQueryRequest req1 = engine0.generateSTORKAttrQueryRequest(request);
- byte[] reqByte = req1.getTokenSaml();
- FileOutputStream output = null;
-
- try {
- output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml"));
- output.write(reqByte);
- } catch (Exception e) {
- e.printStackTrace();
- throw new STORKSAMLEngineException(e);
- } finally {
- try { output.close(); } catch (Exception e) { throw new STORKSAMLEngineException(e); }
- }
-
-
-
-
- LOG.info("STORKAttrQueryRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
-
- request.setCitizenCountryCode("IS");
- LOG.info("STORKAttrQueryRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAttrQueryRequest(request).getTokenSaml()));
- }
-
- /**
- * Test generate authentication request error personal attribute name error.
- */
- @Test
- public final void testGenerateAttrQueryRequestPALsErr1() {
-
- final IPersonalAttributeList palWrong = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("attrNotValid");
- worngAttr.setIsRequired(true);
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(palWrong);
-
- // news parameters
- request.setEIDSectorShare(false);
- request.setEIDCrossSectorShare(false);
- request.setEIDCrossBorderShare(false);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
-
- /**
- * Test generate authentication request error personal attribute value error.
- */
- @Test
- public final void testGenerateAttrQueryRequestPALsErr2() {
-
- final IPersonalAttributeList palWrong = new PersonalAttributeList();
-
- final PersonalAttribute attrNotValid = new PersonalAttribute();
- attrNotValid.setName("attrNotValid");
- attrNotValid.setIsRequired(true);
- palWrong.add(attrNotValid);
-
-
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(palWrong);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request authentication assurance level
- * negative value.
- */
- @Test
- public final void testGenerateAttrQueryRequestQaalErr1() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(-1);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request service provider sector null.
- */
- @Test
- public final void testGenerateAttrQueryRequestSectorErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(null);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
-
- }
- }
-
- /**
- * Test generate authentication request service provider institution null.
- */
- @Test
- public final void testGenerateAttrQueryRequestInstitutionrErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(null);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test generate authentication request service provider application null.
- */
- @Test
- public final void testGenerateAttrQueryRequestApplicationErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(null);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test generate authentication request service provider country null.
- */
- @Test
- public final void testGenerateAttrQueryRequestCountryErr() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(null);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test generate authentication request error with quality authentication
- * assurance level wrong.
- */
- @Test
- public final void testGenerateAttrQueryRequestQaalErr2() {
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(0);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request personal attribute list null value.
- */
- @Test
- public final void testGenerateAttrQueryRequestPALErr1() {
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(null);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- engine.generateSTORKAttrQueryRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication request null parameter.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryRequestNullParam()
- throws STORKSAMLEngineException {
- try {
- engine.validateSTORKAttrQueryRequest(null);
- fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication request error bytes encode.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryRequestErrorEncode()
- throws STORKSAMLEngineException {
- try {
- engine.validateSTORKAttrQueryRequest("messageError".getBytes());
- fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication request.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryRequest() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- attrRequest = engine.generateSTORKAttrQueryRequest(request).getTokenSaml();
-
- final STORKAttrQueryRequest validatedRequest = engine.validateSTORKAttrQueryRequest(attrRequest);
-
- assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
- assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
- assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
-
- }
-
- /**
- * Test validate data authenticate request. Verified parameters after
- * validation.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateDataAttrQueryRequest() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = engine.validateSTORKAttrQueryRequest(attrRequest);
-
- assertEquals("Sestination incorrect: ", request.getDestination(), destination);
-
- assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false);
- assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false);
- assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false);
-
- assertEquals("QAAL incorrect: ", request.getQaa(), QAAL);
- assertEquals("SPSector incorrect: ", request.getSpSector(), spSector);
- assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null);
- assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication);
- assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), null);
-
- }
-
- /**
- * Test validate file attribute query request. Validate from XML file.
- *
- * @throws Exception the exception
- */
- @Test
- public final void testValidateFileAttrQueryRequest() throws Exception {
-
- final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequest.xml");
-
- try {
- engine.validateSTORKAttrQueryRequest(bytes);
- fail("testValidateFileAttrQueryRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
- }
- }
-
- /**
- * Test validate file authentication request tag delete.
- *
- * @throws Exception the exception
- */
- @Test
- public final void testValidateFileAttrRequestTagDelete() throws Exception {
-
- final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AttrQueryRequestTagDelete.xml");
-
- try {
- engine.validateSTORKAttrQueryRequest(bytes);
- fail("validateSTORKAttrQueryRequest(...) should have thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
-
- }
- }
-
- /**
- * Test validate authentication request not trusted token.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryRequestNotTrustedErr1()
- throws STORKSAMLEngineException {
-
- try {
- final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine
- .getInstance("CONF2");
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
-
- final byte[] authReqNotTrust = engineNotTrusted
- .generateSTORKAttrQueryRequest(request).getTokenSaml();
-
- engine.validateSTORKAttrQueryRequest(authReqNotTrust);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("validateSTORKAttrQueryRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test validate authentication request trusted.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryRequestTrusted()
- throws STORKSAMLEngineException {
-
- final STORKSAMLEngine engineTrusted = STORKSAMLEngine
- .getInstance("CONF3");
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
-
- final byte[] authReqNotTrust = engineTrusted.generateSTORKAttrQueryRequest(
- request).getTokenSaml();
-
- // engine ("CONF1") no have trust certificate from "CONF2"
- engine.validateSTORKAttrQueryRequest(authReqNotTrust);
-
- }
-
-
-
-
- /**
- * Test generate authentication request service provider application null.
- */
- @Test
- public final void testGenerateAttrQueryRequestNADA() {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- // news parameters
- request.setSpSector(null);
- request.setSpInstitution(null);
- request.setSpApplication(null);
- request.setSpCountry(null);
-
- try {
-
- engine.validateSTORKAttrQueryRequest(attrRequest);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test validate authentication request with unknown elements.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryRequestWithUnknownElements() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- final PersonalAttribute unknown = new PersonalAttribute();
- unknown.setName("unknown");
- unknown.setIsRequired(true);
- pAttList.add(unknown);
-
- final PersonalAttribute eIdentifier = new PersonalAttribute();
- eIdentifier.setName("eIdentifier");
- eIdentifier.setIsRequired(true);
- pAttList.add(eIdentifier);
-
- request.setPersonalAttributeList(pAttList);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- STORKAttrQueryRequest req = new STORKAttrQueryRequest();
-
- req = engine3.generateSTORKAttrQueryRequest(request);
-
- req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
-
- assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown"));
- assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier"));
-
- }
-
- /**
- * Test generate Request with required elements by default
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAttrQueryRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- final PersonalAttribute eIdentifier = new PersonalAttribute();
- eIdentifier.setName("eIdentifier");
- eIdentifier.setIsRequired(true);
- pAttList.add(eIdentifier);
-
- request.setPersonalAttributeList(pAttList);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- STORKAttrQueryRequest req = new STORKAttrQueryRequest();
- STORKAttrQueryRequest reqTrue = new STORKAttrQueryRequest();
- STORKAttrQueryRequest reqFalse = new STORKAttrQueryRequest();
-
- reqTrue = engine.generateSTORKAttrQueryRequest(request);
- reqFalse = engine2.generateSTORKAttrQueryRequest(request);
- req = engine3.generateSTORKAttrQueryRequest(request);
-
-
- String token = new String(req.getTokenSaml());
- String reqTrueToken = new String(reqTrue.getTokenSaml());
- String reqFalseToken = new String(reqFalse.getTokenSaml());
-
- assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired"));
- assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired"));
- assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired"));
-
- }
-
- /**
- * Test validating attribute query and getting alias used to save
- * the saml trusted certificate into trustore
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAtrrQueryRequestGettingItsAlias() throws STORKSAMLEngineException {
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
-
- request.setDestination(destination);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
-
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- final PersonalAttribute eIdentifier = new PersonalAttribute();
- eIdentifier.setName("eIdentifier");
- eIdentifier.setIsRequired(true);
- pAttList.add(eIdentifier);
-
- request.setPersonalAttributeList(pAttList);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- STORKAttrQueryRequest req = new STORKAttrQueryRequest();
-
- req = engine3.generateSTORKAttrQueryRequest(request);
- req = engine.validateSTORKAttrQueryRequest(req.getTokenSaml());
- assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
-
- req = engine2.generateSTORKAttrQueryRequest(request);
- req = engine2.validateSTORKAttrQueryRequest(req.getTokenSaml());
- assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
- }
-
-}
diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAttrQueryResponseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- pal.add(isAgeOver);
-
- PersonalAttribute dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- pal.add(dateOfBirth);
-
- PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- pal.add(eIDNumber);
-
- final PersonalAttribute givenName = new PersonalAttribute();
- givenName.setName("givenName");
- givenName.setIsRequired(true);
- pal.add(givenName);
-
- PersonalAttribute canRessAddress = new PersonalAttribute();
- canRessAddress.setName("canonicalResidenceAddress");
- canRessAddress.setIsRequired(true);
- pal.add(canRessAddress);
-
- PersonalAttribute newAttribute = new PersonalAttribute();
- newAttribute.setName("newAttribute2");
- newAttribute.setIsRequired(true);
- pal.add(newAttribute);
-
- destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
- assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
- spSector = "EDU001";
- spInstitution = "OXF001";
- spApplication = "APP001";
- spCountry = "EN";
-
- spId = "EDU001-APP001-APP001";
-
- final STORKAttrQueryRequest request = new STORKAttrQueryRequest();
- request.setDestination(destination);
- //request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- //request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("IS");
-
- try {
- attrQueryRequest = getEngine().generateSTORKAttrQueryRequest(request)
- .getTokenSaml();
-
- attrQueryenRequest = getEngine().validateSTORKAttrQueryRequest(attrQueryRequest);
-
- } catch (STORKSAMLEngineException e) {
- fail("Error create STORKAuthnRequest");
- }
-
- ipAddress = "111.222.333.444";
-
- destinationUrl = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
-
- pal = new PersonalAttributeList();
-
- isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- ages = new ArrayList<String>();
-
- ages.add("16");
- ages.add("18");
-
- isAgeOver.setValue(ages);
- isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- pal.add(isAgeOver);
-
- dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- final ArrayList<String> date = new ArrayList<String>();
- date.add("16/12/2008");
- dateOfBirth.setValue(date);
- dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- pal.add(dateOfBirth);
-
- eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- final ArrayList<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789IS");
- eIDNumber.setValue(idNumber);
- eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- pal.add(eIDNumber);
-
- canRessAddress = new PersonalAttribute();
- canRessAddress.setName("canonicalResidenceAddress");
- canRessAddress.setIsRequired(true);
- canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- final HashMap<String, String> address = new HashMap<String, String>();
-
- address.put("state", state);
- address.put("town", town);
- address.put("postalCode", postalCode);
- address.put("streetName", streetName);
- address.put("streetNumber", streetNumber);
-
- canRessAddress.setComplexValue(address);
- pal.add(canRessAddress);
-
- newAttribute = new PersonalAttribute();
- newAttribute.setName("newAttribute2");
- newAttribute.setIsRequired(true);
- newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- final HashMap<String, String> values = new HashMap<String, String>();
-
- values.put("value1", "value1");
- values.put("value2", "value2");
- values.put("value3", "value3");
- values.put("value4", "value4");
-
- newAttribute.setComplexValue(values);
- pal.add(newAttribute);
-
- }
-
- /**
- * Test generate attribute query request without errors.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAttrQueryResponse() throws STORKSAMLEngineException {
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(pal);
-
- final STORKAttrQueryResponse storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
- destinationUrl, isNotHashing);
-
- attrQueryResponse = storkResponse.getTokenSaml();
-
- FileOutputStream output = null;
-
- try {
- output = new FileOutputStream(new File(System.getProperty("user.dir") + "/src/test/resources/data/eu/stork/STORKSAMLEngine/AttrQueryResponse.xml"));
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- output.write(attrQueryResponse);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse));
-
-
- }
-
- /**
- * Test validation id parameter mandatory.
- */
- @Test
- public final void testResponseMandatoryId() {
- final String identifier = attrQueryenRequest.getSamlId();
- attrQueryenRequest.setSamlId(null);
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(pal);
-
- try {
- getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
- ipAddress, destinationUrl, isHashing);
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- attrQueryenRequest.setSamlId(identifier);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate attribute query response in response to err1.
- */
- @Test
- public final void testResponseMandatoryIssuer() {
-
- final String issuer = attrQueryenRequest.getIssuer();
- attrQueryenRequest.setIssuer(null);
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(pal);
-
- try {
- getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
- ipAddress, destinationUrl, isHashing);
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- attrQueryenRequest.setIssuer(issuer);
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test generate attribute query response assertion consumer null.
- */
- /*@Test
- public final void testResponseMandatoryAssertionConsumerServiceURL() {
- final String asserConsumerUrl = attrQueryenRequest
- .getAssertionConsumerServiceURL();
- attrQueryenRequest.setAssertionConsumerServiceURL(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
- try {
- getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
- ipAddress, isHashing);
- fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- attrQueryenRequest.setAssertionConsumerServiceURL(asserConsumerUrl);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate attribute query response IP address null.
- */
- @Test
- public final void testResponseValidationIP() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(pal);
-
- try {
- getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response, null,
- destinationUrl, isHashing);
- fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate attribute query response with personal attribute list null.
- */
- @Test
- public final void testResponseMandatoryPersonalAttributeList() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(null);
-
-
- try {
- getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest, response,
- ipAddress, destinationUrl, isHashing);
- fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate attribute query response token null.
- */
- @Test
- public final void testResponseInvalidParametersToken() {
- try {
- getEngine().validateSTORKAttrQueryResponse(null, ipAddress);
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate attribute query response IP null.
- */
- @Test
- public final void STORKAttrQueryResponse() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setPersonalAttributeList(pal);
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate attribute query response parameter name wrong.
- */
- @Test
- public final void testResponseInvalidParametersAttr() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("AttrWrong");
- wrongList.add(worngAttr);
-
-
- response.setPersonalAttributeList(wrongList);
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate attribute query response set null value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrSimpleValue() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("isAgeOver");
- worngAttr.setValue(null);
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate attribute query response set null value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrNoValue() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("isAgeOver");
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate attribute query response set null value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrNoName() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate attribute query response set null complex value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrComplexValue() {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("isAgeOver");
- worngAttr.setComplexValue(null);
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponse(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
-
-
- /**
- * Test validate attribute query response IP distinct and disabled validation
- * IP.
- */
- @Test
- public final void testResponseInvalidParametersIPDistinct() {
- try {
- // ipAddress origin "111.222.333.444"
- // ipAddrValidation = false
- // Subject Confirmation Bearer.
-
- getEngine().validateSTORKAttrQueryResponse(attrQueryResponse, "127.0.0.1");
- } catch (STORKSAMLEngineException e) {
- fail("validateAttributeQueryResponse(...) should've thrown an STORKSAMLEngineException!");
- LOG.error("Error");
- }
- }
-
- /**
- * Test response invalid parameters invalid token.
- */
- @Test
- public final void testResponseInvalidParametersTokenMsg() {
- try {
- // ipAddress origin "111.222.333.444"
- // Subject Confirmation Bearer.
- getEngine().validateSTORKAttrQueryResponse("errorMessage".getBytes(),
- ipAddress);
- fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate attribute query response is fail.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- /*@Test
- public final void testValidateAuthenticationResponseIsFail()
- throws STORKSAMLEngineException {
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
-
- assertFalse("Generate incorrect response: ", attrQeuryenResponse.isFail());
- }
-
- /**
- * Test validate attribute query response destination.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthenticationResponseDestination()
- throws STORKSAMLEngineException {
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
-
- assertEquals("Destination incorrect: ",
- attrQeuryenResponse.getInResponseTo(), attrQueryenRequest.getSamlId());
- }
-
- /**
- * Test validate attribute query response values.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthenticationResponseValuesComplex()
- throws STORKSAMLEngineException {
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
-
- assertEquals("Country incorrect:", attrQeuryenResponse.getCountry(), "ES");
-
- final Iterator<PersonalAttribute> iterator = attrQeuryenResponse
- .getPersonalAttributeList().iterator();
-
- while (iterator.hasNext()) {
- final PersonalAttribute attribute = iterator.next();
- if (attribute.getName().equalsIgnoreCase(
- "canonicalResidenceAddress")) {
- assertEquals("State incorrect: ", state, attribute
- .getComplexValue().get("state"));
- assertEquals("Town incorrect: ", town, attribute
- .getComplexValue().get("town"));
- assertEquals("Postal code incorrect: ", postalCode, attribute
- .getComplexValue().get("postalCode"));
- assertEquals("Street name incorrect: ", streetName, attribute
- .getComplexValue().get("streetName"));
- assertEquals("Street number incorrect: ", streetNumber,
- attribute.getComplexValue().get("streetNumber"));
- }
- }
- }
-
- /**
- * Test generate attribute query response fail in response to it's null.
- * @throws STORKSAMLEngineException
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test //( expected=STORKSAMLEngineException.class)
- public final void testGenerateAttrQueryResponseFailInResponseToNull() throws STORKSAMLEngineException {
- final String identifier = attrQueryenRequest.getSamlId();
- attrQueryenRequest.setSamlId(null);
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("");
-
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- attrQueryenRequest.setSamlId(identifier);
- LOG.error("Error");
- //throw new STORKSAMLEngineException(e);
- }
- }
-
- /**
- * Test generate attribute query response fail assertion consumer URL err1.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- /*@Test
- public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull()
- throws STORKSAMLEngineException {
-
- final String assertConsumerUrl = attrQueryenRequest
- .getAssertionConsumerServiceURL();
- attrQueryenRequest.setAssertionConsumerServiceURL(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("");
-
- try {
- attrQueryResponse = getEngine().generateSTORKAuthnResponseFail(attrQueryenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- attrQueryenRequest.setAssertionConsumerServiceURL(assertConsumerUrl);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate attribute query response fail code error err1.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAttrQueryResponseFailCodeErrorNull()
- throws STORKSAMLEngineException {
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setStatusCode(null);
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("");
-
- try {
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
- fail("generateAttrQueryResponseFail(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
-
-
- /**
- * Test generate attribute query request without errors.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryResponse() throws STORKSAMLEngineException {
-
- IPersonalAttributeList palist = new PersonalAttributeList();
-
- PersonalAttribute isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- ArrayList<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- palist.add(isAgeOver);
-
- PersonalAttribute dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- final ArrayList<String> date = new ArrayList<String>();
- date.add("16/12/2008");
- dateOfBirth.setValue(date);
- dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- palist.add(dateOfBirth);
-
-
- PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
-
- final ArrayList<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789PÑ");
-
- final HashMap<String, String> complex = new HashMap<String, String>();
- complex.put("one", "two");
-
- //eIDNumber.setValue(null);
- //eIDNumber.setValue(idNumber);
- //eIDNumber.setComplexValue(complex);
-
- eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString());
- palist.add(eIDNumber);
-
- PersonalAttribute canRessAddress = new PersonalAttribute();
- canRessAddress.setName("canonicalResidenceAddress");
- canRessAddress.setIsRequired(true);
- canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- final HashMap<String, String> address = new HashMap<String, String>();
-
- address.put("state", state);
- address.put("town", town);
- address.put("postalCode", postalCode);
- address.put("streetName", streetName);
- address.put("streetNumber", streetNumber);
-
- canRessAddress.setComplexValue(address);
- palist.add(canRessAddress);
-
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
-
- response.setPersonalAttributeList(palist);
-
- final STORKAttrQueryResponse storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
- destinationUrl, isNotHashing);
-
- attrQueryResponse = storkResponse.getTokenSaml();
- LOG.info("Request id: " + attrQueryenRequest.getSamlId());
-
- LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(attrQueryResponse));
-
-
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
-
- LOG.info("RESPONSE ID: " + attrQeuryenResponse.getSamlId());
- LOG.info("RESPONSE IN_RESPONSE_TO: " + attrQeuryenResponse.getInResponseTo());
- LOG.info("RESPONSE COUNTRY: " + attrQeuryenResponse.getCountry());
-
- }
-
-
-
-
-
- /**
- * Test validate attribute query response fail is fail.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAttrQueryResponseFailIsFail()
- throws STORKSAMLEngineException {
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
- response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("message");
-
- attrQueryResponse = getEngine().generateSTORKAttrQueryResponseFail(attrQueryenRequest,
- response, ipAddress, destinationUrl, isNotHashing).getTokenSaml();
-
- LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(attrQueryResponse));
-
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
-
- LOG.info("COUNTRY: " + attrQeuryenResponse.getCountry());
- assertTrue("Generate incorrect response: ", attrQeuryenResponse.isFail());
- }
-
- /**
- * Test generate/validate response with signedDoc
- *
- * @throws STORKSAMLEngineException
- * the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAttrQueryResponseWithSignedDoc()
- throws STORKSAMLEngineException {
-
- String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rfc:3275\">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48ZHM6U2lnbmF0dXJlIHhtbG5zOmRzPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwLzA5L3htbGRzaWcjIiBJZD0iU2lnbmF0dXJlLThlYWJkMGE1LTY2MGQtNGFmZC05OTA1LTBhYmM3NTUzZDE5Mi1TaWduYXR1cmUiPjxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvVFIvMjAwMS9SRUMteG1sLWMxNG4tMjAwMTAzMTUiLz48ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+PGRzOlJlZmVyZW5jZSBJZD0iUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyIgVHlwZT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI09iamVjdCIgVVJJPSIjT2JqZWN0LTk4NzMzY2RlLThi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GFzc2F0Z2UgZGUgbGEgQ29uY2VwY2lvIDExIDA4MDA4IEJhcmNlbG9uYSwgTz1BZ2VuY2lhIENhdGFsYW5hIGRlIENlcnRpZmljYWNpbyAoTklGIFEtMDgwMTE3Ni1JKSwgQz1FUzwvZHM6WDUwOUlzc3Vlck5hbWU+PGRzOlg1MDlTZXJpYWxOdW1iZXI+OTU1MDg8L2RzOlg1MDlTZXJpYWxOdW1iZXI+PC94YWRlczpJc3N1ZXJTZXJpYWw+PC94YWRlczpDZXJ0PjwveGFkZXM6U2lnbmluZ0NlcnRpZmljYXRlPjwveGFkZXM6U2lnbmVkU2lnbmF0dXJlUHJvcGVydGllcz48eGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PHhhZGVzOkRhdGFPYmplY3RGb3JtYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
-
- IPersonalAttributeList palist = new PersonalAttributeList();
-
- PersonalAttribute signedDoc = new PersonalAttribute();
- signedDoc.setName("signedDoc");
- signedDoc.setIsRequired(false);
- ArrayList<String> signed = new ArrayList<String>();
- signed.add(signedDocResponse);
- signedDoc.setValue(signed);
- palist.add(signedDoc);
-
- PersonalAttribute isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(false);
- ArrayList<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- palist.add(isAgeOver);
-
- attrQueryenRequest.setPersonalAttributeList(palist);
-
- final STORKAttrQueryResponse response = new STORKAttrQueryResponse();
-
- response.setPersonalAttributeList(palist);
-
- final STORKAttrQueryResponse storkResponse = getEngine()
- .generateSTORKAttrQueryResponse(attrQueryenRequest, response, ipAddress,
- destinationUrl, isNotHashing);
-
- attrQueryResponse = storkResponse.getTokenSaml();
- attrQeuryenResponse = getEngine().validateSTORKAttrQueryResponse(attrQueryResponse,
- ipAddress);
-
- assertTrue("SignedDoc response should be the same: ", attrQeuryenResponse
- .getPersonalAttributeList().get("signedDoc").getValue().get(0)
- .equals(signedDocResponse));
-
- }
-}
diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkAuthRequestTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- pal.add(isAgeOver);
-
- final PersonalAttribute dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- pal.add(dateOfBirth);
-
- final PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- pal.add(eIDNumber);
-
- destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
- assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
-
- spName = "University of Oxford";
- spSector = "EDU001";
- spInstitution = "OXF001";
- spApplication = "APP001";
- spCountry = "EN";
-
- spId = "EDU001-OXF001-APP001";
-
- }
-
- /** The destination. */
- private String destination;
-
- /** The service provider name. */
- private String spName;
-
- /** The service provider sector. */
- private String spSector;
-
- /** The service provider institution. */
- private String spInstitution;
-
- /** The service provider application. */
- private String spApplication;
-
- /** The service provider country. */
- private String spCountry;
-
- /** The service provider id. */
- private String spId;
-
- /** The quality authentication assurance level. */
- private static final int QAAL = 3;
-
- /** The List of Personal Attributes. */
- private IPersonalAttributeList pal;
-
- /** The assertion consumer URL. */
- private String assertConsumerUrl;
-
- /** The authentication request. */
- private static byte[] authRequest;
-
- /** The Constant LOG. */
- private static final Logger LOG = LoggerFactory
- .getLogger(StorkAuthRequestTest.class.getName());
-
- /** Parser manager used to parse XML. */
- private static BasicParserPool parser;
-
- static {
- parser = new BasicParserPool();
- parser.setNamespaceAware(true);
- }
-
- /**
- * Test generate authentication request.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnRequest() throws STORKSAMLEngineException {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- //engine.generateSTORKAuthnRequest(request);
-
- LOG.info("STORKAuthnRequest 1: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml()));
- request.setCitizenCountryCode("ES");
- LOG.info("STORKAuthnRequest 2: " + SSETestUtils.encodeSAMLToken(engine.generateSTORKAuthnRequest(request).getTokenSaml()));
- }
-
-
- /**
- * Test generate authentication request error personal attribute name error.
- */
- @Test
- public final void testGenerateAuthnRequestPALsErr1() {
-
- final IPersonalAttributeList palWrong = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("attrNotValid");
- worngAttr.setIsRequired(true);
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(palWrong);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
-
- /**
- * Test generate authentication request error personal attribute value error.
- */
- @Test
- public final void testGenerateAuthnRequestPALsErr2() {
-
- final IPersonalAttributeList palWrong = new PersonalAttributeList();
-
- final PersonalAttribute attrNotValid = new PersonalAttribute();
- attrNotValid.setName("attrNotValid");
- attrNotValid.setIsRequired(true);
- palWrong.add(attrNotValid);
-
-
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(palWrong);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request error provider name null.
- */
- @Test
- public final void testGenerateAuthnRequestSPNAmeErr1() {
-
-
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(null);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try
- {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- catch (STORKSAMLEngineException e)
- {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request authentication assurance level
- * negative value.
- */
- @Test
- public final void testGenerateAuthnRequestQaalErr1() {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(-1);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
-
- try {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request service provider sector null.
- */
- @Test
- public final void testGenerateAuthnRequestSectorErr() {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(null);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
-
- }
- }
-
- /**
- * Test generate authentication request service provider institution null.
- */
- @Test
- public final void testGenerateAuthnRequestInstitutionrErr() {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(null);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test generate authentication request service provider application null.
- */
- @Test
- public final void testGenerateAuthnRequestApplicationErr() {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(null);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test generate authentication request service provider country null.
- */
- @Test
- public final void testGenerateAuthnRequestCountryErr() {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(null);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test generate authentication request error with quality authentication
- * assurance level wrong.
- */
- @Test
- public final void testGenerateAuthnRequestQaalErr2() {
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(0);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request personal attribute list null value.
- */
- @Test
- public final void testGenerateAuthnRequestPALErr1() {
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(null);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication request error with assertion consumer URL
- * null.
- */
- @Test
- public final void testGenerateAuthnRequestAssertionConsumerErr1() {
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(null);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- engine.generateSTORKAuthnRequest(request);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication request null parameter.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequestNullParam()
- throws STORKSAMLEngineException {
- try {
- engine.validateSTORKAuthnRequest(null);
- fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication request error bytes encode.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequestErrorEncode()
- throws STORKSAMLEngineException {
- try {
- engine.validateSTORKAuthnRequest("messageError".getBytes());
- fail("validateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication request.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequest() throws STORKSAMLEngineException {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- authRequest = engine.generateSTORKAuthnRequest(request).getTokenSaml();
-
- final STORKAuthnRequest validatedRequest = engine.validateSTORKAuthnRequest(authRequest);
-
- assertEquals("CrossBorderShare incorrect: ", validatedRequest.isEIDCrossBorderShare(), false);
- assertEquals("CrossSectorShare incorrect: ", validatedRequest.isEIDCrossSectorShare(), false);
- assertEquals("SectorShare incorrect: ", validatedRequest.isEIDSectorShare(), false);
-
- }
-
- /**
- * Test validate data authenticate request. Verified parameters after
- * validation.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateDataAuthnRequest() throws STORKSAMLEngineException {
-
- final STORKAuthnRequest request = engine.validateSTORKAuthnRequest(authRequest);
-
- assertEquals("Sestination incorrect: ", request.getDestination(), destination);
-
- assertEquals("CrossBorderShare incorrect: ", request.isEIDCrossBorderShare(), false);
- assertEquals("CrossSectorShare incorrect: ", request.isEIDCrossSectorShare(), false);
- assertEquals("SectorShare incorrect: ", request.isEIDSectorShare(), false);
-
- assertEquals("Service provider incorrect: ", request.getProviderName(), spName);
- assertEquals("QAAL incorrect: ", request.getQaa(), QAAL);
- assertEquals("SPSector incorrect: ", request.getSpSector(), spSector);
- assertEquals("SPInstitution incorrect: ", request.getSpInstitution(), null);
- assertEquals("SPApplication incorrect: ", request.getSpApplication(), spApplication);
- assertEquals("Asserition consumer URL incorrect: ", request.getAssertionConsumerServiceURL(), assertConsumerUrl);
-
- assertEquals("SP Country incorrect: ", request.getSpCountry(), spCountry);
- assertEquals("SP Id incorrect: ", request.getSPID(), spId);
- assertEquals("CitizenCountryCode incorrect: ", request.getCitizenCountryCode(), "ES");
-
- }
-
- /**
- * Test validate file authentication request. Validate from XML file.
- *
- * @throws Exception the exception
- */
- @Test
- public final void testValidateFileAuthnRequest() throws Exception {
-
- final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequest.xml");
-
- try {
- engine.validateSTORKAuthnRequest(bytes);
- fail("testValidateFileAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
- }
- }
-
- /**
- * Test validate file authentication request tag delete.
- *
- * @throws Exception the exception
- */
- @Test
- public final void testValidateFileAuthnRequestTagDelete() throws Exception {
-
- final byte[] bytes = SSETestUtils.readStorkSamlFromFile("/data/eu/stork/STORKSAMLEngine/AuthnRequestTagDelete.xml");
-
- try {
- engine.validateSTORKAuthnRequest(bytes);
- fail("validateSTORKAuthnRequest(...) should have thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error(e.getMessage());
-
- }
- }
-
- /**
- * Test validate authentication request not trusted token.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequestNotTrustedErr1()
- throws STORKSAMLEngineException {
-
- try {
- final STORKSAMLEngine engineNotTrusted = STORKSAMLEngine
- .getInstance("CONF2");
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
-
- final byte[] authReqNotTrust = engineNotTrusted
- .generateSTORKAuthnRequest(request).getTokenSaml();
-
- engine.validateSTORKAuthnRequest(authReqNotTrust);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- fail("validateSTORKAuthnRequestNotTrusted(...) should not have thrown an STORKSAMLEngineException!");
- }
- }
-
- /**
- * Test validate authentication request trusted.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequestTrusted()
- throws STORKSAMLEngineException {
-
- final STORKSAMLEngine engineTrusted = STORKSAMLEngine
- .getInstance("CONF3");
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
-
- final byte[] authReqNotTrust = engineTrusted.generateSTORKAuthnRequest(
- request).getTokenSaml();
-
- // engine ("CONF1") no have trust certificate from "CONF2"
- engine.validateSTORKAuthnRequest(authReqNotTrust);
-
- }
-
- /**
- * Test generate authentication request service provider application null.
- */
- @Test
- public final void testGenerateAuthnRequestNADA() {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(null);
- request.setSpInstitution(null);
- request.setSpApplication(null);
- request.setSpCountry(null);
-
- try {
- engine.validateSTORKAuthnRequest(authRequest);
- fail("generateSTORKAuthnRequest(...) should've thrown an STORKSAMLEngineException!");
-
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error: " + e.getMessage());
- }
- }
-
- /**
- * Test validate authentication request with unknown elements.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequestWithUnknownElements() throws STORKSAMLEngineException {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- final PersonalAttribute unknown = new PersonalAttribute();
- unknown.setName("unknown");
- unknown.setIsRequired(true);
- pAttList.add(unknown);
-
- final PersonalAttribute eIdentifier = new PersonalAttribute();
- eIdentifier.setName("eIdentifier");
- eIdentifier.setIsRequired(true);
- pAttList.add(eIdentifier);
-
- request.setPersonalAttributeList(pAttList);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- STORKAuthnRequest req = new STORKAuthnRequest();
-
- req = engine3.generateSTORKAuthnRequest(request);
-
- req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
-
- assertNull("The value shouldn't exist", req.getPersonalAttributeList().get("unknown"));
- assertNotNull("The value should exist", req.getPersonalAttributeList().get("eIdentifier"));
-
- }
-
- /**
- * Test generate Request with required elements by default
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnRequestWithIsRequiredElementsByDefault() throws STORKSAMLEngineException {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- final PersonalAttribute eIdentifier = new PersonalAttribute();
- eIdentifier.setName("eIdentifier");
- eIdentifier.setIsRequired(true);
- pAttList.add(eIdentifier);
-
- request.setPersonalAttributeList(pAttList);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- STORKAuthnRequest req = new STORKAuthnRequest();
- STORKAuthnRequest reqTrue = new STORKAuthnRequest();
- STORKAuthnRequest reqFalse = new STORKAuthnRequest();
-
- reqTrue = engine.generateSTORKAuthnRequest(request);
- reqFalse = engine2.generateSTORKAuthnRequest(request);
- req = engine3.generateSTORKAuthnRequest(request);
-
-
- String token = new String(req.getTokenSaml());
- String reqTrueToken = new String(reqTrue.getTokenSaml());
- String reqFalseToken = new String(reqFalse.getTokenSaml());
-
- assertTrue("The token must contain the chain 'isRequired'", token.contains("isRequired"));
- assertTrue("The token must contain the chain 'isRequired'", reqTrueToken.contains("isRequired"));
- assertFalse("The token must contain the chain 'isRequired'", reqFalseToken.contains("isRequired"));
-
- }
-
- /**
- * Test validating request and getting alias used to save
- * the saml trusted certificate into trustore
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnRequestGettingItsAlias() throws STORKSAMLEngineException {
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- IPersonalAttributeList pAttList = new PersonalAttributeList();
-
- final PersonalAttribute eIdentifier = new PersonalAttribute();
- eIdentifier.setName("eIdentifier");
- eIdentifier.setIsRequired(true);
- pAttList.add(eIdentifier);
-
- request.setPersonalAttributeList(pAttList);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- STORKAuthnRequest req = new STORKAuthnRequest();
-
- req = engine3.generateSTORKAuthnRequest(request);
- req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
- assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
-
- req = engine2.generateSTORKAuthnRequest(request);
- req = engine2.validateSTORKAuthnRequest(req.getTokenSaml());
- assertTrue("The alias should match this value", req.getAlias().equals("local-demo"));
-
-
-
- }
-
- /**
- * Test generating/validating request with signedDoc
- *
- * @throws STORKSAMLEngineException
- * the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnRequestWithSignedDoc()
- throws STORKSAMLEngineException {
-
- String signedDocRequest = "<dss:SignRequest xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"_d96b62a87d18f1095170c1f44c90b5fd\"><dss:InputDocuments><dss:Document><dss:Base64Data MimeType=\"text/plain\">VGVzdCB0ZXh0</dss:Base64Data></dss:Document></dss:InputDocuments></dss:SignRequest>";
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
-
- PersonalAttributeList paler = new PersonalAttributeList();
-
- final PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- paler.add(eIDNumber);
-
- final PersonalAttribute isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- final ArrayList<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- paler.add(isAgeOver);
-
- final PersonalAttribute signedDoc = new PersonalAttribute();
- signedDoc.setName("signedDoc");
- final ArrayList<String> signedDocs = new ArrayList<String>();
- signedDocs.add(signedDocRequest);
- signedDoc.setValue(signedDocs);
- signedDoc.setIsRequired(false);
- paler.add(signedDoc);
-
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(paler);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // new parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- STORKAuthnRequest req = new STORKAuthnRequest();
-
- req = engine.generateSTORKAuthnRequest(request);
- req = engine.validateSTORKAuthnRequest(req.getTokenSaml());
-
- assertTrue("SignedDoc request should be the same: ", req
- .getPersonalAttributeList().get("signedDoc").getValue().get(0)
- .equals(signedDocRequest));
-
-
- }
-
-}
diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/StorkResponseTest.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- pal.add(isAgeOver);
-
- PersonalAttribute dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- pal.add(dateOfBirth);
-
- PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- pal.add(eIDNumber);
-
- final PersonalAttribute givenName = new PersonalAttribute();
- givenName.setName("givenName");
- givenName.setIsRequired(true);
- pal.add(givenName);
-
- PersonalAttribute canRessAddress = new PersonalAttribute();
- canRessAddress.setName("canonicalResidenceAddress");
- canRessAddress.setIsRequired(true);
- pal.add(canRessAddress);
-
- PersonalAttribute newAttribute = new PersonalAttribute();
- newAttribute.setName("newAttribute2");
- newAttribute.setIsRequired(true);
- pal.add(newAttribute);
-
- destination = "http://C-PEPS.gov.xx/PEPS/ColleagueRequest";
- assertConsumerUrl = "http://S-PEPS.gov.xx/PEPS/ColleagueResponse";
- spName = "University Oxford";
-
- spName = "University of Oxford";
- spSector = "EDU001";
- spInstitution = "OXF001";
- spApplication = "APP001";
- spCountry = "EN";
-
- spId = "EDU001-APP001-APP001";
-
- final STORKAuthnRequest request = new STORKAuthnRequest();
- request.setDestination(destination);
- request.setProviderName(spName);
- request.setQaa(QAAL);
- request.setPersonalAttributeList(pal);
- request.setAssertionConsumerServiceURL(assertConsumerUrl);
-
- // news parameters
- request.setSpSector(spSector);
- request.setSpInstitution(spInstitution);
- request.setSpApplication(spApplication);
- request.setSpCountry(spCountry);
- request.setSPID(spId);
- request.setCitizenCountryCode("ES");
-
- try {
- authRequest = getEngine().generateSTORKAuthnRequest(request)
- .getTokenSaml();
-
- authenRequest = getEngine().validateSTORKAuthnRequest(authRequest);
-
- } catch (STORKSAMLEngineException e) {
- fail("Error create STORKAuthnRequest");
- }
-
- ipAddress = "111.222.333.444";
-
- pal = new PersonalAttributeList();
-
- isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- ages = new ArrayList<String>();
-
- ages.add("16");
- ages.add("18");
-
- isAgeOver.setValue(ages);
- isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- pal.add(isAgeOver);
-
- dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- final ArrayList<String> date = new ArrayList<String>();
- date.add("16/12/2008");
- dateOfBirth.setValue(date);
- dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- pal.add(dateOfBirth);
-
- eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
- final ArrayList<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789PÑ");
- eIDNumber.setValue(idNumber);
- eIDNumber.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- pal.add(eIDNumber);
-
- canRessAddress = new PersonalAttribute();
- canRessAddress.setName("canonicalResidenceAddress");
- canRessAddress.setIsRequired(true);
- canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- final HashMap<String, String> address = new HashMap<String, String>();
-
- address.put("state", state);
- address.put("municipalityCode", municipalityCode);
- address.put("town", town);
- address.put("postalCode", postalCode);
- address.put("streetName", streetName);
- address.put("streetNumber", streetNumber);
- address.put("apartamentNumber", apartamentNumber);
-
- canRessAddress.setComplexValue(address);
- pal.add(canRessAddress);
-
- newAttribute = new PersonalAttribute();
- newAttribute.setName("newAttribute2");
- newAttribute.setIsRequired(true);
- newAttribute.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- final HashMap<String, String> values = new HashMap<String, String>();
-
- values.put("value1", "value1");
- values.put("value2", "value2");
- values.put("value3", "value3");
- values.put("value4", "value4");
-
- newAttribute.setComplexValue(values);
- pal.add(newAttribute);
-
- }
-
- /**
- * Test generate authentication request without errors.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnResponse() throws STORKSAMLEngineException {
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
-
- final STORKAuthnResponse storkResponse = getEngine()
- .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
- isNotHashing);
-
- authResponse = storkResponse.getTokenSaml();
-
- LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse));
- }
-
- /**
- * Test validation id parameter mandatory.
- */
- @Test
- public final void testResponseMandatoryId() {
- final String identifier = authenRequest.getSamlId();
- authenRequest.setSamlId(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
-
- try {
- getEngine().generateSTORKAuthnResponse(authenRequest, response,
- ipAddress, isHashing);
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- authenRequest.setSamlId(identifier);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication response in response to err1.
- */
- @Test
- public final void testResponseMandatoryIssuer() {
-
- final String issuer = authenRequest.getIssuer();
- authenRequest.setIssuer(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
-
- try {
- getEngine().generateSTORKAuthnResponse(authenRequest, response,
- ipAddress, isHashing);
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- authenRequest.setIssuer(issuer);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication response assertion consumer null.
- */
- @Test
- public final void testResponseMandatoryAssertionConsumerServiceURL() {
- final String asserConsumerUrl = authenRequest
- .getAssertionConsumerServiceURL();
- authenRequest.setAssertionConsumerServiceURL(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
- try {
- getEngine().generateSTORKAuthnResponse(authenRequest, response,
- ipAddress, isHashing);
- fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- authenRequest.setAssertionConsumerServiceURL(asserConsumerUrl);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication response IP address null.
- */
- @Test
- public final void testResponseValidationIP() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
-
- try {
- getEngine().generateSTORKAuthnResponse(authenRequest, response, null,
- isHashing);
- fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication response with personal attribute list null.
- */
- @Test
- public final void testResponseMandatoryPersonalAttributeList() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(null);
-
-
- try {
- getEngine().generateSTORKAuthnResponse(authenRequest, response,
- ipAddress, isHashing);
- fail("generateAuthnResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication response token null.
- */
- @Test
- public final void testResponseInvalidParametersToken() {
- try {
- getEngine().validateSTORKAuthnResponse(null, ipAddress);
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication response IP null.
- */
- @Test
- public final void testResponseInvalidParametersIP() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setPersonalAttributeList(pal);
- try {
- authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAuthnResponse(authResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate authentication response parameter name wrong.
- */
- @Test
- public final void testResponseInvalidParametersAttr() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("AttrWrong");
- wrongList.add(worngAttr);
-
-
- response.setPersonalAttributeList(wrongList);
- try {
- authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAuthnResponse(authResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate authentication response set null value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrSimpleValue() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("isAgeOver");
- worngAttr.setValue(null);
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAuthnResponse(authResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate authentication response set null value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrNoValue() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("isAgeOver");
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAuthnResponse(authResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate authentication response set null value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrNoName() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAuthnResponse(authResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
- /**
- * Test validate authentication response set null complex value into attribute.
- */
- @Test
- public final void testResponseInvalidParametersAttrComplexValue() {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- final IPersonalAttributeList wrongList = new PersonalAttributeList();
-
- final PersonalAttribute worngAttr = new PersonalAttribute();
- worngAttr.setName("isAgeOver");
- worngAttr.setComplexValue(null);
- wrongList.add(worngAttr);
-
- response.setPersonalAttributeList(wrongList);
- try {
- authResponse = getEngine().generateSTORKAuthnResponse(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- // In Conf1 ipValidate is false
- getEngine().validateSTORKAuthnResponse(authResponse, null);
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
-
-
- /**
- * Test validate authentication response IP distinct and disabled validation
- * IP.
- */
- @Test
- public final void testResponseInvalidParametersIPDistinct() {
- try {
- // ipAddress origin "111.222.333.444"
- // ipAddrValidation = false
- // Subject Confirmation Bearer.
-
- getEngine().validateSTORKAuthnResponse(authResponse, "127.0.0.1");
- fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test response invalid parameters invalid token.
- */
- @Test
- public final void testResponseInvalidParametersTokenMsg() {
- try {
- // ipAddress origin "111.222.333.444"
- // Subject Confirmation Bearer.
- getEngine().validateSTORKAuthnResponse("errorMessage".getBytes(),
- ipAddress);
- fail("validateAuthenticationResponse(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
- /**
- * Test validate authentication response is fail.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthenticationResponseIsFail()
- throws STORKSAMLEngineException {
- try {
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
- fail("Generate incorrect response");
- } catch (Exception e) {
- LOG.error("ERROR: " + e.getMessage());
- }
- }
-
- /**
- * Test validate authentication response destination.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthenticationResponseDestination()
- throws STORKSAMLEngineException {
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
-
- assertEquals("Destination incorrect: ",
- authnResponse.getInResponseTo(), authenRequest.getSamlId());
- }
-
- /**
- * Test validate authentication response values.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- public final void testValidateAuthenticationResponseValuesComplex()
- throws STORKSAMLEngineException {
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
-
- assertEquals("Country incorrect:", authnResponse.getCountry(), "EN");
-
- final Iterator<PersonalAttribute> iterator = authnResponse
- .getPersonalAttributeList().iterator();
-
- while (iterator.hasNext()) {
- final PersonalAttribute attribute = iterator.next();
- if (attribute.getName().equalsIgnoreCase(
- "canonicalResidenceAddress")) {
- assertEquals("State incorrect: ", state, attribute
- .getComplexValue().get("state"));
- assertEquals("Municipality Code incorrect: ", municipalityCode,
- attribute.getComplexValue().get("municipalityCode"));
- assertEquals("Town incorrect: ", town, attribute
- .getComplexValue().get("town"));
- assertEquals("Postal code incorrect: ", postalCode, attribute
- .getComplexValue().get("postalCode"));
- assertEquals("Street name incorrect: ", streetName, attribute
- .getComplexValue().get("streetName"));
- assertEquals("Street number incorrect: ", streetNumber,
- attribute.getComplexValue().get("streetNumber"));
- assertEquals("Apartament number incorrect: ", apartamentNumber,
- attribute.getComplexValue().get("apartamentNumber"));
- }
- }
- }
-
- /**
- * Test generate authenticate response fail in response to it's null.
- * @throws STORKSAMLEngineException
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test //( expected=STORKSAMLEngineException.class)
- public final void testGenerateAuthnResponseFailInResponseToNull() throws STORKSAMLEngineException {
- final String identifier = authenRequest.getSamlId();
- authenRequest.setSamlId(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("");
-
- try {
- authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- fail(ERROR_TXT);
- } catch (STORKSAMLEngineException e) {
- authenRequest.setSamlId(identifier);
- LOG.error("Error");
- //throw new STORKSAMLEngineException(e);
- }
- }
-
- /**
- * Test generate authenticate response fail assertion consumer URL err1.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnResponseFailAssertionConsumerUrlNull()
- throws STORKSAMLEngineException {
-
- final String assertConsumerUrl = authenRequest
- .getAssertionConsumerServiceURL();
- authenRequest.setAssertionConsumerServiceURL(null);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("");
-
- try {
- authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- authenRequest.setAssertionConsumerServiceURL(assertConsumerUrl);
- LOG.error("Error");
- }
- }
-
- /**
- * Test generate authentication response fail code error err1.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthnResponseFailCodeErrorNull()
- throws STORKSAMLEngineException {
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setStatusCode(null);
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("");
-
- try {
- authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
- fail("generateAuthnResponseFail(...) should've thrown an STORKSAMLEngineException!");
- } catch (STORKSAMLEngineException e) {
- LOG.error("Error");
- }
- }
-
-
-
-
- /**
- * Test generate authentication request without errors.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthnResponse() throws STORKSAMLEngineException {
-
- IPersonalAttributeList palist = new PersonalAttributeList();
-
- PersonalAttribute isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(true);
- ArrayList<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- isAgeOver.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- palist.add(isAgeOver);
-
- PersonalAttribute dateOfBirth = new PersonalAttribute();
- dateOfBirth.setName("dateOfBirth");
- dateOfBirth.setIsRequired(false);
- final ArrayList<String> date = new ArrayList<String>();
- date.add("16/12/2008");
- dateOfBirth.setValue(date);
- dateOfBirth.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- palist.add(dateOfBirth);
-
-
- PersonalAttribute eIDNumber = new PersonalAttribute();
- eIDNumber.setName("eIdentifier");
- eIDNumber.setIsRequired(true);
-
- final ArrayList<String> idNumber = new ArrayList<String>();
- idNumber.add("123456789PÑ");
-
- final HashMap<String, String> complex = new HashMap<String, String>();
- complex.put("one", "two");
-
- //eIDNumber.setValue(null);
- //eIDNumber.setValue(idNumber);
- //eIDNumber.setComplexValue(complex);
-
- eIDNumber.setStatus(STORKStatusCode.STATUS_NOT_AVAILABLE.toString());
- palist.add(eIDNumber);
-
- PersonalAttribute canRessAddress = new PersonalAttribute();
- canRessAddress.setName("canonicalResidenceAddress");
- canRessAddress.setIsRequired(true);
- canRessAddress.setStatus(STORKStatusCode.STATUS_AVAILABLE.toString());
- final HashMap<String, String> address = new HashMap<String, String>();
-
- address.put("state", state);
- address.put("municipalityCode", municipalityCode);
- address.put("town", town);
- address.put("postalCode", postalCode);
- address.put("streetName", streetName);
- address.put("streetNumber", streetNumber);
- address.put("apartamentNumber", apartamentNumber);
-
- canRessAddress.setComplexValue(address);
- palist.add(canRessAddress);
-
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
-
- response.setPersonalAttributeList(palist);
-
- final STORKAuthnResponse storkResponse = getEngine()
- .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
- isNotHashing);
-
- authResponse = storkResponse.getTokenSaml();
- LOG.info("Request id: " + authenRequest.getSamlId());
-
- LOG.info("RESPONSE: " + SSETestUtils.encodeSAMLToken(authResponse));
-
-
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
-
- LOG.info("RESPONSE ID: " + authnResponse.getSamlId());
- LOG.info("RESPONSE IN_RESPONSE_TO: " + authnResponse.getInResponseTo());
- LOG.info("RESPONSE COUNTRY: " + authnResponse.getCountry());
-
- }
-
-
-
-
-
- /**
- * Test validate authentication response fail is fail.
- *
- * @throws STORKSAMLEngineException the STORKSAML engine exception
- */
- @Test
- public final void testValidateAuthenticationResponseFailIsFail()
- throws STORKSAMLEngineException {
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
- response.setStatusCode(STORKStatusCode.REQUESTER_URI.toString());
- response.setSubStatusCode(STORKSubStatusCode.AUTHN_FAILED_URI.toString());
- response.setMessage("message");
-
- authResponse = getEngine().generateSTORKAuthnResponseFail(authenRequest,
- response, ipAddress, isNotHashing).getTokenSaml();
-
- LOG.error("ERROR_FAIL: " + PEPSUtil.encodeSAMLToken(authResponse));
-
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
-
- LOG.info("COUNTRY: " + authnResponse.getCountry());
- assertTrue("Generate incorrect response: ", authnResponse.isFail());
- }
-
- /**
- * Test generate/validate response with signedDoc
- *
- * @throws STORKSAMLEngineException
- * the STORKSAML engine exception
- */
- @Test
- public final void testGenerateAuthenResponseWithSignedDoc()
- throws STORKSAMLEngineException {
-
- String signedDocResponse = "<dss:SignResponse xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"123456\"> <dss:Result> <dss:ResultMajor>urn:oasis:names:tc:dss:1.0:resultmajor:Success</dss:ResultMajor> </dss:Result> <dss:SignatureObject> <dss:Base64Signature Type=\"urn:ietf:rf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tYXQgT2JqZWN0UmVmZXJlbmNlPSIjUmVmZXJlbmNlLWJhYmE0ZDFhLWExN2UtNDJjNi05N2QyLWJlZWUxMzUwOTUwMyI+PHhhZGVzOk1pbWVUeXBlPmFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbTwveGFkZXM6TWltZVR5cGU+PHhhZGVzOkVuY29kaW5nPmJhc2U2NDwveGFkZXM6RW5jb2Rpbmc+PC94YWRlczpEYXRhT2JqZWN0Rm9ybWF0PjwveGFkZXM6U2lnbmVkRGF0YU9iamVjdFByb3BlcnRpZXM+PC94YWRlczpTaWduZWRQcm9wZXJ0aWVzPjwveGFkZXM6UXVhbGlmeWluZ1Byb3BlcnRpZXM+PC9kczpPYmplY3Q+PC9kczpTaWduYXR1cmU+</dss:Base64Signature> </dss:SignatureObject> </dss:SignResponse>";
-
- IPersonalAttributeList palist = new PersonalAttributeList();
-
- PersonalAttribute signedDoc = new PersonalAttribute();
- signedDoc.setName("signedDoc");
- signedDoc.setIsRequired(false);
- ArrayList<String> signed = new ArrayList<String>();
- signed.add(signedDocResponse);
- signedDoc.setValue(signed);
- palist.add(signedDoc);
-
- PersonalAttribute isAgeOver = new PersonalAttribute();
- isAgeOver.setName("isAgeOver");
- isAgeOver.setIsRequired(false);
- ArrayList<String> ages = new ArrayList<String>();
- ages.add("16");
- ages.add("18");
- isAgeOver.setValue(ages);
- palist.add(isAgeOver);
-
- authenRequest.setPersonalAttributeList(palist);
-
- final STORKAuthnResponse response = new STORKAuthnResponse();
-
- response.setPersonalAttributeList(palist);
-
- final STORKAuthnResponse storkResponse = getEngine()
- .generateSTORKAuthnResponse(authenRequest, response, ipAddress,
- isNotHashing);
-
- authResponse = storkResponse.getTokenSaml();
- authnResponse = getEngine().validateSTORKAuthnResponse(authResponse,
- ipAddress);
-
- assertTrue("SignedDoc response should be the same: ", authnResponse
- .getPersonalAttributeList().get("signedDoc").getValue().get(0)
- .equals(signedDocResponse));
-
- }
-
-}
diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/.svn/text-base/package-info.java.svn-base b/id/server/stork2-saml-engine/build/classes/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/build/classes/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/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class Binary files differdeleted file mode 100644 index 77bb2ca96..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SSETestUtils.class +++ /dev/null diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class Binary files differdeleted file mode 100644 index 3bccdf89c..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/SimpleBaseTest.class +++ /dev/null diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class Binary files differdeleted file mode 100644 index ffaf0cf57..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryRequestTest.class +++ /dev/null diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class Binary files differdeleted file mode 100644 index 8737e0538..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAttrQueryResponseTest.class +++ /dev/null diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class Binary files differdeleted file mode 100644 index 667bee6d3..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkAuthRequestTest.class +++ /dev/null diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class Binary files differdeleted file mode 100644 index 4bce51cc6..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/StorkResponseTest.class +++ /dev/null diff --git a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class b/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class Binary files differdeleted file mode 100644 index 1956264c7..000000000 --- a/id/server/stork2-saml-engine/build/classes/test/java/eu/stork/peps/test/simple/package-info.class +++ /dev/null |