aboutsummaryrefslogtreecommitdiff
path: root/modules/authmodule-eIDAS-v2
diff options
context:
space:
mode:
authorThomas <>2022-08-02 14:00:57 +0200
committerThomas <>2022-08-02 14:00:57 +0200
commitf381c610acdecb06a8561389a4d1598738559948 (patch)
tree4e752580f0cfdf6963951c41335001188a27dff1 /modules/authmodule-eIDAS-v2
parente0c0b219588322a0f0e7a891369b43ab6c853d71 (diff)
parent48f19dc45cec670fe62399d09fb34732fb4eeedc (diff)
downloadNational_eIDAS_Gateway-f381c610acdecb06a8561389a4d1598738559948.tar.gz
National_eIDAS_Gateway-f381c610acdecb06a8561389a4d1598738559948.tar.bz2
National_eIDAS_Gateway-f381c610acdecb06a8561389a4d1598738559948.zip
Merge branch 'nightlybuild' into feature/ms_proxy_service
# Conflicts: # ms_specific_proxyservice/src/test/resources/config/logback_config.xml
Diffstat (limited to 'modules/authmodule-eIDAS-v2')
-rw-r--r--modules/authmodule-eIDAS-v2/pom.xml2
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java68
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java9
-rw-r--r--modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java1
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java9
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientTest.java12
-rw-r--r--modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java27
7 files changed, 45 insertions, 83 deletions
diff --git a/modules/authmodule-eIDAS-v2/pom.xml b/modules/authmodule-eIDAS-v2/pom.xml
index 9c1e5113..1ac03fbb 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.3.2-SNAPSHOT</version>
+ <version>1.3.3-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/clients/szr/SzrClient.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java
index 8c294c97..c9c3a2fa 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/clients/szr/SzrClient.java
@@ -59,9 +59,7 @@ import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.AbstractSoapClient;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.clients.AbstractSoapClient.HttpClientConfig.HttpClientConfigBuilder;
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.SzrCommunicationException;
-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;
@@ -84,7 +82,6 @@ import szrservices.SZRException_Exception;
import szrservices.SignContent;
import szrservices.SignContentEntry;
import szrservices.SignContentResponseType;
-import szrservices.TravelDocumentType;
@Slf4j
@@ -139,17 +136,17 @@ public class SzrClient extends AbstractSoapClient {
* Get bPK of person.
*
*
- * @param eidData Minimum dataset of person
+ * @param matchedPersonData Minimum dataset of person
* @param target requested bPK target
* @param vkz Verfahrenskennzeichen
* @return bPK for this person
* @throws SzrCommunicationException In case of a SZR error
*/
- public List<String> getBpk(SimpleEidasData eidData, String target, String vkz)
+ public List<String> getBpk(MatchedPersonResult matchedPersonData, String target, String vkz)
throws SzrCommunicationException {
try {
final GetBPK parameters = new GetBPK();
- parameters.setPersonInfo(generateSzrRequest(eidData));
+ parameters.setPersonInfo(generateSzrRequest(matchedPersonData));
parameters.getBereichsKennung().add(target);
parameters.setVKZ(vkz);
final GetBPKResponse result = this.szr.getBPK(parameters);
@@ -201,13 +198,13 @@ public class SzrClient extends AbstractSoapClient {
* @throws SzrCommunicationException In case of a SZR error
*/
public String getEidasBind(final String vsz, final String bindingPubKey, final String eidStatus,
- SimpleEidasData eidData)throws SzrCommunicationException {
+ MatchedPersonResult eidData)throws SzrCommunicationException {
final Map<String, Object> eidsaBindMap = new HashMap<>();
eidsaBindMap.put(ATTR_NAME_VSZ, vsz);
eidsaBindMap.put(ATTR_NAME_STATUS, eidStatus);
eidsaBindMap.put(ATTR_NAME_PUBKEYS, Collections.singletonList(bindingPubKey));
- eidsaBindMap.put(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME, eidData.getCitizenCountryCode());
+ eidsaBindMap.put(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME, eidData.getCountryCode());
injectMdsIfAvailableAndActive(eidsaBindMap, eidData);
try {
@@ -264,59 +261,6 @@ public class SzrClient extends AbstractSoapClient {
return personInfo;
}
- private PersonInfoType generateSzrRequest(SimpleEidasData eidData) {
- log.trace("Starting connecting SZR Gateway");
- final PersonInfoType personInfo = new PersonInfoType();
- final PersonNameType personName = new PersonNameType();
- final PhysicalPersonType naturalPerson = new PhysicalPersonType();
- final TravelDocumentType eDocument = new TravelDocumentType();
-
- naturalPerson.setName(personName);
- personInfo.setPerson(naturalPerson);
- personInfo.setTravelDocument(eDocument);
-
- // person information
- personName.setFamilyName(eidData.getFamilyName());
- personName.setGivenName(eidData.getGivenName());
- naturalPerson.setDateOfBirth(eidData.getDateOfBirth());
-
- //TODO: need to be updated to new eIDAS document interface!!!!
- eDocument.setIssuingCountry(eidData.getCitizenCountryCode());
- eDocument.setDocumentNumber(eidData.getPseudonym());
-
- // eID document information
- String documentType = basicConfig
- .getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE,
- Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE);
- eDocument.setDocumentType(documentType);
-
- // set PlaceOfBirth if available
- if (eidData.getPlaceOfBirth() != null) {
- log.trace("Find 'PlaceOfBirth' attribute: " + eidData.getPlaceOfBirth());
- boolean setPlaceOfBirth = basicConfig
- .getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_SETPLACEOFBIRTHIFAVAILABLE, true);
- if (setPlaceOfBirth) {
- naturalPerson.setPlaceOfBirth(eidData.getPlaceOfBirth());
- log.trace("Adding 'PlaceOfBirth' to ERnB request ... ");
- }
- }
-
- // set BirthName if available
- if (eidData.getBirthName() != null) {
- log.trace("Find 'BirthName' attribute: " + eidData.getBirthName());
- boolean setBirthName = basicConfig
- .getBasicConfigurationBoolean(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_SETBIRTHNAMEIFAVAILABLE, true);
- if (setBirthName) {
- final AlternativeNameType alternativeName = new AlternativeNameType();
- naturalPerson.setAlternativeName(alternativeName);
- alternativeName.setFamilyName(eidData.getBirthName());
- log.trace("Adding 'BirthName' to ERnB request ... ");
- }
- }
-
- return personInfo;
- }
-
private IdentityLinkType getIdentityLinkGeneric(GetIdentityLinkEidas getIdl) throws Exception {
final JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
final Marshaller jaxbMarshaller = jaxbContext.createMarshaller();
@@ -450,7 +394,7 @@ public class SzrClient extends AbstractSoapClient {
log.info("SZR-Client initialization successfull");
}
- private void injectMdsIfAvailableAndActive(Map<String, Object> eidsaBindMap, SimpleEidasData eidData) {
+ private void injectMdsIfAvailableAndActive(Map<String, Object> eidsaBindMap, MatchedPersonResult eidData) {
if (basicConfig.getBasicConfigurationBoolean(
Constants.CONIG_PROPS_EIDAS_SZRCLIENT_SET_MDS_TO_EIDASBIND, false)) {
log.info("Injecting MDS into eidasBind ... ");
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 e8b7b2c1..2379f39e 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
@@ -156,7 +156,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
private void executeIdlMode(SimpleEidasData eidData, MatchedPersonResult matchedPersonData) throws EaafException {
//request SZR
- SzrResultHolder idlResult = requestSzrForIdentityLink(eidData, matchedPersonData);
+ SzrResultHolder idlResult = requestSzrForIdentityLink(matchedPersonData);
//write revision-Log entry for personal-identifier mapping
writeExtendedRevisionLogEntry(eidData, eidData.getPersonalIdentifier());
@@ -188,7 +188,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
// get eIDAS bind
String signedEidasBind = szrClient
- .getEidasBind(vsz, authBlockSigner.getBase64EncodedPublicKey(), EID_STATUS, eidData);
+ .getEidasBind(vsz, authBlockSigner.getBase64EncodedPublicKey(), EID_STATUS, matchedPersonData);
revisionsLogger.logEvent(pendingReq, MsConnectorEventCodes.SZR_EIDASBIND_RECEIVED);
AuthProcessDataWrapper authProcessDataWrapper = MatchingTaskUtils.getAuthProcessDataWrapper(pendingReq);
authProcessDataWrapper.setGenericDataToSession(MsEidasNodeConstants.AUTH_DATA_EIDAS_BIND, signedEidasBind);
@@ -213,8 +213,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
}
}
- private SzrResultHolder requestSzrForIdentityLink(SimpleEidasData eidData,
- MatchedPersonResult matchedPersonData) throws EaafException {
+ private SzrResultHolder requestSzrForIdentityLink(MatchedPersonResult matchedPersonData) throws EaafException {
//request IdentityLink from SZR
log.debug("Requesting encrypted baseId by already matched person information ... ");
IdentityLinkType result = szrClient.getIdentityLinkInRawMode(matchedPersonData);
@@ -230,7 +229,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
if (debugUseSzrForBpk) {
String vkz = basicConfig
.getBasicConfiguration(Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, "no VKZ defined");
- List<String> bpkList = szrClient.getBpk(eidData, targetId, vkz);
+ List<String> bpkList = szrClient.getBpk(matchedPersonData, targetId, vkz);
if (!bpkList.isEmpty()) {
bpk = bpkList.get(0);
}
diff --git a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
index 03414f9e..ec858116 100644
--- a/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
+++ b/modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveOtherLoginMethodGuiResponseTask.java
@@ -143,6 +143,7 @@ public class ReceiveOtherLoginMethodGuiResponseTask extends AbstractLocaleAuthSe
case ADD_ME_AS_NEW:
executionContext.put(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK, true);
+ executionContext.put(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK, false);
return;
default:
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java
index d2bfe662..ecffaa19 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientProductionTest.java
@@ -45,7 +45,6 @@ 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.szr.SzrClient;
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.EidasSAuthenticationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
@@ -127,13 +126,13 @@ public class SzrClientProductionTest {
}
- private SimpleEidasData getEidData() {
- return SimpleEidasData.builder()
+ private MatchedPersonResult getEidData() {
+ return MatchedPersonResult.builder()
.familyName("Mustermann")
.givenName("Franz")
.dateOfBirth("1989-05-04")
- .citizenCountryCode("IS")
- .pseudonym("1234ffgsdfg56789ABCDEF")
+ .bpk("1234ffgsdfg56789ABCDEF")
+ .countryCode("XX")
.build();
}
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientTest.java
index e61532a3..a35f9bad 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/clients/SzrClientTest.java
@@ -58,7 +58,7 @@ 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.szr.SzrClient;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.SimpleEidasData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.MatchedPersonResult;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException;
import at.gv.egiz.eaaf.core.api.data.EaafConstants;
@@ -270,15 +270,15 @@ public class SzrClientTest {
}
- private SimpleEidasData getEidData() {
- return SimpleEidasData.builder()
+ private MatchedPersonResult getEidData() {
+ return MatchedPersonResult.builder()
.familyName("Mustermann")
.givenName("Franz")
.dateOfBirth("1989-05-05")
- .citizenCountryCode("IS")
- .pseudonym("1234sdgsdfg56789ABCDEF")
+ .bpk("1234sdgsdfg56789ABCDEF")
+ .countryCode("IS")
.build();
}
-
+
}
diff --git a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
index 66867fce..dfbb0266 100644
--- a/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
+++ b/modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/ReceiveOtherLoginMethodGuiResponseTaskTest.java
@@ -126,16 +126,35 @@ httpReq.setParameter(Constants.REQ_SELECTED_LOGIN_METHOD_PARAMETER, SelectedLog
@Test
public void withAddMeAsNewSelection() throws TaskExecutionException {
- testTransition(SelectedLoginMethod.ADD_ME_AS_NEW, Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK);
- assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ testTransition(SelectedLoginMethod.ADD_ME_AS_NEW, Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK);
+
+ assertEquals("return to selection", false,
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("return to selection", false,
+ executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK));
}
-
+
@Test
public void withRequestingNewEntrySelection() throws TaskExecutionException {
testTransition(SelectedLoginMethod.REQUESTING_NEW_ENTRY, Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK);
+
assertEquals("return to selection", true, executionContext.get(Constants.TRANSITION_TO_REQUESTING_NEW_ERNP_ENTRY_TASK));
- assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertEquals("return to selection", false, executionContext.get(Constants.TRANSITION_TO_GENERATE_OTHER_LOGIN_METHOD_GUI_TASK));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_CREATE_NEW_ERNP_ENTRY_TASK));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_EIDAS_LOGIN));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_GUI_QUERY_AUSTRIAN_RESIDENCE_TASK));
+ assertNull("return to selection",
+ executionContext.get(Constants.TRANSITION_TO_GENERATE_MOBILE_PHONE_SIGNATURE_REQUEST_TASK));
}