From 3332e8c363b624e7478f303c403ea709844e822f Mon Sep 17 00:00:00 2001 From: lalber Date: Tue, 20 Oct 2020 09:02:39 +0200 Subject: fixes thanks to Thomas --- eidas_modules/authmodule-eIDAS-v2/pom.xml | 6 ------ .../modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java | 7 +++++-- .../eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java | 11 +++++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'eidas_modules') diff --git a/eidas_modules/authmodule-eIDAS-v2/pom.xml b/eidas_modules/authmodule-eIDAS-v2/pom.xml index 7bbdaf78..4fe2bb36 100644 --- a/eidas_modules/authmodule-eIDAS-v2/pom.xml +++ b/eidas_modules/authmodule-eIDAS-v2/pom.xml @@ -160,12 +160,6 @@ 2.0.7 test - - eu.eidas - eidas-light-commons - 2.4.0 - test - at.gv.egiz.eaaf eaaf_core_utils diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java index e4a22cbc..93813ff5 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java @@ -95,6 +95,9 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { @Autowired private ICcSpecificEidProcessingService eidPostProcessor; + @Autowired + EaafKeyStoreFactory keyStoreFactory; + /* * (non-Javadoc) * @@ -331,14 +334,14 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask { } private String getPkFromKeystore() throws EaafException, KeyStoreException { - EaafKeyStoreFactory keyStoreFactory = new EaafKeyStoreFactory(); KeyStoreConfiguration configuration = new KeyStoreConfiguration(); final String current = new java.io.File(".").toURI().toString(); configuration.setSoftKeyStoreFilePath(current + "src/test/resources/keystore/teststore.jks"); - configuration.setSoftKeyStorePassword("f/+saJBc3a}*/T^s"); configuration.setKeyStoreType(KeyStoreConfiguration.KeyStoreType.JKS); + configuration.setFriendlyName("connectorkeypair"); + configuration.setKeyStoreName("connectorkeypair"); val ks = keyStoreFactory.buildNewKeyStore(configuration); val publicKey = ks.getFirst().getCertificate("connectorkeypair").getPublicKey(); return Base64.getEncoder().encodeToString(publicKey.getEncoded()); diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java index 185181dd..f674b6b1 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java @@ -63,6 +63,7 @@ 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 szrservices.PersonInfoType; import szrservices.SZR; import szrservices.SZRException_Exception; @@ -144,7 +145,7 @@ public class CreateIdentityLinkTaskEidNewTest { executionContext.put(MsEidasNodeConstants.REQ_PARAM_SELECTED_COUNTRY, "XX"); - szrMock = soap.mock(SZR.class, "http://localhost:2526/szrService"); + szrMock = soap.mock(SZR.class, "http://localhost:1234/demoszr"); } @NotNull @@ -183,9 +184,11 @@ public class CreateIdentityLinkTaskEidNewTest { // keystore password f/+saJBc3a}*/T^s try { - SZR szrMock2 = Mockito.mock(SZR.class, Mockito.CALLS_REAL_METHODS); -// when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); - when(szrMock2, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); + String test = szrMock.getStammzahlEncrypted(new PersonInfoType(), false); + +// SZR szrMock2 = Mockito.mock(SZR.class, Mockito.CALLS_REAL_METHODS); + when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); +// when(szrMock2, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); // Wie kann ich das vom Bean rein gehängte SZR mit dem Mock überschreiben? task.execute(pendingReq, executionContext); -- cgit v1.2.3