aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules
diff options
context:
space:
mode:
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java310
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTestProduction.java240
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/dummy/DummySpecificCommunicationService.java60
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASAttributePostProcessingTest.java463
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASDataStoreTest.java109
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingFirstTest.java133
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingSecondTest.java104
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java104
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskSecondTest.java120
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskThirdTest.java93
10 files changed, 0 insertions, 1736 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java
deleted file mode 100644
index 825fe205..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.security.InvalidKeyException;
-import java.security.MessageDigest;
-import java.security.NoSuchProviderException;
-import java.util.List;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.ws.soap.SOAPFaultException;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.cxf.binding.soap.SoapFault;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Base64Utils;
-import org.w3._2000._09.xmldsig.KeyValueType;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-
-import com.skjolberg.mockito.soap.SoapServiceRule;
-
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils;
-import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType;
-import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType;
-import at.gv.egiz.eaaf.core.api.data.EaafConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
-import at.gv.egiz.eaaf.core.exceptions.EaafParserException;
-import at.gv.egiz.eaaf.core.impl.data.Trible;
-import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
-import at.gv.egiz.eaaf.core.impl.utils.DomUtils;
-import szrservices.GetIdentityLinkEidasResponse;
-import szrservices.IdentityLinkType;
-import szrservices.PersonInfoType;
-import szrservices.SZR;
-import szrservices.SZRException_Exception;
-import szrservices.TravelDocumentType;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-public class SZRClientTest {
- private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class);
-
- @Autowired SZRClient szrClient;
- @Autowired IConfiguration basicConfig;
-
- private static final String givenName = "Franz";
- private static final String familyName = "Mustermann";
- private static final String dateOfBirth = "1989-05-05";
- private static final String eIDASeID = "IS/AT/1234sdgsdfg56789ABCDEF";
-
- //Dummy public RSA Key
- private static final String PUBKEY_EXPONENT = "AQAB";
- private static final String PUBKEY_MODULUS = "AJZyj/+sdCMDRq9RkvbFcgSTVn/OfS8EUE81ddwP8MNuJ1kd1SWBUJPaQX2JLJHrL54mkOhrkhH2M/zcuOTu8nW9TOEgXGjrRB/0HpiYKpV+VDJViyyc/GacNLxN4Anw4pima6gHYaJIw9hQkL/nuO2hyh8PGJd7rxeFXJmbLy+X";
-
- private static final String DUMMY_TARGET = EaafConstants.URN_PREFIX_CDID + "ZP";
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "../../basicConfig/default_config.properties");
-
- }
-
- @Rule
- public SoapServiceRule soap = SoapServiceRule.newInstance();
-
- @Test
- public void getIdentityLinkRawModeValidResponse() throws SZRException_Exception, EaafParserException, NoSuchProviderException, IOException, InvalidKeyException, eIDASAuthenticationException, JAXBException {
- setSZRResponseIdentityLink("/data/szr/szr_resp_valid_1.xml", "http://localhost:1234/demoszr");
-
- try {
- log.debug("Starting connecting SZR Gateway");
- IdentityLinkType result = szrClient.getIdentityLinkInRawMode(
- getPersonInfo());
-
- Assert.assertNotNull(result);
- Assert.assertNotNull(result.getAssertion());
-
- IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser((Element)result.getAssertion()).parseIdentityLink();
- Assert.assertNotNull(identityLink);
-
- System.out.println(identityLink.getSerializedSamlAssertion());
-
- checkElement("Mustermann", identityLink.getFamilyName());
- checkElement("Hans", identityLink.getGivenName());
- checkElement("1989-05-05", identityLink.getDateOfBirth());
- checkElement("urn:publicid:gv.at:baseid", identityLink.getIdentificationType());
- checkElement("k+zDM1BVpN1WJO4x7ZQ3ng==", identityLink.getIdentificationValue());
- Assert.assertNotNull(identityLink.getSerializedSamlAssertion());
- Assert.assertNotNull(identityLink.getSamlAssertion());
-
- } catch (SZRCommunicationException e) {
- Assert.fail();
-
- }
-
- }
-
- @Test
- public void getIdentityLinkRawModeErrorTravelerDocExists() throws SZRException_Exception, EaafParserException, NoSuchProviderException, IOException, InvalidKeyException, eIDASAuthenticationException, JAXBException, ParserConfigurationException, SAXException {
- setSZRExceptionIdentityLink("/data/szr/szr_resp_error_travelerdocexists.xml", "http://localhost:1234/demoszr");
-
- try {
- log.debug("Starting connecting SZR Gateway");
- IdentityLinkType result = szrClient.getIdentityLinkInRawMode(
- getPersonInfo());
- Assert.fail();
-
- } catch (SZRCommunicationException e) {
- checkElement("ernb.02", e.getErrorId());
- Assert.assertNotNull(e.getCause());
- org.springframework.util.Assert.isInstanceOf(SOAPFaultException.class, e.getCause());
- Assert.assertNotNull(((SOAPFaultException)e.getCause()).getFault());
- checkElement("p344:F455", ((SOAPFaultException)e.getCause()).getFault().getFaultCode());
- checkElement("The travel document you sent to insert a person already exists for another person. Either check the document or have the person altered accordingly", ((SOAPFaultException)e.getCause()).getFault().getFaultString());
-
- }
-
- }
-
- @Ignore
- @Test
- public void getbPKTest() throws SZRException_Exception, eIDASAuthenticationException {
- String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET,
- basicConfig.getBasicConfiguration(
- Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ,
- "no VKZ defined"));
-
- if (StringUtils.isEmpty(bPK))
- throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"});
-
-
- }
-
- private void checkElement(String expected, String value) {
- Assert.assertNotNull(value);
- Assert.assertEquals(expected, value);
-
- }
-
-
- private void setSZRResponseIdentityLink(String responseXmlPath, String serviceURL) throws JAXBException, SZRException_Exception {
- final SZR szrServiceMock = soap.mock(SZR.class, serviceURL);
- final JAXBContext jaxbContext = JAXBContext.newInstance(
- szrservices.ObjectFactory.class,
- org.xmlsoap.schemas.ws._2002._04.secext.ObjectFactory.class,
- org.w3._2001._04.xmldsig_more.ObjectFactory.class,
- org.w3._2000._09.xmldsig.ObjectFactory.class,
- at.gv.egov.pvp1.ObjectFactory.class,
- at.gv.e_government.reference.namespace.persondata._20020228.ObjectFactory.class);
- final Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
- final GetIdentityLinkEidasResponse szrResponse= (GetIdentityLinkEidasResponse) jaxbUnmarshaller.unmarshal(this.getClass().getResourceAsStream(responseXmlPath));
- when(szrServiceMock.getIdentityLinkEidas(any(PersonInfoType.class))).thenReturn(szrResponse.getGetIdentityLinkReturn());
-
- }
-
- private void setSZRExceptionIdentityLink(String responseXmlPath, String serviceURL) throws JAXBException,ParserConfigurationException, SAXException, IOException, SZRException_Exception {
- final SZR szrServiceMock = soap.mock(SZR.class, serviceURL);
- final Element detailerror = DomUtils.parseXmlNonValidating(this.getClass().getResourceAsStream(responseXmlPath));
- final javax.xml.namespace.QName qName = new javax.xml.namespace.QName("urn:SZRServices","F455", "p344");
- final SoapFault fault = new SoapFault("The travel document you sent to insert a person already exists for another person. Either check the document or have the person altered accordingly", qName);
- fault.setRole("urn:SZRServices");
- fault.setDetail(detailerror);
- when(szrServiceMock.getIdentityLinkEidas(any(PersonInfoType.class))).thenThrow(fault);
-
- }
-
- private String createHashFromUniqueId(String uniqueId) throws eIDASAuthenticationException {
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- byte[] hash = md.digest(uniqueId.getBytes("UTF-8"));
- String hashBase64 = new String(Base64Utils.encode(hash), "UTF-8").replaceAll("\r\n", "");
- return hashBase64;
-
- } catch (Exception ex) {
- throw new eIDASAuthenticationException("internal.03", new Object[]{}, ex);
-
- }
- }
-
- private PersonInfoType getPersonInfo() throws eIDASAuthenticationException {
- PersonInfoType personInfo = new PersonInfoType();
- PersonNameType personName = new PersonNameType();
- PhysicalPersonType naturalPerson = new PhysicalPersonType();
- TravelDocumentType eDocument = new TravelDocumentType();
-
- naturalPerson.setName(personName );
- personInfo.setPerson(naturalPerson );
- personInfo.setTravelDocument(eDocument );
-
- //parse some eID attributes
- Trible<String, String, String> eIdentifier =
- eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID);
- String uniqueId = createHashFromUniqueId(eIdentifier.getThird());
- String citizenCountry = eIdentifier.getFirst();
-
- //person information
- personName.setFamilyName((String)familyName);
- personName.setGivenName((String)givenName);
- naturalPerson.setDateOfBirth(dateOfBirth);
- eDocument.setIssuingCountry(citizenCountry);
- eDocument.setDocumentNumber(uniqueId);
-
- //eID document information
- eDocument.setDocumentType(basicConfig.getBasicConfiguration(
- Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE,
- Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE));
-
- //TODO: that should be removed
-// eDocument.setIssueDate(basicConfig.getBasicConfiguration(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE));
-// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY));
-
- return personInfo;
- }
-
-
- private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException {
-// if (basicConfig.getBasicMOAIDConfigurationBoolean(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY,
-// false)) {
-// List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>();
-// try {
-// // set key values
-// RSAKeyValueType rsa = new RSAKeyValueType();
-// rsa.setExponent(PUBKEY_EXPONENT);
-// rsa.setModulus(PUBKEY_MODULUS);
-//
-// KeyValueType key = new KeyValueType();
-// key.setRSAKeyValue(rsa);
-// keyvalueList.add(key);
-//
-// return keyvalueList;
-// } catch (Exception e) {
-// log.error("TestCode has an internal ERROR", e);
-// throw e;
-//
-// }
-//
-// }
-
- return null;
-
- }
-
- /*
- * getIdentityLink without RAW mode does not contain a valid signature
- */
- //@Test
-// public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, eIDASAuthenticationException {
-// log.debug("Starting connecting SZR Gateway");
-// IdentityLinkType result = szrClient.getIdentityLink(
-// getPersonInfo(),
-// dummyCodeForKeys(),
-// basicConfig.getBasicMOAIDConfigurationBoolean(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB,
-// true)
-// );
-//
-// Element idlFromSZR = (Element)result.getAssertion();
-// IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink();
-// if (identityLink == null)
-// throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"});
-//
-// }
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTestProduction.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTestProduction.java
deleted file mode 100644
index a4aa7ca0..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTestProduction.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2;
-
-import java.io.IOException;
-import java.security.InvalidKeyException;
-import java.security.MessageDigest;
-import java.security.NoSuchProviderException;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.Base64Utils;
-import org.w3._2000._09.xmldsig.KeyValueType;
-import org.w3c.dom.Element;
-
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils;
-import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType;
-import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType;
-import at.gv.egiz.eaaf.core.api.data.EaafConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink;
-import at.gv.egiz.eaaf.core.exceptions.EaafParserException;
-import at.gv.egiz.eaaf.core.impl.data.Trible;
-import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser;
-import szrservices.IdentityLinkType;
-import szrservices.PersonInfoType;
-import szrservices.SZRException_Exception;
-import szrservices.TravelDocumentType;
-
-@Ignore
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_basic_test.xml")
-public class SZRClientTestProduction {
- private static final Logger log = LoggerFactory.getLogger(SZRClientTestProduction.class);
-
- @Autowired SZRClient szrClient;
- @Autowired IConfiguration basicConfig;
-
- private static final String givenName = "Franz";
- private static final String familyName = "Mustermann";
- //private static final String dateOfBirth = "1989-05-05";
- private static final String dateOfBirth = "1989-05-04";
- private static final String eIDASeID = "IS/AT/1234sdgsdfg56789ABCDEF";
-
- //Dummy public RSA Key
- private static final String PUBKEY_EXPONENT = "AQAB";
- private static final String PUBKEY_MODULUS = "AJZyj/+sdCMDRq9RkvbFcgSTVn/OfS8EUE81ddwP8MNuJ1kd1SWBUJPaQX2JLJHrL54mkOhrkhH2M/zcuOTu8nW9TOEgXGjrRB/0HpiYKpV+VDJViyyc/GacNLxN4Anw4pima6gHYaJIw9hQkL/nuO2hyh8PGJd7rxeFXJmbLy+X";
-
- private static final String DUMMY_TARGET = EaafConstants.URN_PREFIX_CDID + "ZP";
-
- @Test
- public void dummyTest() {
-
- }
-
-
- /*
- * getIdentityLink without RAW mode does not contain a valid signature
- */
- //@Test
-// public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, eIDASAuthenticationException {
-// log.debug("Starting connecting SZR Gateway");
-// IdentityLinkType result = szrClient.getIdentityLink(
-// getPersonInfo(),
-// dummyCodeForKeys(),
-// basicConfig.getBasicMOAIDConfigurationBoolean(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB,
-// true)
-// );
-//
-// Element idlFromSZR = (Element)result.getAssertion();
-// IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink();
-// if (identityLink == null)
-// throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"});
-//
-// }
-
- @Test
- public void getIdentityLinkRawMode() throws SZRException_Exception, EaafParserException, NoSuchProviderException, IOException, InvalidKeyException, eIDASAuthenticationException {
- log.debug("Starting connecting SZR Gateway");
- IdentityLinkType result = szrClient.getIdentityLinkInRawMode(
- getPersonInfo());
-
- Element idlFromSZR = (Element)result.getAssertion();
- IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink();
-
- if (identityLink == null)
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO IDL object"});
-
- System.out.println(identityLink.getSerializedSamlAssertion());
-
- if (StringUtils.isEmpty(identityLink.getFamilyName()))
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO FamilyName from IDL"});
-
- if (StringUtils.isEmpty(identityLink.getGivenName()))
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO GivenName from IDL"});
-
- if (StringUtils.isEmpty(identityLink.getDateOfBirth()))
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO DateOfBirthName from IDL"});
-
- if (StringUtils.isEmpty(identityLink.getIdentificationType()))
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO baseIdType from IDL"});
-
- if (StringUtils.isEmpty(identityLink.getIdentificationValue()))
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO baseId from IDL"});
-
- if (StringUtils.isEmpty(identityLink.getSerializedSamlAssertion()))
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO serialized IDL"});
-
- if (identityLink.getSamlAssertion() == null )
- throw new SZRCommunicationException("ernb.00", new Object[] {"NO raw IDL"});
-
-
-
- }
-
-// @Test
- public void getbPKTest() throws SZRException_Exception, eIDASAuthenticationException {
- String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET,
- basicConfig.getBasicConfiguration(
- Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ,
- "no VKZ defined"));
-
- if (StringUtils.isEmpty(bPK))
- throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"});
-
-
- }
-
- private String createHashFromUniqueId(String uniqueId) throws eIDASAuthenticationException {
- try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
- byte[] hash = md.digest(uniqueId.getBytes("UTF-8"));
- String hashBase64 = new String(Base64Utils.encode(hash), "UTF-8").replaceAll("\r\n", "");
- return hashBase64;
-
- } catch (Exception ex) {
- throw new eIDASAuthenticationException("internal.03", new Object[]{}, ex);
-
- }
- }
-
- private PersonInfoType getPersonInfo() throws eIDASAuthenticationException {
- PersonInfoType personInfo = new PersonInfoType();
- PersonNameType personName = new PersonNameType();
- PhysicalPersonType naturalPerson = new PhysicalPersonType();
- TravelDocumentType eDocument = new TravelDocumentType();
-
- naturalPerson.setName(personName );
- personInfo.setPerson(naturalPerson );
- personInfo.setTravelDocument(eDocument );
-
- //parse some eID attributes
- Trible<String, String, String> eIdentifier =
- eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID);
- String uniqueId = createHashFromUniqueId(eIdentifier.getThird());
- String citizenCountry = eIdentifier.getFirst();
-
- //person information
- personName.setFamilyName((String)familyName);
- personName.setGivenName((String)givenName);
- naturalPerson.setDateOfBirth(dateOfBirth);
- eDocument.setIssuingCountry(citizenCountry);
- eDocument.setDocumentNumber(uniqueId);
-
- //eID document information
- eDocument.setDocumentType(basicConfig.getBasicConfiguration(
- Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE,
- Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE));
-
- //TODO: that should be removed
-// eDocument.setIssueDate(basicConfig.getBasicConfiguration(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE));
-// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY));
-
- return personInfo;
- }
-
-
- private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException {
-// if (basicConfig.getBasicMOAIDConfigurationBoolean(
-// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY,
-// false)) {
-// List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>();
-// try {
-// // set key values
-// RSAKeyValueType rsa = new RSAKeyValueType();
-// rsa.setExponent(PUBKEY_EXPONENT);
-// rsa.setModulus(PUBKEY_MODULUS);
-//
-// KeyValueType key = new KeyValueType();
-// key.setRSAKeyValue(rsa);
-// keyvalueList.add(key);
-//
-// return keyvalueList;
-// } catch (Exception e) {
-// log.error("TestCode has an internal ERROR", e);
-// throw e;
-//
-// }
-//
-// }
-
- return null;
-
- }
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/dummy/DummySpecificCommunicationService.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/dummy/DummySpecificCommunicationService.java
deleted file mode 100644
index c2b6f08f..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/dummy/DummySpecificCommunicationService.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.dummy;
-
-import java.util.Collection;
-
-import eu.eidas.auth.commons.attribute.AttributeDefinition;
-import eu.eidas.auth.commons.light.ILightRequest;
-import eu.eidas.auth.commons.light.ILightResponse;
-import eu.eidas.auth.commons.tx.BinaryLightToken;
-import eu.eidas.specificcommunication.BinaryLightTokenHelper;
-import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
-import eu.eidas.specificcommunication.protocol.SpecificCommunicationService;
-
-public class DummySpecificCommunicationService implements SpecificCommunicationService {
-
- private ILightRequest iLightRequest;
- private ILightResponse iLightResponse;
-
- @Override
- public BinaryLightToken putRequest(ILightRequest iLightRequest) throws SpecificCommunicationException {
- this.iLightRequest = iLightRequest;
- return BinaryLightTokenHelper.createBinaryLightToken("Test", "TestSecret", "SHA-256");
- }
-
- @Override
- public ILightRequest getAndRemoveRequest(String tokenBase64, Collection<AttributeDefinition<?>> registry)
- throws SpecificCommunicationException {
- return iLightRequest;
- }
-
- @Override
- public BinaryLightToken putResponse(ILightResponse iLightResponse) throws SpecificCommunicationException {
- this.iLightResponse = iLightResponse;
- return BinaryLightTokenHelper.createBinaryLightToken("Test", "TestSecret", "SHA-256");
- }
-
- @Override
- public ILightResponse getAndRemoveResponse(String tokenBase64, Collection<AttributeDefinition<?>> registry)
- throws SpecificCommunicationException {
- return iLightResponse;
- }
-
- public ILightRequest getiLightRequest() {
- return iLightRequest;
- }
-
- public void setiLightRequest(ILightRequest iLightReques) {
- this.iLightRequest = iLightReques;
- }
-
- public ILightResponse getiLightResponse() {
- return iLightResponse;
- }
-
- public void setiLightResponse(ILightResponse iLightResponse) {
- this.iLightResponse = iLightResponse;
- }
-
-
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASAttributePostProcessingTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASAttributePostProcessingTest.java
deleted file mode 100644
index 2b19e1e2..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASAttributePostProcessingTest.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2;
-
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.joda.time.DateTime;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.DAO.ERnBeIDData;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.CCSpecificEIDProcessingService;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
-public class eIDASAttributePostProcessingTest {
-
- @Autowired private CCSpecificEIDProcessingService postProcessor;
-
- //lower case
- private static final String P1_eIDASID = "DE/AT/532eaabd9574880dbf76b9b8cc00832c20a6ec113d682299550d7a6e0f345e25";
- private static final String P1_GIVENNAME = "Max";
- private static final String P1_FAMILYNAME = "Mustermann";
- private static final DateTime P1_DATEOFBIRTH = DateTime.now();
- private static final String P1_PLACEOFBIRTH = "Nirgendwo";
- private static final String P1_BIRTHNAME = "Musterkind";
-
- //mixed
- private static final String P3_eIDASID = "DE/AT/532eaabd9574880dbf76b9b8cc00832c20A6ec113d682299550d7a6e0f345e25";
- private static final String P3_GIVENNAME = "Max";
- private static final String P3_FAMILYNAME = "Mustermann";
- private static final DateTime P3_DATEOFBIRTH = DateTime.now();
- private static final String P3_PLACEOFBIRTH = "Nirgendwo";
- private static final String P3_BIRTHNAME = "Musterkind";
-
- //upper case
- private static final String P4_eIDASID = "DE/AT/532EAABD9574880DBF76B9B8CC00832C20A6EC113D682299550D7A6E0F345E25";
- private static final String P4_GIVENNAME = "Max";
- private static final String P4_FAMILYNAME = "Mustermann";
- private static final DateTime P4_DATEOFBIRTH = DateTime.now();
- private static final String P4_PLACEOFBIRTH = "Nirgendwo";
- private static final String P4_BIRTHNAME = "Musterkind";
-
- //To long identifier
- private static final String P5_eIDASID = "DE/AT/532EAABD9574880DBF76B9B8CC00832C20A6EC113D682299550D7A6E0F345E251";
- private static final String P5_GIVENNAME = "Max";
- private static final String P5_FAMILYNAME = "Mustermann";
- private static final DateTime P5_DATEOFBIRTH = DateTime.now();
- private static final String P5_PLACEOFBIRTH = "Nirgendwo";
- private static final String P5_BIRTHNAME = "Musterkind";
-
- //to short identifier
- private static final String P6_eIDASID = "DE/AT/532EAABD9574880DBF76B9B8CC00832C20A6EC113D682299550D7A6E0F";
- private static final String P6_GIVENNAME = "Max";
- private static final String P6_FAMILYNAME = "Mustermann";
- private static final DateTime P6_DATEOFBIRTH = DateTime.now();
- private static final String P6_PLACEOFBIRTH = "Nirgendwo";
- private static final String P6_BIRTHNAME = "Musterkind";
-
- //no hex encoded identifier
- private static final String P7_eIDASID = "DE/AT/532EAABD9574880DBF76B9B8CC00832C20A6EC113D682299550D7A6E0F";
- private static final String P7_GIVENNAME = "Max";
- private static final String P7_FAMILYNAME = "Mustermann";
- private static final DateTime P7_DATEOFBIRTH = DateTime.now();
- private static final String P7_PLACEOFBIRTH = "Nirgendwo";
- private static final String P7_BIRTHNAME = "Musterkind";
-
-
- private static final String P2_eIDASID = "EE/AT/asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd";
- private static final String P2_GIVENNAME = "Max";
- private static final String P2_FAMILYNAME = "Mustermann";
- private static final DateTime P2_DATEOFBIRTH = DateTime.now();
- private static final String P2_PLACEOFBIRTH = "Nirgendwo";
- private static final String P2_BIRTHNAME = "Musterkind";
-
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "../../basicConfig/default_config.properties");
-
- }
-
-
- @Test
- public void DEWithHexLowerCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P1_eIDASID,
- P1_FAMILYNAME,
- P1_GIVENNAME,
- P1_DATEOFBIRTH,
- P1_PLACEOFBIRTH,
- P1_BIRTHNAME)
- );
-
- validate(result,
- "Uy6qvZV0iA2/drm4zACDLCCm7BE9aCKZVQ16bg80XiU=",
- P1_FAMILYNAME,
- P1_GIVENNAME,
- P1_DATEOFBIRTH,
- P1_PLACEOFBIRTH,
- P1_BIRTHNAME
- );
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
-
- }
- }
-
-
- @Test
- public void DEWithHexMixedCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P3_eIDASID,
- P3_FAMILYNAME,
- P3_GIVENNAME,
- P3_DATEOFBIRTH,
- P3_PLACEOFBIRTH,
- P3_BIRTHNAME)
- );
-
- validate(result,
- "Uy6qvZV0iA2/drm4zACDLCCm7BE9aCKZVQ16bg80XiU=",
- P3_FAMILYNAME,
- P3_GIVENNAME,
- P3_DATEOFBIRTH,
- P3_PLACEOFBIRTH,
- P3_BIRTHNAME
- );
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
-
- }
- }
-
- @Test
- public void DEWithHexUpperCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P4_eIDASID,
- P4_FAMILYNAME,
- P4_GIVENNAME,
- P4_DATEOFBIRTH,
- P4_PLACEOFBIRTH,
- P4_BIRTHNAME)
- );
-
- validate(result,
- "Uy6qvZV0iA2/drm4zACDLCCm7BE9aCKZVQ16bg80XiU=",
- P4_FAMILYNAME,
- P4_GIVENNAME,
- P4_DATEOFBIRTH,
- P4_PLACEOFBIRTH,
- P4_BIRTHNAME
- );
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
-
- }
- }
-
- @Test
- public void DEWithHexTooLongCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P5_eIDASID,
- P5_FAMILYNAME,
- P5_GIVENNAME,
- P5_DATEOFBIRTH,
- P5_PLACEOFBIRTH,
- P5_BIRTHNAME)
- );
-
-
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("Too long input accepted");
- }
-
- @Test
- public void DEWithHexTooShortCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P6_eIDASID,
- P6_FAMILYNAME,
- P6_GIVENNAME,
- P6_DATEOFBIRTH,
- P6_PLACEOFBIRTH,
- P6_BIRTHNAME)
- );
-
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("Too short input accepted");
- }
-
- @Test
- public void DEWithNoHexCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P7_eIDASID,
- P7_FAMILYNAME,
- P7_GIVENNAME,
- P7_DATEOFBIRTH,
- P7_PLACEOFBIRTH,
- P7_BIRTHNAME)
- );
-
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("Not hex encoded input accepted");
- }
-
- @Test
- public void EETestCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P2_eIDASID,
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME)
- );
-
- validate(result,
- "asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd",
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME
- );
-
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
-
- }
- }
-
-
- @Test
- public void EETestFamilyNameMissingCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P2_eIDASID,
- null,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME)
- );
-
- validate(result,
- "asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd",
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME
- );
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("FamilyName missing input accepted");
-
- }
-
- @Test
- public void EETestGivenNameMissingCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P2_eIDASID,
- P2_FAMILYNAME,
- null,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME)
- );
-
- validate(result,
- "asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd",
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME
- );
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("GivenName missing input accepted");
-
- }
-
- @Test
- public void EETestDateOfBirthMissingCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- P2_eIDASID,
- P2_FAMILYNAME,
- P2_GIVENNAME,
- null,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME)
- );
-
- validate(result,
- "asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd",
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME
- );
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("DateOfBirth missing input accepted");
-
- }
-
- @Test
- public void EETestIDMissingCase() throws Exception {
- try {
- ERnBeIDData result = postProcessor.postProcess(
- generateInputData(
- null,
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME)
- );
-
- validate(result,
- "asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd",
- P2_FAMILYNAME,
- P2_GIVENNAME,
- P2_DATEOFBIRTH,
- P2_PLACEOFBIRTH,
- P2_BIRTHNAME
- );
-
- } catch (Exception e) {
- return;
-
- }
-
- fail("eIDAS-Id missing input accepted");
-
- }
-
- private Map<String, Object> generateInputData(String id, String familyName, String givenName, DateTime dateOfBirth, String placeOfBirth, String birthName) {
- Map<String, Object> result = new HashMap<String, Object>();
- result.put(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, id);
- result.put(Constants.eIDAS_ATTR_CURRENTGIVENNAME, givenName);
- result.put(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, familyName);
- result.put(Constants.eIDAS_ATTR_DATEOFBIRTH, dateOfBirth);
- result.put(Constants.eIDAS_ATTR_PLACEOFBIRTH, placeOfBirth);
- result.put(Constants.eIDAS_ATTR_BIRTHNAME, birthName);
- return result;
-
- }
-
- private void validate(ERnBeIDData result, String id, String familyName, String givenName, DateTime dateOfBirth, String placeOfBirth, String birthName) {
- if (!result.getPseudonym().equals(id))
- fail(result.getPseudonym() + "is not equal to " + id);
-
- if (!result.getFamilyName().equals(familyName))
- fail(result.getFamilyName() + "is not equal to " + familyName);
-
- if (!result.getGivenName().equals(givenName))
- fail(result.getGivenName() + "is not equal to " + givenName);
-
- if (!result.getDateOfBirth().equals(dateOfBirth))
- fail(result.getDateOfBirth() + "is not equal to " + dateOfBirth);
-
- if (!result.getFormatedDateOfBirth().equals(new SimpleDateFormat("yyyy-MM-dd").format(dateOfBirth.toDate())))
- fail(result.getDateOfBirth() + "is not equal to " + new SimpleDateFormat("yyyy-MM-dd").format(dateOfBirth.toDate()));
-
- if (!result.getPlaceOfBirth().equals(placeOfBirth))
- fail(result.getPlaceOfBirth() + "is not equal to " + placeOfBirth);
-
- if (!result.getBirthName().equals(birthName))
- fail(result.getBirthName() + "is not equal to " + birthName);
-
- }
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASDataStoreTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASDataStoreTest.java
deleted file mode 100644
index dede8202..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASDataStoreTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-//package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2;
-//
-//import java.security.MessageDigest;
-//
-//import org.apache.commons.lang3.StringUtils;
-//import org.junit.Test;
-//import org.junit.runner.RunWith;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.test.context.ContextConfiguration;
-//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-//import org.springframework.util.Base64Utils;
-//
-//import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SQLiteServiceException;
-//import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException;
-//import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.eIDASDataStore;
-//import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils;
-//import at.gv.egiz.eaaf.core.impl.data.Trible;
-//
-//@RunWith(SpringJUnit4ClassRunner.class)
-//@ContextConfiguration("/SpringTest-context_basic_test.xml")
-//public class eIDASDataStoreTest {
-//
-// @Autowired private eIDASDataStore dataStore;
-//
-// private static final String P1_TRANSID = "123456789";
-// private static final String P1_eIDASID = "DE/AT/121asdf1as5f1as6f1asd2f1asdf1asdf1asd23f1asdf1asdf4sd7fsdf1asdf1asd2f1asd56f7asdf4asdfasdf1";
-//
-// private static final String P2_TRANSID = "987654321";
-// private static final String P2_eIDASID = "EE/AT/asfasfasdfasdfasdfasdfasdfasvafasdfasdfasdfasdfasdfasvascasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasd";
-//
-// @Test
-// public void dummyTest() {
-//
-// }
-//
-// @Test
-// public void insertTestOne() throws SQLiteServiceException, eIDASAuthenticationException {
-// Trible<String, String, String> eidasId = eIDASResponseUtils.parseEidasPersonalIdentifier(P1_eIDASID);
-// String ernbId = createHashFromUniqueId(eidasId.getThird());
-// dataStore.storeNationalId(
-// P1_TRANSID,
-// eidasId,
-// ernbId);
-//
-//
-// if (StringUtils.isEmpty(dataStore.getEidasRawNationalId(ernbId))
-// && dataStore.getEidasRawNationalId(ernbId).equals(eidasId.getThird()))
-// throw new SQLiteServiceException("No eIDAS RAW Id in SQLite DB", null);
-//
-// if (StringUtils.isEmpty(dataStore.getErnbNationalId(eidasId))
-// && dataStore.getErnbNationalId(eidasId).equals(ernbId) )
-// throw new SQLiteServiceException("No ERnB Id in SQLite DB", null);
-//
-// }
-//
-// @Test
-// public void insertTestTwo() throws SQLiteServiceException, eIDASAuthenticationException {
-// Trible<String, String, String> eidasId = eIDASResponseUtils.parseEidasPersonalIdentifier(P2_eIDASID);
-// String ernbId = createHashFromUniqueId(eidasId.getThird());
-// dataStore.storeNationalId(
-// P2_TRANSID,
-// eidasId,
-// ernbId);
-//
-// if (StringUtils.isEmpty(dataStore.getEidasRawNationalId(ernbId))
-// && dataStore.getEidasRawNationalId(ernbId).equals(eidasId.getThird()))
-// throw new SQLiteServiceException("No eIDAS RAW Id in SQLite DB", null);
-//
-// if (StringUtils.isEmpty(dataStore.getErnbNationalId(eidasId))
-// && dataStore.getErnbNationalId(eidasId).equals(ernbId))
-// throw new SQLiteServiceException("No ERnB Id in SQLite DB", null);
-//
-// }
-//
-// private String createHashFromUniqueId(String uniqueId) throws eIDASAuthenticationException {
-// try {
-// MessageDigest md = MessageDigest.getInstance("SHA-256");
-// byte[] hash = md.digest(uniqueId.getBytes("UTF-8"));
-// String hashBase64 = new String(Base64Utils.encode(hash), "UTF-8").replaceAll("\r\n", "");
-// return hashBase64;
-//
-// } catch (Exception ex) {
-// throw new eIDASAuthenticationException("internal.03", new Object[]{}, ex);
-//
-// }
-// }
-//}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingFirstTest.java
deleted file mode 100644
index 09af53b7..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingFirstTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDPostProcessingException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.CCSpecificEIDProcessingService;
-import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import eu.eidas.auth.commons.light.impl.LightRequest;
-import eu.eidas.auth.commons.light.impl.LightRequest.Builder;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
-public class eIDASRequestPreProcessingFirstTest {
-
- @Autowired private IConfigurationWithSP basicConfig;
- @Autowired private CCSpecificEIDProcessingService preProcessor;
-
- private TestRequestImpl pendingReq;
- private DummySpConfiguration oaParam;
- private Builder authnRequestBuilder;
-
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "../../basicConfig/default_config.properties");
-
- }
-
- @Before
- public void setUp() {
-
- Map<String, String> spConfig = new HashMap<>();
- spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp");
- spConfig.put("target", "urn:publicid:gv.at:cdid+XX");
- oaParam = new DummySpConfiguration(spConfig , basicConfig);
-
- pendingReq = new TestRequestImpl();
- pendingReq.setSpConfig(oaParam);
- pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
- pendingReq.setAuthUrl("http://test.com/");
-
- authnRequestBuilder = LightRequest.builder();
- authnRequestBuilder.id(UUID.randomUUID().toString());
- authnRequestBuilder.issuer("Test");
-
- }
-
- @Test
- public void prePreProcessGeneric() throws eIDPostProcessingException {
- String testCountry = "XX";
- authnRequestBuilder.citizenCountryCode(testCountry);
- preProcessor.preProcess(testCountry, pendingReq, authnRequestBuilder);
-
- LightRequest lightReq = authnRequestBuilder.build();
-
- Assert.assertEquals("ProviderName is not Static", Constants.DEFAULT_PROPS_EIDAS_NODE_STATIC_PROVIDERNAME_FOR_PUBLIC_SP, lightReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", lightReq.getSpType());
- Assert.assertEquals("Requested attribute size not match", 4, lightReq.getRequestedAttributes().size());
-
- }
-
- @Test
- public void prePreProcessGenericNoCountryCode() throws eIDPostProcessingException {
- String testCountry = "XX";
- authnRequestBuilder.citizenCountryCode(testCountry);
- preProcessor.preProcess(null, pendingReq, authnRequestBuilder);
-
- LightRequest lightReq = authnRequestBuilder.build();
-
- Assert.assertEquals("ProviderName is not Static", Constants.DEFAULT_PROPS_EIDAS_NODE_STATIC_PROVIDERNAME_FOR_PUBLIC_SP, lightReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", lightReq.getSpType());
- Assert.assertEquals("Requested attribute size not match", 4, lightReq.getRequestedAttributes().size());
-
- }
-
- @Test
- public void prePreProcessDE() throws eIDPostProcessingException {
-
- String testCountry = "DE";
- authnRequestBuilder.citizenCountryCode(testCountry);
- preProcessor.preProcess(testCountry, pendingReq, authnRequestBuilder);
-
- LightRequest lightReq = authnRequestBuilder.build();
-
- Assert.assertEquals("ProviderName is not Static", Constants.DEFAULT_PROPS_EIDAS_NODE_STATIC_PROVIDERNAME_FOR_PUBLIC_SP, lightReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", lightReq.getSpType());
- Assert.assertEquals("Requested attribute size not match", 8, lightReq.getRequestedAttributes().size());
-
- }
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingSecondTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingSecondTest.java
deleted file mode 100644
index c6b1c8d3..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/eIDASRequestPreProcessingSecondTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright 2018 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- *******************************************************************************/
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDPostProcessingException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service.CCSpecificEIDProcessingService;
-import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import eu.eidas.auth.commons.light.impl.LightRequest;
-import eu.eidas.auth.commons.light.impl.LightRequest.Builder;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
-public class eIDASRequestPreProcessingSecondTest {
-
- @Autowired private IConfigurationWithSP basicConfig;
- @Autowired private CCSpecificEIDProcessingService preProcessor;
-
- private TestRequestImpl pendingReq;
- private DummySpConfiguration oaParam;
- private Builder authnRequestBuilder;
-
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "src/test/resources/config/junit_config_1.properties");
-
- }
-
- @Before
- public void setUp() {
-
- Map<String, String> spConfig = new HashMap<>();
- spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp");
- spConfig.put("target", "urn:publicid:gv.at:cdid+XX");
- oaParam = new DummySpConfiguration(spConfig , basicConfig);
-
- pendingReq = new TestRequestImpl();
- pendingReq.setSpConfig(oaParam);
- pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
- pendingReq.setAuthUrl("http://test.com/");
-
- authnRequestBuilder = LightRequest.builder();
- authnRequestBuilder.id(UUID.randomUUID().toString());
- authnRequestBuilder.issuer("Test");
-
- }
-
- @Test
- public void prePreProcessDEUnknownAttribute() throws eIDPostProcessingException {
-
- String testCountry = "DE";
- authnRequestBuilder.citizenCountryCode(testCountry);
- preProcessor.preProcess(testCountry, pendingReq, authnRequestBuilder);
-
- LightRequest lightReq = authnRequestBuilder.build();
-
- Assert.assertEquals("ProviderName is not Static", "myNode", lightReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", lightReq.getSpType());
- Assert.assertEquals("Requested attribute size not match", 8, lightReq.getRequestedAttributes().size());
-
- }
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java
deleted file mode 100644
index d89f7751..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskFirstTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.tasks;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.GenerateAuthnRequestTask;
-import at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.dummy.DummySpecificCommunicationService;
-import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
-import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
-import at.gv.egiz.eaaf.core.exceptions.EaafException;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
-import eu.eidas.auth.commons.light.ILightRequest;
-import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
-public class GenerateAuthnRequestTaskFirstTest {
-
- @Autowired(required=true) private GenerateAuthnRequestTask task;
- @Autowired(required=true) private DummySpecificCommunicationService commService;
- @Autowired(required=true) private IConfiguration basicConfig;
-
- final ExecutionContext executionContext = new ExecutionContextImpl();
- private MockHttpServletRequest httpReq;
- private MockHttpServletResponse httpResp;
- private TestRequestImpl pendingReq;
- private DummySpConfiguration oaParam;
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "src/test/resources/config/junit_config_1.properties");
-
- }
-
- @Before
- public void setUp() {
-
- httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
- httpResp = new MockHttpServletResponse();
- RequestContextHolder.resetRequestAttributes();
- RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
-
- Map<String, String> spConfig = new HashMap<>();
- spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp");
- spConfig.put("target", "urn:publicid:gv.at:cdid+XX");
- oaParam = new DummySpConfiguration(spConfig , basicConfig);
-
- pendingReq = new TestRequestImpl();
- pendingReq.setSpConfig(oaParam);
- pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
- pendingReq.setAuthUrl("http://test.com/");
-
- }
-
- @Test
- @DirtiesContext
- public void withCustomStaticProviderNameForPublicSPs() throws TaskExecutionException, SpecificCommunicationException {
- executionContext.put(MSeIDASNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "CC");
-
- try {
- task.execute(pendingReq, executionContext);
-
- } catch (TaskExecutionException e) {
- //forward URL is not set in example config
- org.springframework.util.Assert.isInstanceOf(EaafConfigurationException.class, e.getOriginalException(), "Wrong exception");
- Assert.assertEquals("wrong errorCode", "config.08", ((EaafException) e.getOriginalException()).getErrorId());
- Assert.assertEquals("wrong parameter size", 1, ((EaafException) e.getOriginalException()).getParams().length);
- Assert.assertEquals("wrong errorMsg", Constants.CONIG_PROPS_EIDAS_NODE_FORWARD_URL, ((EaafException) e.getOriginalException()).getParams()[0]);
-
- }
-
- ILightRequest eIDASReq = commService.getAndRemoveRequest(null, null);
-
- Assert.assertEquals("ProviderName is not Static", "myNode", eIDASReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", eIDASReq.getSpType());
- Assert.assertEquals("wrong LoA", "http://eidas.europa.eu/LoA/high", eIDASReq.getLevelOfAssurance());
- }
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskSecondTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskSecondTest.java
deleted file mode 100644
index 8eac7d3f..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskSecondTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.tasks;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.eIDASAuthenticationException;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.GenerateAuthnRequestTask;
-import at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.dummy.DummySpecificCommunicationService;
-import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
-import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
-import at.gv.egiz.eaaf.core.exceptions.EaafException;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
-import eu.eidas.auth.commons.light.ILightRequest;
-import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
-public class GenerateAuthnRequestTaskSecondTest {
-
- @Autowired(required=true) private GenerateAuthnRequestTask task;
- @Autowired(required=true) private DummySpecificCommunicationService commService;
- @Autowired(required=true) private IConfiguration basicConfig;
-
- final ExecutionContext executionContext = new ExecutionContextImpl();
- private MockHttpServletRequest httpReq;
- private MockHttpServletResponse httpResp;
- private TestRequestImpl pendingReq;
- private DummySpConfiguration oaParam;
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "../../basicConfig/default_config.properties");
-
- }
-
- @Before
- public void setUp() {
-
- httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
- httpResp = new MockHttpServletResponse();
- RequestContextHolder.resetRequestAttributes();
- RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
-
- Map<String, String> spConfig = new HashMap<>();
- spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp");
- spConfig.put("target", "urn:publicid:gv.at:cdid+XX");
- oaParam = new DummySpConfiguration(spConfig , basicConfig);
-
- pendingReq = new TestRequestImpl();
- pendingReq.setSpConfig(oaParam);
- pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
- pendingReq.setAuthUrl("http://test.com/");
-
- }
-
- @Test
- public void noCountryCode() {
- try {
- task.execute(pendingReq, executionContext);
- Assert.fail("No countryCode not detected");
-
- } catch (TaskExecutionException e) {
- Assert.assertEquals("wrong pendingReqId", pendingReq.getPendingRequestId(), e.getPendingRequestID());
- org.springframework.util.Assert.isInstanceOf(eIDASAuthenticationException.class, e.getOriginalException(), "Wrong exception");
- Assert.assertEquals("wrong errorCode", "eidas.03", ((EaafException) e.getOriginalException()).getErrorId());
-
- }
-
- }
-
- @Test
- @DirtiesContext
- public void withStaticProviderNameForPublicSPs() throws TaskExecutionException, SpecificCommunicationException {
- executionContext.put(MSeIDASNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "CC");
-
- try {
- task.execute(pendingReq, executionContext);
-
- } catch (TaskExecutionException e) {
- //forward URL is not set in example config
- org.springframework.util.Assert.isInstanceOf(EaafConfigurationException.class, e.getOriginalException(), "Wrong exception");
- Assert.assertEquals("wrong errorCode", "config.08", ((EaafException) e.getOriginalException()).getErrorId());
- Assert.assertEquals("wrong parameter size", 1, ((EaafException) e.getOriginalException()).getParams().length);
- Assert.assertEquals("wrong errorMsg", Constants.CONIG_PROPS_EIDAS_NODE_FORWARD_URL, ((EaafException) e.getOriginalException()).getParams()[0]);
-
- }
-
- ILightRequest eIDASReq = commService.getAndRemoveRequest(null, null);
-
- Assert.assertEquals("ProviderName is not Static", Constants.DEFAULT_PROPS_EIDAS_NODE_STATIC_PROVIDERNAME_FOR_PUBLIC_SP, eIDASReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", eIDASReq.getSpType());
- Assert.assertEquals("wrong LoA", "http://eidas.europa.eu/LoA/high", eIDASReq.getLevelOfAssurance());
- }
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskThirdTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskThirdTest.java
deleted file mode 100644
index 429b2aca..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/tasks/GenerateAuthnRequestTaskThirdTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.tasks;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.annotation.DirtiesContext.ClassMode;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import at.asitplus.eidas.specific.connector.MSeIDASNodeConstants;
-import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.tasks.GenerateAuthnRequestTask;
-import at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2.dummy.DummySpecificCommunicationService;
-import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants;
-import at.gv.egiz.eaaf.core.api.idp.IConfiguration;
-import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext;
-import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.DummySpConfiguration;
-import at.gv.egiz.eaaf.core.impl.idp.module.test.TestRequestImpl;
-import at.gv.egiz.eaaf.core.impl.idp.process.ExecutionContextImpl;
-import eu.eidas.auth.commons.light.ILightRequest;
-import eu.eidas.specificcommunication.exception.SpecificCommunicationException;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration("/SpringTest-context_tasks_test.xml")
-@DirtiesContext(classMode = ClassMode.BEFORE_CLASS)
-public class GenerateAuthnRequestTaskThirdTest {
-
- @Autowired(required=true) private GenerateAuthnRequestTask task;
- @Autowired(required=true) private DummySpecificCommunicationService commService;
- @Autowired(required=true) private IConfiguration basicConfig;
-
- final ExecutionContext executionContext = new ExecutionContextImpl();
- private MockHttpServletRequest httpReq;
- private MockHttpServletResponse httpResp;
- private TestRequestImpl pendingReq;
- private DummySpConfiguration oaParam;
-
- @BeforeClass
- public static void classInitializer() throws IOException {
- final String current = new java.io.File( "." ).toURI().toString();
- System.setProperty("eidas.ms.configuration", current + "src/test/resources/config/junit_config_2.properties");
-
- }
-
- @Before
- public void setUp() {
-
- httpReq = new MockHttpServletRequest("POST", "https://localhost/authhandler");
- httpResp = new MockHttpServletResponse();
- RequestContextHolder.resetRequestAttributes();
- RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(httpReq, httpResp));
-
- Map<String, String> spConfig = new HashMap<>();
- spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp");
- spConfig.put("target", "urn:publicid:gv.at:cdid+XX");
- oaParam = new DummySpConfiguration(spConfig , basicConfig);
-
- pendingReq = new TestRequestImpl();
- pendingReq.setSpConfig(oaParam);
- pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue());
- pendingReq.setAuthUrl("http://test.com/");
-
-
- }
-
- @Test
- @DirtiesContext
- public void withDynamicProviderNameForPublicSPs() throws TaskExecutionException, SpecificCommunicationException {
- executionContext.put(MSeIDASNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "CC");
-
- task.execute(pendingReq, executionContext);
- Assert.assertEquals("Wrong http statusCode", 302, httpResp.getStatus());
-
- ILightRequest eIDASReq = commService.getAndRemoveRequest(null, null);
-
- Assert.assertNull("ProviderName found", eIDASReq.getProviderName());
- Assert.assertEquals("no PublicSP", "public", eIDASReq.getSpType());
- Assert.assertEquals("wrong LoA", "http://eidas.europa.eu/LoA/high", eIDASReq.getLevelOfAssurance());
- }
-
-}