diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2022-08-17 10:51:54 +0000 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2022-08-17 10:51:54 +0000 |
commit | d83cf36c1454a10f5a46d677b5f0f30e0cbe7e95 (patch) | |
tree | 1cf2bf2853d604d8579cc3f5bf411d10f80c0207 /modules/authmodule-eIDAS-v2/src/test | |
parent | 48f19dc45cec670fe62399d09fb34732fb4eeedc (diff) | |
parent | 920d33465e5ab1a71d81cc280e41de10cd8b5247 (diff) | |
download | National_eIDAS_Gateway-d83cf36c1454a10f5a46d677b5f0f30e0cbe7e95.tar.gz National_eIDAS_Gateway-d83cf36c1454a10f5a46d677b5f0f30e0cbe7e95.tar.bz2 National_eIDAS_Gateway-d83cf36c1454a10f5a46d677b5f0f30e0cbe7e95.zip |
Merge branch 'feature/ms_proxy_service' into 'nightlybuild'
add basic implementation of eIDAS-Node Proxy-Service request-controller
See merge request egiz/eidas_at_proxy!20
Diffstat (limited to 'modules/authmodule-eIDAS-v2/src/test')
18 files changed, 145 insertions, 159 deletions
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasSignalServletTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasSignalServletTest.java index 4d4ac47d..3bc06092 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasSignalServletTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/EidasSignalServletTest.java @@ -29,7 +29,8 @@ import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummySpConfi import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.EidasSignalServlet; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateIdentityLinkTask; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummySpecificCommunicationService; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.test.dummy.DummySpecificCommunicationService; import at.gv.egiz.eaaf.core.api.IRequestStorage; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; import at.gv.egiz.eaaf.core.api.data.EaafConstants; @@ -138,7 +139,7 @@ public class EidasSignalServletTest { iLightResponse.id("_".concat(Random.nextHexRandom16())) .issuer(RandomStringUtils.randomAlphabetic(10)) .subject(RandomStringUtils.randomAlphabetic(10)) - .statusCode(Constants.SUCCESS_URI) + .statusCode(EidasConstants.SUCCESS_URI) .inResponseTo("_".concat(Random.nextHexRandom16())) .subjectNameIdFormat("afaf") .relayState(relayState); @@ -177,7 +178,7 @@ public class EidasSignalServletTest { iLightResponse.id("_".concat(Random.nextHexRandom16())) .issuer(RandomStringUtils.randomAlphabetic(10)) .subject(RandomStringUtils.randomAlphabetic(10)) - .statusCode(Constants.SUCCESS_URI) + .statusCode(EidasConstants.SUCCESS_URI) .inResponseTo(inResponseTo) .subjectNameIdFormat("afaf"); @@ -213,7 +214,7 @@ public class EidasSignalServletTest { iLightResponse.id("_".concat(Random.nextHexRandom16())) .issuer(RandomStringUtils.randomAlphabetic(10)) .subject(RandomStringUtils.randomAlphabetic(10)) - .statusCode(Constants.SUCCESS_URI) + .statusCode(EidasConstants.SUCCESS_URI) .inResponseTo(inResponseTo) .subjectNameIdFormat("afaf"); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java index cb9df7e5..af1867e7 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientProductionTest.java @@ -19,12 +19,12 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrSoapClient; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrSoapClient.ZmrRegisterResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.LoggingHandler; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; import at.gv.bmi.namespace.zmr_su.zmr._20040201.EidasSuchdatenType; import at.gv.bmi.namespace.zmr_su.zmr._20040201.PersonSuchenRequest; import at.gv.e_government.reference.namespace.persondata.de._20040201.NatuerlichePersonTyp; @@ -453,9 +453,9 @@ public class ZmrClientProductionTest { searchNatPerson.setGeburtsdatum(dateOfBirth); // add addtional eIDAS attributes if available - addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PLACEOFBIRTH, placeOfBirth); - addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_BIRTHNAME, birthName); - addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER, personalId); + addIfAvailable(req.getEidasSuchdaten(), cc, EidasConstants.eIDAS_ATTRURN_PLACEOFBIRTH, placeOfBirth); + addIfAvailable(req.getEidasSuchdaten(), cc, EidasConstants.eIDAS_ATTRURN_BIRTHNAME, birthName); + addIfAvailable(req.getEidasSuchdaten(), cc, EidasConstants.eIDAS_ATTRURN_PERSONALIDENTIFIER, personalId); return req; diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java index 4e0a1f28..ef9cc9b7 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/ZmrClientTest.java @@ -38,7 +38,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.github.skjolber.mockito.soap.SoapServiceRule; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummyConfigMap; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrSoapClient; import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.zmr.ZmrSoapClient.ZmrRegisterResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.controller.AdresssucheController.AdresssucheOutput; @@ -46,6 +45,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.RegisterResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; import at.gv.bmi.namespace.zmr_su.base._20040201.RequestType; import at.gv.bmi.namespace.zmr_su.base._20040201.ResponseType; import at.gv.bmi.namespace.zmr_su.base._20040201_.ServicePort; @@ -1139,9 +1139,9 @@ public class ZmrClientTest { searchNatPerson.setGeburtsdatum(dateOfBirth); // add addtional eIDAS attributes if available - addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PLACEOFBIRTH, placeOfBirth); - addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_BIRTHNAME, birthName); - addIfAvailable(req.getEidasSuchdaten(), cc, Constants.eIDAS_ATTRURN_PERSONALIDENTIFIER, personalId); + addIfAvailable(req.getEidasSuchdaten(), cc, EidasConstants.eIDAS_ATTRURN_PLACEOFBIRTH, placeOfBirth); + addIfAvailable(req.getEidasSuchdaten(), cc, EidasConstants.eIDAS_ATTRURN_BIRTHNAME, birthName); + addIfAvailable(req.getEidasSuchdaten(), cc, EidasConstants.eIDAS_ATTRURN_PERSONALIDENTIFIER, personalId); return req; diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/dummy/DummySpecificCommunicationService.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/dummy/DummySpecificCommunicationService.java deleted file mode 100644 index d2b0c1ae..00000000 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/dummy/DummySpecificCommunicationService.java +++ /dev/null @@ -1,58 +0,0 @@ -package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.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 lightRequest; - private ILightResponse lightResponse; - - @Override - public BinaryLightToken putRequest(ILightRequest lightRequest) throws SpecificCommunicationException { - this.lightRequest = lightRequest; - return BinaryLightTokenHelper.createBinaryLightToken("Test", "TestSecret", "SHA-256"); - } - - @Override - public ILightRequest getAndRemoveRequest(String tokenBase64, Collection<AttributeDefinition<?>> registry) - throws SpecificCommunicationException { - return lightRequest; - } - - @Override - public BinaryLightToken putResponse(ILightResponse lightResponse) throws SpecificCommunicationException { - this.lightResponse = lightResponse; - return BinaryLightTokenHelper.createBinaryLightToken("Test", "TestSecret", "SHA-256"); - } - - @Override - public ILightResponse getAndRemoveResponse(String tokenBase64, Collection<AttributeDefinition<?>> registry) - throws SpecificCommunicationException { - return lightResponse; - } - - public ILightRequest getiLightRequest() { - return lightRequest; - } - - public void setiLightRequest(ILightRequest lightReques) { - this.lightRequest = lightReques; - } - - public ILightResponse getiLightResponse() { - return lightResponse; - } - - public void setiLightResponse(ILightResponse lightResponse) { - this.lightResponse = lightResponse; - } - -} diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java index 682db41e..176e95cb 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/AlternativeSearchTaskWithRegisterTest.java @@ -67,6 +67,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchSe import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.AlternativeSearchTask; import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients.ZmrClientTest; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; import at.gv.bmi.namespace.zmr_su.base._20040201.RequestType; import at.gv.bmi.namespace.zmr_su.base._20040201.ResponseType; import at.gv.bmi.namespace.zmr_su.base._20040201_.ServicePort; @@ -913,24 +914,24 @@ public class AlternativeSearchTaskWithRegisterTest { String dateOfBirth, String taxNumber, String placeOfBirth, String birthName) throws URISyntaxException { ImmutableAttributeMap.Builder builder = ImmutableAttributeMap.builder() - .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER, randomAlphabetic(2), randomAlphabetic(2)), identifier) - .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME, randomAlphabetic(3), randomAlphabetic(3)), familyName) - .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME, randomAlphabetic(4), randomAlphabetic(4)), givenName) - .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH, + .put(generateDateTimeAttribute(EidasConstants.eIDAS_ATTR_DATEOFBIRTH, randomAlphabetic(5), randomAlphabetic(5)), dateOfBirth); if (taxNumber != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_TAXREFERENCE, randomAlphabetic(6), randomAlphabetic(6)), taxNumber); } if (birthName != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_BIRTHNAME, randomAlphabetic(7), randomAlphabetic(7)), birthName); } if (placeOfBirth != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_PLACEOFBIRTH, randomAlphabetic(8), randomAlphabetic(8)), placeOfBirth); } final ImmutableAttributeMap attributeMap = builder.build(); 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 023c196c..36c0c2af 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 @@ -57,13 +57,14 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.EidasAttributeRegistry; import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateIdentityLinkTask; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.JoseUtils; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.JoseUtils.JwsResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.service.EidasAttributeRegistry; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; @@ -605,18 +606,18 @@ public class CreateIdentityLinkTaskEidNewTest { @Nonnull private AuthenticationResponse buildDummyAuthResponse(boolean withAll, boolean withEmpty) throws URISyntaxException { final AttributeDefinition attributeDef = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); + EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); final AttributeDefinition attributeDef2 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); final AttributeDefinition attributeDef3 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTGIVENNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME).first(); final AttributeDefinition attributeDef4 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_DATEOFBIRTH).first(); + EidasConstants.eIDAS_ATTR_DATEOFBIRTH).first(); final AttributeDefinition attributeDef5 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_PLACEOFBIRTH).first(); + EidasConstants.eIDAS_ATTR_PLACEOFBIRTH).first(); final AttributeDefinition attributeDef6 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_BIRTHNAME).first(); - + EidasConstants.eIDAS_ATTR_BIRTHNAME).first(); + final Builder attributeMap = ImmutableAttributeMap.builder(); attributeMap.put(attributeDef, "LU/AT/" + RandomStringUtils.randomNumeric(64)); attributeMap.put(attributeDef2, RandomStringUtils.randomAlphabetic(10)); @@ -638,7 +639,7 @@ public class CreateIdentityLinkTaskEidNewTest { return b.id("_".concat(Random.nextHexRandom16())) .issuer(RandomStringUtils.randomAlphabetic(10)) .subject(RandomStringUtils.randomAlphabetic(10)) - .statusCode(Constants.SUCCESS_URI) + .statusCode(EidasConstants.SUCCESS_URI) .inResponseTo("_".concat(Random.nextHexRandom16())) .subjectNameIdFormat("afaf") .levelOfAssurance(EaafConstants.EIDAS_LOA_PREFIX + RandomStringUtils.randomAlphabetic(5)) diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskTest.java index 5c528532..5db6e95d 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskTest.java @@ -41,11 +41,12 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.EidasAttributeRegistry; import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ICcSpecificEidProcessingService; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.CreateIdentityLinkTask; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.EidasResponseUtils; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.service.EidasAttributeRegistry; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; @@ -475,13 +476,13 @@ public class CreateIdentityLinkTaskTest { @NotNull private AuthenticationResponse buildDummyAuthResponse() throws URISyntaxException { final AttributeDefinition attributeDef = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); + EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); final AttributeDefinition attributeDef2 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); final AttributeDefinition attributeDef3 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTGIVENNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME).first(); final AttributeDefinition attributeDef4 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_DATEOFBIRTH).first(); + EidasConstants.eIDAS_ATTR_DATEOFBIRTH).first(); final ImmutableAttributeMap attributeMap = ImmutableAttributeMap.builder() .put(attributeDef, "LU/AT/" + RandomStringUtils.randomNumeric(64)) diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAuthnRequestTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAuthnRequestTaskTest.java index 763d7d39..761738aa 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAuthnRequestTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/GenerateAuthnRequestTaskTest.java @@ -26,7 +26,8 @@ import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummyConfigM import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.GenerateAuthnRequestTask; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummySpecificCommunicationService; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.test.dummy.DummySpecificCommunicationService; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; import at.gv.egiz.eaaf.core.api.data.EaafConstants; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; @@ -138,7 +139,7 @@ public class GenerateAuthnRequestTaskTest { .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 + Assert.assertEquals("wrong errorMsg", EidasConstants.CONIG_PROPS_EIDAS_CONNECTOR_NODE_FORWARD_URL, ((EaafException) e .getOriginalException()).getParams()[0]); } @@ -163,7 +164,7 @@ public class GenerateAuthnRequestTaskTest { .getErrorId()); Assert.assertEquals("wrong parameter size", 1, ((EaafException) e.getOriginalException()) .getParams().length); - Assert.assertEquals("wrong errorMsg", Constants.CONIG_PROPS_EIDAS_NODE_FORWARD_URL + "." + stage, ((EaafException) e + Assert.assertEquals("wrong errorMsg", EidasConstants.CONIG_PROPS_EIDAS_CONNECTOR_NODE_FORWARD_URL + "." + stage, ((EaafException) e .getOriginalException()).getParams()[0]); } diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java index 74ac065e..eef31a02 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskTest.java @@ -83,6 +83,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchSe import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.RegisterSearchService.RegisterStatusResults; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; import at.gv.bmi.namespace.zmr_su.zmr._20040201.PersonSuchenRequest; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; @@ -887,24 +888,24 @@ public class InitialSearchTaskTest { String dateOfBirth, String taxNumber, String placeOfBirth, String birthName) throws URISyntaxException { ImmutableAttributeMap.Builder builder = ImmutableAttributeMap.builder() - .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER, randomAlphabetic(2), randomAlphabetic(2)), identifier) - .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME, randomAlphabetic(3), randomAlphabetic(3)), familyName) - .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME, randomAlphabetic(4), randomAlphabetic(4)), givenName) - .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH, + .put(generateDateTimeAttribute(EidasConstants.eIDAS_ATTR_DATEOFBIRTH, randomAlphabetic(5), randomAlphabetic(5)), dateOfBirth); if (taxNumber != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_TAXREFERENCE, randomAlphabetic(6), randomAlphabetic(6)), taxNumber); } if (birthName != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_BIRTHNAME, randomAlphabetic(7), randomAlphabetic(7)), birthName); } if (placeOfBirth != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_PLACEOFBIRTH, randomAlphabetic(8), randomAlphabetic(8)), placeOfBirth); } final ImmutableAttributeMap attributeMap = builder.build(); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java index 6d0e7c31..4b9e9fe2 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/InitialSearchTaskWithRegistersTest.java @@ -88,6 +88,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.InitialSearchTask; import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients.ErnpRestClientTest; import at.asitplus.eidas.specific.modules.auth.eidas.v2.test.clients.ZmrClientTest; import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.MatchingTaskUtils; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; import at.gv.bmi.namespace.zmr_su.base._20040201.RequestType; import at.gv.bmi.namespace.zmr_su.base._20040201.ResponseType; import at.gv.bmi.namespace.zmr_su.base._20040201_.ServicePort; @@ -607,24 +608,24 @@ public class InitialSearchTaskWithRegistersTest { String dateOfBirth, String taxNumber, String placeOfBirth, String birthName) throws URISyntaxException { ImmutableAttributeMap.Builder builder = ImmutableAttributeMap.builder() - .put(generateStringAttribute(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER, randomAlphabetic(2), randomAlphabetic(2)), identifier) - .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME, randomAlphabetic(3), randomAlphabetic(3)), familyName) - .put(generateStringAttribute(Constants.eIDAS_ATTR_CURRENTGIVENNAME, + .put(generateStringAttribute(EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME, randomAlphabetic(4), randomAlphabetic(4)), givenName) - .put(generateDateTimeAttribute(Constants.eIDAS_ATTR_DATEOFBIRTH, + .put(generateDateTimeAttribute(EidasConstants.eIDAS_ATTR_DATEOFBIRTH, randomAlphabetic(5), randomAlphabetic(5)), dateOfBirth); if (taxNumber != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_TAXREFERENCE, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_TAXREFERENCE, randomAlphabetic(6), randomAlphabetic(6)), taxNumber); } if (birthName != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_BIRTHNAME, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_BIRTHNAME, randomAlphabetic(7), randomAlphabetic(7)), birthName); } if (placeOfBirth != null) { - builder.put(generateStringAttribute(Constants.eIDAS_ATTR_PLACEOFBIRTH, + builder.put(generateStringAttribute(EidasConstants.eIDAS_ATTR_PLACEOFBIRTH, randomAlphabetic(8), randomAlphabetic(8)), placeOfBirth); } final ImmutableAttributeMap attributeMap = builder.build(); diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java index 842c8bf7..53f83095 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveAuthnResponseTaskTest.java @@ -27,8 +27,9 @@ import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummyConfigMap; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummySpConfiguration; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.EidasAttributeRegistry; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveAuthnResponseTask; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.service.EidasAttributeRegistry; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; @@ -142,7 +143,7 @@ public class ReceiveAuthnResponseTaskTest { public void successAndForward() throws URISyntaxException, TaskExecutionException, PendingReqIdValidationException, EaafStorageException { - AuthenticationResponse eidasResponse = buildDummyAuthResponse(Constants.SUCCESS_URI); + AuthenticationResponse eidasResponse = buildDummyAuthResponse(EidasConstants.SUCCESS_URI); httpReq.setAttribute(Constants.DATA_FULL_EIDAS_RESPONSE, eidasResponse); String alternativReturnEndpoint = "http://ms-connector.alternative/" + RandomStringUtils.randomAlphabetic(10); @@ -172,7 +173,7 @@ public class ReceiveAuthnResponseTaskTest { public void success() throws URISyntaxException, TaskExecutionException, PendingReqIdValidationException { @Nonnull - AuthenticationResponse eidasResponse = buildDummyAuthResponse(Constants.SUCCESS_URI); + AuthenticationResponse eidasResponse = buildDummyAuthResponse(EidasConstants.SUCCESS_URI); httpReq.setAttribute(Constants.DATA_FULL_EIDAS_RESPONSE, eidasResponse); executionContext.put(MsEidasNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "LU"); @@ -200,7 +201,7 @@ public class ReceiveAuthnResponseTaskTest { basicConfig.putConfigValue("eidas.ms.auth.eIDAS.eid.testidentity.default", "true"); @Nonnull - AuthenticationResponse eidasResponse = buildDummyAuthResponse(Constants.SUCCESS_URI); + AuthenticationResponse eidasResponse = buildDummyAuthResponse(EidasConstants.SUCCESS_URI); httpReq.setAttribute(Constants.DATA_FULL_EIDAS_RESPONSE, eidasResponse); executionContext.put(MsEidasNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "LU"); @@ -226,13 +227,13 @@ public class ReceiveAuthnResponseTaskTest { @Nonnull private AuthenticationResponse buildDummyAuthResponse(String statusCode) throws URISyntaxException { final AttributeDefinition attributeDef = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); + EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); final AttributeDefinition attributeDef2 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); final AttributeDefinition attributeDef3 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTGIVENNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME).first(); final AttributeDefinition attributeDef4 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_DATEOFBIRTH).first(); + EidasConstants.eIDAS_ATTR_DATEOFBIRTH).first(); final ImmutableAttributeMap attributeMap = ImmutableAttributeMap.builder() .put(attributeDef, "LU/AT/" + RandomStringUtils.randomNumeric(64)) diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveEidasResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveEidasResponseTaskTest.java index 4148b138..4112e047 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveEidasResponseTaskTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveEidasResponseTaskTest.java @@ -27,8 +27,9 @@ import at.asitplus.eidas.specific.core.MsEidasNodeConstants; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummyConfigMap; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummySpConfiguration; import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.EidasAttributeRegistry; import at.asitplus.eidas.specific.modules.auth.eidas.v2.tasks.ReceiveAuthnResponseAlternativeTask; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.service.EidasAttributeRegistry; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.IRequestStorage; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; @@ -141,7 +142,7 @@ public class ReceiveEidasResponseTaskTest { public void successAndForward() throws URISyntaxException, TaskExecutionException, PendingReqIdValidationException, EaafStorageException { - AuthenticationResponse eidasResponse = buildDummyAuthResponse(Constants.SUCCESS_URI); + AuthenticationResponse eidasResponse = buildDummyAuthResponse(EidasConstants.SUCCESS_URI); httpReq.setAttribute(Constants.DATA_FULL_EIDAS_RESPONSE, eidasResponse); String alternativReturnEndpoint = "http://ms-connector.alternative/" + RandomStringUtils.randomAlphabetic(10); @@ -171,7 +172,7 @@ public class ReceiveEidasResponseTaskTest { public void success() throws URISyntaxException, TaskExecutionException, PendingReqIdValidationException { @Nonnull - AuthenticationResponse eidasResponse = buildDummyAuthResponse(Constants.SUCCESS_URI); + AuthenticationResponse eidasResponse = buildDummyAuthResponse(EidasConstants.SUCCESS_URI); httpReq.setAttribute(Constants.DATA_FULL_EIDAS_RESPONSE, eidasResponse); //execute test @@ -198,7 +199,7 @@ public class ReceiveEidasResponseTaskTest { basicConfig.putConfigValue("eidas.ms.auth.eIDAS.eid.testidentity.default", "true"); @Nonnull - AuthenticationResponse eidasResponse = buildDummyAuthResponse(Constants.SUCCESS_URI); + AuthenticationResponse eidasResponse = buildDummyAuthResponse(EidasConstants.SUCCESS_URI); httpReq.setAttribute(Constants.DATA_FULL_EIDAS_RESPONSE, eidasResponse); //execute test @@ -223,14 +224,14 @@ public class ReceiveEidasResponseTaskTest { @Nonnull private AuthenticationResponse buildDummyAuthResponse(String statusCode) throws URISyntaxException { final AttributeDefinition attributeDef = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); + EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); final AttributeDefinition attributeDef2 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME).first(); final AttributeDefinition attributeDef3 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_CURRENTGIVENNAME).first(); + EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME).first(); final AttributeDefinition attributeDef4 = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_DATEOFBIRTH).first(); - + EidasConstants.eIDAS_ATTR_DATEOFBIRTH).first(); + final ImmutableAttributeMap attributeMap = ImmutableAttributeMap.builder() .put(attributeDef, "LU/AT/" + RandomStringUtils.randomNumeric(64)) .put(attributeDef2, RandomStringUtils.randomAlphabetic(10)) diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java index 16efd84b..b8cb0642 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java @@ -40,12 +40,13 @@ 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.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException; import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.CcSpecificEidProcessingService; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; import lombok.SneakyThrows; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/SpringTest-context_tasks_test.xml", @@ -352,12 +353,12 @@ public class EidasAttributePostProcessingTest { private Map<String, Object> generateInputData(String id, String familyName, String givenName, String dateOfBirth, String placeOfBirth, String birthName) { final Map<String, Object> result = new HashMap<>(); - 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); + result.put(EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER, id); + result.put(EidasConstants.eIDAS_ATTR_CURRENTGIVENNAME, givenName); + result.put(EidasConstants.eIDAS_ATTR_CURRENTFAMILYNAME, familyName); + result.put(EidasConstants.eIDAS_ATTR_DATEOFBIRTH, dateOfBirth); + result.put(EidasConstants.eIDAS_ATTR_PLACEOFBIRTH, placeOfBirth); + result.put(EidasConstants.eIDAS_ATTR_BIRTHNAME, birthName); return result; } diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasRequestPreProcessingFirstTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasRequestPreProcessingFirstTest.java index 84da2344..ca292d4c 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasRequestPreProcessingFirstTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasRequestPreProcessingFirstTest.java @@ -69,8 +69,9 @@ public class EidasRequestPreProcessingFirstTest { private TestRequestImpl pendingReq; private DummySpConfiguration oaParam; - private Builder authnRequestBuilder; - + private Builder authnRequestBuilder; + private Map<String, String> spConfig; + /** * jUnit class initializer. * @@ -91,9 +92,9 @@ public class EidasRequestPreProcessingFirstTest { @Before public void setUp() { - final Map<String, String> spConfig = new HashMap<>(); + spConfig = new HashMap<>(); spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp"); - spConfig.put("target", "urn:publicid:gv.at:cdid+XX"); + spConfig.put("target", "urn:publicid:gv.at:cdid+XX"); oaParam = new DummySpConfiguration(spConfig, basicConfig); pendingReq = new TestRequestImpl(); @@ -154,5 +155,42 @@ public class EidasRequestPreProcessingFirstTest { Assert.assertEquals("Requested attribute size not match", 8, lightReq.getRequestedAttributes().size()); } + + @Test + public void prePreProcessNlWithUpgrade() throws EidPostProcessingException { + + final String testCountry = "NL"; + spConfig.put("loa", EaafConstants.EIDAS_LOA_LOW); + authnRequestBuilder.citizenCountryCode(testCountry); + authnRequestBuilder.levelOfAssurance(EaafConstants.EIDAS_LOA_LOW); + + preProcessor.preProcess(testCountry, pendingReq, authnRequestBuilder); + + final LightRequest lightReq = authnRequestBuilder.build(); + + Assert.assertNotSame("RequesterId was set", lightReq.getRequesterId()); + Assert.assertEquals("no PublicSP", "public", lightReq.getSpType()); + Assert.assertEquals("Requested attribute size not match", 4, lightReq.getRequestedAttributes().size()); + + Assert.assertEquals("wrong LoA", EaafConstants.EIDAS_LOA_SUBSTANTIAL, lightReq.getLevelOfAssurance()); + } + + @Test + public void prePreProcessNlWithOutUpgrade() throws EidPostProcessingException { + + final String testCountry = "NL"; + authnRequestBuilder.citizenCountryCode(testCountry); + preProcessor.preProcess(testCountry, pendingReq, authnRequestBuilder); + + final LightRequest lightReq = authnRequestBuilder.build(); + + Assert.assertNotSame("RequesterId was set", lightReq.getRequesterId()); + Assert.assertEquals("no PublicSP", "public", lightReq.getSpType()); + Assert.assertEquals("Requested attribute size not match", 4, lightReq.getRequestedAttributes().size()); + + Assert.assertEquals("wrong LoA", EaafConstants.EIDAS_LOA_HIGH, lightReq.getLevelOfAssurance()); + + } + } diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasResponseValidatorTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasResponseValidatorTest.java index bbba56e2..91a50d28 100644 --- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasResponseValidatorTest.java +++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasResponseValidatorTest.java @@ -21,10 +21,10 @@ import com.google.common.collect.ImmutableSet; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummyConfigMap; import at.asitplus.eidas.specific.core.test.config.dummy.MsConnectorDummySpConfiguration; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants; import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasValidationException; -import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.EidasAttributeRegistry; import at.asitplus.eidas.specific.modules.auth.eidas.v2.validator.EidasResponseValidator; +import at.asitplus.eidas.specific.modules.core.eidas.EidasConstants; +import at.asitplus.eidas.specific.modules.core.eidas.service.EidasAttributeRegistry; import at.gv.egiz.eaaf.core.api.data.EaafConfigConstants; import at.gv.egiz.eaaf.core.api.data.EaafConstants; import at.gv.egiz.eaaf.core.exceptions.EaafStorageException; @@ -300,7 +300,7 @@ public class EidasResponseValidatorTest { final AttributeDefinition personIdattributeDef = attrRegistry.getCoreAttributeRegistry().getByFriendlyName( - Constants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); + EidasConstants.eIDAS_ATTR_PERSONALIDENTIFIER).first(); final Builder attributeMap = ImmutableAttributeMap.builder(); if (personalId != null) { @@ -319,7 +319,7 @@ public class EidasResponseValidatorTest { return b.id("_".concat(Random.nextHexRandom16())) .issuer(RandomStringUtils.randomAlphabetic(10)) .subject(RandomStringUtils.randomAlphabetic(10)) - .statusCode(Constants.SUCCESS_URI) + .statusCode(EidasConstants.SUCCESS_URI) .inResponseTo("_".concat(Random.nextHexRandom16())) .subjectNameIdFormat("afaf") .levelOfAssurance(loa) diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml b/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml index f4fc72a7..d71a47dc 100644 --- a/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml +++ b/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_basic_test.xml @@ -17,13 +17,13 @@ class="at.asitplus.eidas.specific.modules.auth.eidas.v2.config.EidasConnectorMessageSource"/> <bean id="SZRClientForeIDAS" - class="at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient" /> + class="at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.szr.SzrClient" /> <!-- <bean id="eIDASDataStore" class="at.asitplus.eidas.specific.modules.auth.eidas.v2.service.eIDASDataStore" /> --> <bean id="springManagedSpecificConnectorCommunicationService" - class="at.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummySpecificCommunicationService" /> + class="at.asitplus.eidas.specific.modules.core.eidas.test.dummy.DummySpecificCommunicationService" /> <bean id="specificConnectorAttributesFileWithPath" class="java.lang.String"> @@ -38,13 +38,16 @@ </bean> <bean id="attributeRegistry" - class="at.asitplus.eidas.specific.modules.auth.eidas.v2.service.EidasAttributeRegistry"> + class="at.asitplus.eidas.specific.modules.core.eidas.service.EidasAttributeRegistry"> <property name="eidasAttributesFile" ref="specificConnectorAttributesFileWithPath" /> <property name="additionalAttributesFile" ref="specificConnectorAdditionalAttributesFileWithPath" /> </bean> + <bean id="connectorAttributeRegistry" + class="at.asitplus.eidas.specific.modules.auth.eidas.v2.service.ConnectorEidasAttributeRegistry" /> + <bean id="EIDPostProcessingService" class="at.asitplus.eidas.specific.modules.auth.eidas.v2.service.CcSpecificEidProcessingService" /> @@ -58,6 +61,11 @@ <property name="priority" value="1" /> </bean> + <bean id="NL-Processor" + class="at.asitplus.eidas.specific.modules.auth.eidas.v2.handler.NlEidProcessor"> + <property name="priority" value="1" /> + </bean> + <bean id="eIDASAuthModule" class="at.asitplus.eidas.specific.modules.auth.eidas.v2.EidasAuthenticationModulImpl"> <property name="priority" value="2" /> diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml b/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml index 0afa0d7d..1b5391d5 100644 --- a/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml +++ b/modules/authmodule-eIDAS-v2/src/test/resources/SpringTest-context_tasks_test.xml @@ -25,7 +25,7 @@ class="at.gv.egiz.eaaf.core.impl.gui.builder.SpringMvcGuiFormBuilderImpl" /> <bean id="springManagedSpecificConnectorCommunicationService" - class="at.asitplus.eidas.specific.modules.auth.eidas.v2.test.dummy.DummySpecificCommunicationService" /> + class="at.asitplus.eidas.specific.modules.core.eidas.test.dummy.DummySpecificCommunicationService" /> <bean id="dummyPvpConfig" class="at.gv.egiz.eaaf.modules.pvp2.idp.test.dummy.DummyPvpConfiguration" /> @@ -36,17 +36,5 @@ <bean id="dummyVelocityBuilder" class="at.gv.egiz.eaaf.core.impl.idp.module.gui.DummyVelocityGuiFormBuilder" /> - <bean id="specificConnectorAttributesFileWithPath" - class="java.lang.String"> - <constructor-arg - value="src/test/resources/config/eidas-attributes.xml" /> - </bean> - - <bean id="specificConnectorAdditionalAttributesFileWithPath" - class="java.lang.String"> - <constructor-arg - value="src/test/resources/config/additional-attributes.xml" /> - </bean> - </beans>
\ No newline at end of file diff --git a/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties b/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties index 6d97513a..41f0fe7b 100644 --- a/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties +++ b/modules/authmodule-eIDAS-v2/src/test/resources/config/junit_config_1.properties @@ -19,9 +19,9 @@ eidas.ms.revisionlog.write.MDS.into.revisionlog=true eidas.ms.revisionlog.logIPAddressOfUser=true ##Directory for static Web content -eidas.ms.webcontent.static.directory=../../../../../../basicConfig/webcontent/ -eidas.ms.webcontent.templates=../../../../../../basicConfig/templates/ -eidas.ms.webcontent.properties=../../../../../../basicConfig/properties/messages +eidas.ms.webcontent.static.directory=../../../../../../basicConfig/ms-connector/webcontent/ +eidas.ms.webcontent.templates=../../../../../../basicConfig/ms-connector/templates/ +eidas.ms.webcontent.properties=../../../../../../basicConfig/ms-connector/properties/messages ## extended validation of pending-request Id's eidas.ms.core.pendingrequestid.maxlifetime=300 |