diff options
author | Thomas <> | 2022-03-17 08:11:43 +0100 |
---|---|---|
committer | Thomas <> | 2022-03-17 08:11:43 +0100 |
commit | 7727b187019a3a6ff8f9d79819e878b4cb6b7d69 (patch) | |
tree | c3301480485a021a95f4d4ffa3669c52ab4ce4bd | |
parent | f74c5dab7982cb93d70611feecf10f3624657a36 (diff) | |
parent | 942fb62a525ca49dfd1845a309d9cbc76d612c17 (diff) | |
download | National_eIDAS_Gateway-7727b187019a3a6ff8f9d79819e878b4cb6b7d69.tar.gz National_eIDAS_Gateway-7727b187019a3a6ff8f9d79819e878b4cb6b7d69.tar.bz2 National_eIDAS_Gateway-7727b187019a3a6ff8f9d79819e878b4cb6b7d69.zip |
Merge branch 'nightlybuild' into feature/ms_proxy_before_refactoring
13 files changed, 245 insertions, 87 deletions
diff --git a/build_reporting/pom.xml b/build_reporting/pom.xml index c0a64c19..81f5e070 100644 --- a/build_reporting/pom.xml +++ b/build_reporting/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>at.asitplus.eidas</groupId> <artifactId>ms_specific</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <artifactId>build_reporting</artifactId> <packaging>pom</packaging> diff --git a/connector/pom.xml b/connector/pom.xml index abd008e2..87a22702 100644 --- a/connector/pom.xml +++ b/connector/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>at.asitplus.eidas</groupId> <artifactId>ms_specific</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.asitplus.eidas.ms_specific</groupId> diff --git a/infos/history.txt b/infos/history.txt index 53218f48..ac815270 100644 --- a/infos/history.txt +++ b/infos/history.txt @@ -1,5 +1,10 @@ Dieses Dokument zeigt die Veränderungen und Erweiterungen am eIDAS MS-Connector +Version 1.2.4 (2022-03-17): + - Bugfix + - Work-Around für insertErnp im ID Austria Betriebsmodus + - Akutalisierung von Drittherstellerbibliotheken + Version 1.2.3 (2021-10-21): - Bugfix - Inkompatibilität zwischen AT MS-Connector und ID Austria System behoben diff --git a/infos/readme_1.2.4.md b/infos/readme_1.2.4.md new file mode 100644 index 00000000..82a6588a --- /dev/null +++ b/infos/readme_1.2.4.md @@ -0,0 +1,58 @@ +# MS-Connector v1.2.4 Release vom 17.03.2022 + +Der MS-Connector implementiert eine Bridge zwischen dem österreichischen E-ID System und dem eIDAS Framework um ausländischen Benutzern eine Anmeldung am österreichischen Service-Providern zu ermöglichen. + +### Änderungen in dieser Version + + - Bugfix + - Work-Around für insertErnp im ID Austria Betriebsmodus +- Akutalisierung von Drittherstellerbibliotheken + + + + +### Durchführen eines Updates + +Nachfolgend finden Sie die erforderlichen Schritte für das Update eines bestehenden MS-specific eIDAS Connectors auf die aktuelle Version 1.2.4. Das vollständige Handbuch mit allen Konfigurationsparametern finden Sie im Releasepackage im Verzeichnis: _infos/handbook/_ + +### Ausgehend von einer bestehenden Version 1.2.x + +1. Stoppen Sie die *MS-Connector* Applikation und fertigen Sie eine Sicherungskopie Ihrer Applikation inklusive Konfiguration an +2. Entpacken Sie das Releasepacket *ms_specific_connector-1.2.4-dist.zip* in ein temporäres Verzeichnis welches in weiterer Folge __MsConnectorPackage__ bezeichnet wird. +3. Kopieren sie die Applikation __MsConnectorPackage__/ms_connector.war nach in das Applikationsverzeichnis ihres Applikationsservers + +### Ausgehend von einer bestehenden Version 1.1.0 + +1. Stoppen Sie die *MS-Connector* Applikation und fertigen Sie eine Sicherungskopie Ihrer Applikation inklusive Konfiguration an +2. Entpacken Sie das Releasepacket *ms_specific_connector-1.2.4-dist.zip* in ein temporäres Verzeichnis welches in weiterer Folge __MsConnectorPackage__ bezeichnet wird. +3. Kopieren sie die Applikation __MsConnectorPackage__/ms_connector.war nach in das Applikationsverzeichnis ihres Applikationsservers +4. Mit der Version 1.2.0 wurde die Konfiguration eine eine Minimalkonfiguration [`default_config.properties`](./../config/default_config.properties) und eine in den MS-Connectorintegrierte Defaultkonfiguration aufgteilt. Die nachfolgende Aufzählung umfasst die neuen oder geänderten Konfigurationsparameter, beschreibt jedoch keine Aufteilung einer bestehenden Konfiguration in Minimal- und Defaultteil. Eine vollständige Beschreibung aller Konfigurationswerte finden Sie im Handbuch zum AT MS-Connector. +5. Update bestehender Dateien . Die nachfolgenden Dateien wurden geändert und erfordern eine Anpassung oder eine Übernahme dem Releasepacket, sofern die Anpassung nicht bereits durchgeführt wurde. Sofern die entsprechenden Datein an die bestehende Infrastruktur angepasst wurden so müssen diese Änderungen übernommen werden. + - __MsConnectorPackage__/config/templates/error_message.html + - __MsConnectorPackage__/config/eIDAS/igniteSpecificCommunication.xml + Hinweis: Siehe auch Update-Hinweise zur EIDAS-Node v2.5 +6. Erstellung neuer Dateien + - _KeyStore für ID Austria AuthBlock:_ Erstellen eines KeyStore mit mit öffentlichem und privaten Schlüssel welcher für die JWS Signature des technischen ID Austria AuthBlocks verwendet werden soll. +7. Neue Konfigurationsparameter + - *Allgemeine Konfiguration* + - ```eidas.ms.core.configRootDir``` + - *ID Austria Umsetzung* + - ```eidas.ms.auth.eIDAS.authblock.keystore.type``` + - ```eidas.ms.auth.eIDAS.authblock.keystore.path``` + - ```eidas.ms.auth.eIDAS.authblock.keystore.password``` + - ```eidas.ms.auth.eIDAS.authblock.key.alias``` + - ```eidas.ms.auth.eIDAS.authblock.key.password``` + - *Service-Provider Konfiguration Konfiguration* + - ```eidas.ms.sp.x.newEidMode``` +8. Gelöschte Konfigurationsparameter + + - ```authhandler.modules.bindingservice.bpk.target``` +9. Neue optionale Konfigurationsparameter + - *Allgemeine Konfiguration* + - ```eidas.ms.core.logging.level.info.errorcodes``` + - *eIDAS Node Kommunikation* + * ```eidas.ms.auth.eIDAS.node_v2.requesterId.useHashedForm``` + * ```eidas.ms.auth.eIDAS.node_v2.requesterId.lu.useStaticRequesterForAll``` + - *ID Austria Umsetzung* + - ```eidas.ms.auth.eIDAS.eid.testidentity.default``` + - ```eidas.ms.auth.eIDAS.szrclient.eidasbind.mds.inject``` diff --git a/modules/authmodule-eIDAS-v2/pom.xml b/modules/authmodule-eIDAS-v2/pom.xml index f16edb2d..ff9cc5ce 100644 --- a/modules/authmodule-eIDAS-v2/pom.xml +++ b/modules/authmodule-eIDAS-v2/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>modules</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.asitplus.eidas.ms_specific.modules</groupId> <artifactId>authmodule-eIDAS-v2</artifactId> diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java index 1f5837d6..5558fdfd 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java @@ -234,7 +234,7 @@ public class SzrClient { final String resp; try { - resp = this.szr.getStammzahlEncrypted(personInfo, true); + resp = this.szr.getStammzahlEncrypted(personInfo, false); } catch (SZRException_Exception e) { throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e); } diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java index 6b1b96de..18ddab42 100644 --- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java +++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java @@ -55,6 +55,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidPr import at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils; import at.gv.e_government.reference.namespace.persondata._20020228.AlternativeNameType; +import at.gv.e_government.reference.namespace.persondata._20020228.IdentificationType; 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; @@ -62,6 +63,7 @@ import at.gv.egiz.eaaf.core.api.data.PvpAttributeDefinitions; 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.api.idp.process.ExecutionContext; +import at.gv.egiz.eaaf.core.exceptions.EaafBuilderException; import at.gv.egiz.eaaf.core.exceptions.EaafException; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; import at.gv.egiz.eaaf.core.impl.builder.BpkBuilder; @@ -147,9 +149,12 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { //request SZR based on IDL or E-ID mode if (pendingReq.getServiceProviderConfiguration() .isConfigurationValue(MsEidasNodeConstants.PROP_CONFIG_SP_NEW_EID_MODE, false)) { - + + // work-around, because getEncryptedStammzahl does not support insertERnP for eIDAS entities + SzrResultHolder idlResult = requestSzrForIdentityLink(personInfo); + // get encrypted baseId - String vsz = szrClient.getEncryptedStammzahl(personInfo); + String vsz = szrClient.getEncryptedStammzahl(buildGetEncryptedBaseIdReq(idlResult.identityLink)); //write revision-Log entry and extended infos personal-identifier mapping revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_VSZ_RECEIVED); @@ -219,6 +224,33 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { } } + private PersonInfoType buildGetEncryptedBaseIdReq(IIdentityLink identityLink) throws EaafBuilderException { + log.debug("Generating getVsz request from identityLink information ... "); + final PersonInfoType personInfo = new PersonInfoType(); + final PersonNameType personName = new PersonNameType(); + final PhysicalPersonType naturalPerson = new PhysicalPersonType(); + IdentificationType bpk = new IdentificationType(); + + naturalPerson.setName(personName); + personInfo.setPerson(naturalPerson); + naturalPerson.setIdentification(bpk); + + // person information + personName.setFamilyName(identityLink.getFamilyName()); + personName.setGivenName(identityLink.getGivenName()); + naturalPerson.setDateOfBirth(identityLink.getDateOfBirth()); + + final Pair<String, String> bpkCalc = + BpkBuilder.generateAreaSpecificPersonIdentifier( + identityLink.getIdentificationValue(), + identityLink.getIdentificationType(), + EaafConstants.URN_PREFIX_CDID + "ZP"); + bpk.setValue(bpkCalc.getFirst()); + bpk.setType(bpkCalc.getSecond()); + return personInfo; + + } + private void writeExtendedRevisionLogEntry(Map<String, Object> simpleAttrMap, ErnbEidData eidData) { // write ERnB input-data into revision-log if (basicConfig.getBasicConfigurationBoolean( @@ -307,7 +339,6 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { } else { log.debug("Calculating bPK from baseId ... "); - new BpkBuilder(); final Pair<String, String> bpkCalc = BpkBuilder .generateAreaSpecificPersonIdentifier(identityLink.getIdentificationValue(), identityLink.getIdentificationType(), diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java index 1e7ff369..83d7866e 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java @@ -53,12 +53,16 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenti import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils; +import at.gv.e_government.reference.namespace.persondata._20020228.IdentificationType; 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.EaafBuilderException; import at.gv.egiz.eaaf.core.exceptions.EaafParserException; +import at.gv.egiz.eaaf.core.impl.builder.BpkBuilder; +import at.gv.egiz.eaaf.core.impl.data.Pair; import at.gv.egiz.eaaf.core.impl.data.Triple; import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; import szrservices.IdentityLinkType; @@ -103,7 +107,39 @@ public class SzrClientTestProduction { Assert.assertNotNull("vsz", vsz); } - + + @Test + public void getVszRandom() throws SzrCommunicationException, EidasSAuthenticationException, EaafBuilderException { + + final String givenName = "Franz"; + final String familyName = RandomStringUtils.randomAlphabetic(10); + final String dateOfBirth = "1989-05-04"; + final String eIDASeID = "IS/AT/" + RandomStringUtils.randomAlphanumeric(20); + + IdentityLinkType idl = szrClient.getIdentityLinkInRawMode(getPersonInfo(familyName, givenName, dateOfBirth, eIDASeID)); + + PersonInfoType vszPerson = getPersonInfo( + idl.getPersonInfo().getPerson().getName().getFamilyName(), + idl.getPersonInfo().getPerson().getName().getGivenName(), + idl.getPersonInfo().getPerson().getDateOfBirth(), + null); + + final Pair<String, String> bpkCalc = + BpkBuilder.generateAreaSpecificPersonIdentifier( + idl.getPersonInfo().getPerson().getIdentification().getValue(), + idl.getPersonInfo().getPerson().getIdentification().getType(), + EaafConstants.URN_PREFIX_CDID + "ZP"); + + IdentificationType vszId = new IdentificationType(); + vszPerson.getPerson().setIdentification(vszId); + vszId.setValue(bpkCalc.getFirst()); + vszId.setType(bpkCalc.getSecond()); + + String vsz = szrClient.getEncryptedStammzahl(vszPerson); + Assert.assertNotNull("vsz", vsz); + + } + @Test public void getEidasBind() throws SzrCommunicationException, EidasSAuthenticationException { String vsz = RandomStringUtils.randomAlphanumeric(10); @@ -204,6 +240,13 @@ public class SzrClientTestProduction { } private PersonInfoType getPersonInfo() throws EidasSAuthenticationException { + return getPersonInfo(familyName, givenName, dateOfBirth, eIDASeID); + + } + + private PersonInfoType getPersonInfo(String familyName, String givenName, String dateOfBirth, String eIDASeID) + throws EidasSAuthenticationException { + final PersonInfoType personInfo = new PersonInfoType(); final PersonNameType personName = new PersonNameType(); final PhysicalPersonType naturalPerson = new PhysicalPersonType(); @@ -211,26 +254,32 @@ public class SzrClientTestProduction { naturalPerson.setName(personName); personInfo.setPerson(naturalPerson); - personInfo.setTravelDocument(eDocument); - - // parse some eID attributes - final Triple<String, String, String> eIdentifier = - EidasResponseUtils.parseEidasPersonalIdentifier(eIDASeID); - final String uniqueId = createHashFromUniqueId(eIdentifier.getThird()); - final String citizenCountry = eIdentifier.getFirst(); // person information personName.setFamilyName(familyName); personName.setGivenName(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)); + + // parse some eID attributes + if (eIDASeID != null) { + final Triple<String, String, String> eIdentifier = + EidasResponseUtils.parseEidasPersonalIdentifier(eIDASeID); + final String uniqueId = createHashFromUniqueId(eIdentifier.getThird()); + final String citizenCountry = eIdentifier.getFirst(); + + 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)); + + personInfo.setTravelDocument(eDocument); + + } return personInfo; - } + + } } diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java index 7aab1f3e..fd2e589b 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java @@ -18,6 +18,9 @@ import java.util.List; import java.util.Map; import javax.annotation.Nonnull; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; import org.apache.commons.lang3.RandomStringUtils; import org.jose4j.jwa.AlgorithmConstraints; @@ -74,9 +77,11 @@ import eu.eidas.auth.commons.attribute.ImmutableAttributeMap; import eu.eidas.auth.commons.attribute.ImmutableAttributeMap.Builder; import eu.eidas.auth.commons.protocol.impl.AuthenticationResponse; import lombok.val; +import szrservices.GetIdentityLinkEidasResponse; import szrservices.JwsHeaderParam; import szrservices.PersonInfoType; import szrservices.SZR; +import szrservices.SZRException_Exception; import szrservices.SignContentEntry; import szrservices.SignContentResponseType; @@ -167,7 +172,8 @@ public class CreateIdentityLinkTaskEidNewTest { response = buildDummyAuthResponse(true); pendingReq.getSessionData(AuthProcessDataWrapper.class) .setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response); - + + setSzrResponseIdentityLink("/data/szr/szr_resp_valid_1.xml"); String vsz = RandomStringUtils.randomNumeric(10); when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(vsz); val signContentResp = new SignContentResponseType(); @@ -231,39 +237,31 @@ public class CreateIdentityLinkTaskEidNewTest { verify(szrMock, times(1)).getStammzahlEncrypted(argument4.capture(), argument5.capture()); Boolean param5 = argument5.getValue(); - Assert.assertTrue("insertERnP flag", param5); + Assert.assertFalse("insertERnP flag", param5); PersonInfoType person = argument4.getValue(); - Assert.assertEquals("FamilyName", - response.getAttributes().getAttributeValuesByFriendlyName("FamilyName").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("FamilyName").iterator().next()), - person.getPerson().getName().getFamilyName()); - Assert.assertEquals("GivenName", - response.getAttributes().getAttributeValuesByFriendlyName("FirstName").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("FirstName").iterator().next()), - person.getPerson().getName().getGivenName()); - Assert.assertEquals("DateOfBirth", - response.getAttributes().getAttributeValuesByFriendlyName("DateOfBirth").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("DateOfBirth").iterator().next()) - .toString().split("T")[0], - person.getPerson().getDateOfBirth()); - - Assert.assertEquals("PlaceOfBirth", - response.getAttributes().getAttributeValuesByFriendlyName("PlaceOfBirth").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("PlaceOfBirth").iterator().next()), - person.getPerson().getPlaceOfBirth()); - Assert.assertEquals("BirthName", - response.getAttributes().getAttributeValuesByFriendlyName("BirthName").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("BirthName").iterator().next()), - person.getPerson().getAlternativeName().getFamilyName()); - - Assert.assertEquals("CitizenCountry", "LU", person.getTravelDocument().getIssuingCountry()); - Assert.assertEquals("DocumentType", "ELEKTR_DOKUMENT", person.getTravelDocument().getDocumentType()); + Assert.assertEquals("FamilyName", "Mustermann", person.getPerson().getName().getFamilyName()); + Assert.assertEquals("GivenName", "Hans", person.getPerson().getName().getGivenName()); + Assert.assertEquals("DateOfBirth", "1989-05-05", person.getPerson().getDateOfBirth()); + Assert.assertEquals("bpk", "1NjpYBHFn6onfNp2pCM8nXrlyQc=", person.getPerson().getIdentification().getValue()); + Assert.assertEquals("bPKType", EaafConstants.URN_PREFIX_CDID + "ZP", person.getPerson().getIdentification().getType()); - Assert.assertEquals("Identifier", - response.getAttributes().getAttributeValuesByFriendlyName("PersonIdentifier").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("PersonIdentifier").iterator().next()) - .toString().split("/")[2], - person.getTravelDocument().getDocumentNumber()); +// Assert.assertEquals("PlaceOfBirth", +// response.getAttributes().getAttributeValuesByFriendlyName("PlaceOfBirth").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("PlaceOfBirth").iterator().next()), +// person.getPerson().getPlaceOfBirth()); +// Assert.assertEquals("BirthName", +// response.getAttributes().getAttributeValuesByFriendlyName("BirthName").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("BirthName").iterator().next()), +// person.getPerson().getAlternativeName().getFamilyName()); +// +// Assert.assertEquals("CitizenCountry", "LU", person.getTravelDocument().getIssuingCountry()); +// Assert.assertEquals("DocumentType", "ELEKTR_DOKUMENT", person.getTravelDocument().getDocumentType()); +// +// Assert.assertEquals("Identifier", +// response.getAttributes().getAttributeValuesByFriendlyName("PersonIdentifier").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("PersonIdentifier").iterator().next()) +// .toString().split("/")[2], +// person.getTravelDocument().getDocumentNumber()); // check bcBind singing request ArgumentCaptor<Boolean> argument1 = ArgumentCaptor.forClass(Boolean.class); @@ -307,6 +305,7 @@ public class CreateIdentityLinkTaskEidNewTest { @Test public void successfulProcessWithStandardInfos() throws Exception { //initialize test + setSzrResponseIdentityLink("/data/szr/szr_resp_valid_1.xml"); String vsz = RandomStringUtils.randomNumeric(10); when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(vsz); val signContentResp = new SignContentResponseType(); @@ -369,34 +368,34 @@ public class CreateIdentityLinkTaskEidNewTest { ArgumentCaptor<Boolean> argument5 = ArgumentCaptor.forClass(Boolean.class); verify(szrMock, times(1)).getStammzahlEncrypted(argument4.capture(), argument5.capture()); - Boolean param5 = argument5.getValue(); - Assert.assertTrue("insertERnP flag", param5); - PersonInfoType person = argument4.getValue(); - Assert.assertEquals("FamilyName", - response.getAttributes().getAttributeValuesByFriendlyName("FamilyName").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("FamilyName").iterator().next()), - person.getPerson().getName().getFamilyName()); - Assert.assertEquals("GivenName", - response.getAttributes().getAttributeValuesByFriendlyName("FirstName").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("FirstName").iterator().next()), - person.getPerson().getName().getGivenName()); - Assert.assertEquals("DateOfBirth", - response.getAttributes().getAttributeValuesByFriendlyName("DateOfBirth").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("DateOfBirth").iterator().next()) - .toString().split("T")[0], - person.getPerson().getDateOfBirth()); - - Assert.assertNull("PlaceOfBirth", person.getPerson().getPlaceOfBirth()); - Assert.assertNull("BirthName", person.getPerson().getAlternativeName()); - - Assert.assertEquals("CitizenCountry", "LU", person.getTravelDocument().getIssuingCountry()); - Assert.assertEquals("DocumentType", "ELEKTR_DOKUMENT", person.getTravelDocument().getDocumentType()); - - Assert.assertEquals("Identifier", - response.getAttributes().getAttributeValuesByFriendlyName("PersonIdentifier").getFirstValue( - response.getAttributes().getDefinitionsByFriendlyName("PersonIdentifier").iterator().next()) - .toString().split("/")[2], - person.getTravelDocument().getDocumentNumber()); +// Boolean param5 = argument5.getValue(); +// Assert.assertTrue("insertERnP flag", param5); +// PersonInfoType person = argument4.getValue(); +// Assert.assertEquals("FamilyName", +// response.getAttributes().getAttributeValuesByFriendlyName("FamilyName").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("FamilyName").iterator().next()), +// person.getPerson().getName().getFamilyName()); +// Assert.assertEquals("GivenName", +// response.getAttributes().getAttributeValuesByFriendlyName("FirstName").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("FirstName").iterator().next()), +// person.getPerson().getName().getGivenName()); +// Assert.assertEquals("DateOfBirth", +// response.getAttributes().getAttributeValuesByFriendlyName("DateOfBirth").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("DateOfBirth").iterator().next()) +// .toString().split("T")[0], +// person.getPerson().getDateOfBirth()); +// +// Assert.assertNull("PlaceOfBirth", person.getPerson().getPlaceOfBirth()); +// Assert.assertNull("BirthName", person.getPerson().getAlternativeName()); +// +// Assert.assertEquals("CitizenCountry", "LU", person.getTravelDocument().getIssuingCountry()); +// Assert.assertEquals("DocumentType", "ELEKTR_DOKUMENT", person.getTravelDocument().getDocumentType()); +// +// Assert.assertEquals("Identifier", +// response.getAttributes().getAttributeValuesByFriendlyName("PersonIdentifier").getFirstValue( +// response.getAttributes().getDefinitionsByFriendlyName("PersonIdentifier").iterator().next()) +// .toString().split("/")[2], +// person.getTravelDocument().getDocumentNumber()); } @@ -404,6 +403,7 @@ public class CreateIdentityLinkTaskEidNewTest { @Test public void getStammzahlEncryptedExceptionTest() throws Exception { try { + setSzrResponseIdentityLink("/data/szr/szr_resp_valid_1.xml"); when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(null); task.execute(pendingReq, executionContext); } catch (TaskExecutionException e) { @@ -418,6 +418,7 @@ public class CreateIdentityLinkTaskEidNewTest { @Test public void signContentExceptionTest() throws Exception { try { + setSzrResponseIdentityLink("/data/szr/szr_resp_valid_1.xml"); when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); when(szrMock, "signContent", any(), any(), any()).thenReturn(null); task.execute(pendingReq, executionContext); @@ -452,6 +453,20 @@ public class CreateIdentityLinkTaskEidNewTest { } + + @Nonnull + private void setSzrResponseIdentityLink(String responseXmlPath) throws JAXBException, SZRException_Exception { + final JAXBContext jaxbContext = JAXBContext + .newInstance(szrservices.ObjectFactory.class, org.w3._2001._04.xmldsig_more.ObjectFactory.class, + org.w3._2000._09.xmldsig.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)); + org.mockito.Mockito.when(szrMock.getIdentityLinkEidas(any(PersonInfoType.class))).thenReturn(szrResponse.getGetIdentityLinkReturn()); + + } + @Nonnull private AuthenticationResponse buildDummyAuthResponse(boolean withAll) throws URISyntaxException { final AttributeDefinition attributeDef = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( diff --git a/modules/core_common_lib/pom.xml b/modules/core_common_lib/pom.xml index a27c20e3..3cf4e66c 100644 --- a/modules/core_common_lib/pom.xml +++ b/modules/core_common_lib/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>modules</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <artifactId>core_common_lib</artifactId> <name>ms_specific_common_lib</name> diff --git a/modules/core_common_webapp/pom.xml b/modules/core_common_webapp/pom.xml index 27dab9d1..4121a8f3 100644 --- a/modules/core_common_webapp/pom.xml +++ b/modules/core_common_webapp/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>modules</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <artifactId>core_common_webapp</artifactId> <name>WebApplication commons</name> diff --git a/modules/pom.xml b/modules/pom.xml index dd236a0a..a431d429 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>at.asitplus.eidas</groupId> <artifactId>ms_specific</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> </parent> <groupId>at.asitplus.eidas.ms_specific</groupId> <artifactId>modules</artifactId> @@ -5,7 +5,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>at.asitplus.eidas</groupId> <artifactId>ms_specific</artifactId> - <version>1.2.4-SNAPSHOT</version> + <version>1.3.0-SNAPSHOT</version> <packaging>pom</packaging> <name>MS specific eIDAS components</name> |