aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-03-04 14:32:20 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-03-04 14:32:20 +0100
commitc5d36685c294a383baecf4e12aaeda5be1f13529 (patch)
treef4ead86870350186a02d2c86d00f739876065838
parentb9bc937ff9471c60ced2ef9ed7df526cf31059db (diff)
downloadNational_eIDAS_Gateway-c5d36685c294a383baecf4e12aaeda5be1f13529.tar.gz
National_eIDAS_Gateway-c5d36685c294a383baecf4e12aaeda5be1f13529.tar.bz2
National_eIDAS_Gateway-c5d36685c294a383baecf4e12aaeda5be1f13529.zip
Refactor ErnpData to make it immutable
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java115
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnpEidData.java55
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java37
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/INationalEidProcessor.java16
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/CcSpecificEidProcessingService.java4
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/ICcSpecificEidProcessingService.java10
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java23
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/CreateIdentityLinkTask.java12
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTest.java60
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java36
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java24
11 files changed, 165 insertions, 227 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java
deleted file mode 100644
index b780d3e8..00000000
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnbEidData.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2020 A-SIT Plus GmbH
- * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
- * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
- *
- * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "License");
- * You may not use this work except in compliance with the License.
- * You may obtain a copy of the License at:
- * https://joinup.ec.europa.eu/news/understanding-eupl-v12
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
-*/
-
-package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
-
-import java.text.SimpleDateFormat;
-
-import org.joda.time.DateTime;
-
-import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
-
-public class ErnbEidData {
-
- private String citizenCountryCode = null;
-
- // MDS
- private String pseudonym = null;
- private String givenName = null;
- private String familyName = null;
- private DateTime dateOfBirth = null;
-
- // additional attributes
- private String placeOfBirth = null;
- private String birthName = null;
- private PostalAddressType address = null;
-
- public String getCitizenCountryCode() {
- return citizenCountryCode;
- }
-
- public void setCitizenCountryCode(String citizenCountryCode) {
- this.citizenCountryCode = citizenCountryCode;
- }
-
- public String getPseudonym() {
- return pseudonym;
- }
-
- public void setPseudonym(String pseudonym) {
- this.pseudonym = pseudonym;
- }
-
- public String getGivenName() {
- return givenName;
- }
-
- public void setGivenName(String givenName) {
- this.givenName = givenName;
- }
-
- public String getFamilyName() {
- return familyName;
- }
-
- public void setFamilyName(String familyName) {
- this.familyName = familyName;
- }
-
- public DateTime getDateOfBirth() {
- return dateOfBirth;
- }
-
- public void setDateOfBirth(DateTime dateOfBirth) {
- this.dateOfBirth = dateOfBirth;
- }
-
- public String getPlaceOfBirth() {
- return placeOfBirth;
- }
-
- public void setPlaceOfBirth(String placeOfBirth) {
- this.placeOfBirth = placeOfBirth;
- }
-
- public String getBirthName() {
- return birthName;
- }
-
- public void setBirthName(String birthName) {
- this.birthName = birthName;
- }
-
- public PostalAddressType getAddress() {
- return address;
- }
-
- public void setAddress(PostalAddressType address) {
- this.address = address;
- }
-
- public String getFormatedDateOfBirth() {
- return new SimpleDateFormat("yyyy-MM-dd").format(dateOfBirth.toDate());
- }
-
-}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnpEidData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnpEidData.java
new file mode 100644
index 00000000..137ef984
--- /dev/null
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/ErnpEidData.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2020 A-SIT Plus GmbH
+ * AT-specific eIDAS Connector has been developed in a cooperation between EGIZ,
+ * A-SIT Plus GmbH, A-SIT, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "License");
+ * You may not use this work except in compliance with the License.
+ * You may obtain a copy of the License at:
+ * https://joinup.ec.europa.eu/news/understanding-eupl-v12
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+*/
+
+package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
+
+import java.text.SimpleDateFormat;
+
+import lombok.Builder;
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
+
+@Data
+@Builder
+public class ErnpEidData {
+
+ private final String citizenCountryCode;
+
+ // MDS
+ private final String pseudonym;
+ private final String givenName;
+ private final String familyName;
+ private final DateTime dateOfBirth;
+
+ // additional attributes
+ private final String placeOfBirth;
+ private final String birthName;
+ private final PostalAddressType address;
+
+ public String getFormatedDateOfBirth() {
+ return dateOfBirth == null ? null : new SimpleDateFormat("yyyy-MM-dd").format(dateOfBirth.toDate());
+ }
+
+}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
index 734cf873..14deefa5 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/AbstractEidProcessor.java
@@ -37,7 +37,7 @@ import org.springframework.lang.NonNull;
import com.google.common.collect.ImmutableSortedSet;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
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;
@@ -72,27 +72,22 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
@Override
- public final ErnbEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
+ public final ErnpEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
EidasAttributeException {
- final ErnbEidData result = new ErnbEidData();
-
final Object eIdentifierObj = eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
final Triple<String, String, String> eIdentifier =
EidasResponseUtils.parseEidasPersonalIdentifier((String) eIdentifierObj);
- result.setCitizenCountryCode(eIdentifier.getFirst());
-
- // MDS attributes
- result.setPseudonym(processPseudonym(eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER)));
- result.setFamilyName(processFamilyName(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTFAMILYNAME)));
- result.setGivenName(processGivenName(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTGIVENNAME)));
- result.setDateOfBirth(processDateOfBirth(eidasAttrMap.get(Constants.eIDAS_ATTR_DATEOFBIRTH)));
-
- // additional attributes
- result.setPlaceOfBirth(processPlaceOfBirth(eidasAttrMap.get(Constants.eIDAS_ATTR_PLACEOFBIRTH)));
- result.setBirthName(processBirthName(eidasAttrMap.get(Constants.eIDAS_ATTR_BIRTHNAME)));
- result.setAddress(processAddress(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)));
-
- return result;
+ return ErnpEidData.builder().citizenCountryCode(eIdentifier.getFirst())
+ // MDS attributes
+ .pseudonym(processPseudonym(eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER)))
+ .familyName(processFamilyName(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTFAMILYNAME)))
+ .givenName(processGivenName(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTGIVENNAME)))
+ .dateOfBirth(processDateOfBirth(eidasAttrMap.get(Constants.eIDAS_ATTR_DATEOFBIRTH)))
+ // additional attributes
+ .placeOfBirth(processPlaceOfBirth(eidasAttrMap.get(Constants.eIDAS_ATTR_PLACEOFBIRTH)))
+ .birthName(processBirthName(eidasAttrMap.get(Constants.eIDAS_ATTR_BIRTHNAME)))
+ .address(processAddress(eidasAttrMap.get(Constants.eIDAS_ATTR_CURRENTADDRESS)))
+ .build();
}
@@ -275,12 +270,12 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
if (StringUtils.isNotEmpty(providerName)) {
authnRequestBuilder.providerName(providerName);
authnRequestBuilder.requesterId(providerName);
-
+
}
}
}
-
+
private void buildLevelOfAssurance(ISpConfiguration spConfig, Builder authnRequestBuilder) {
// TODO: set matching mode if eIDAS ref. impl. support this method
@@ -303,7 +298,7 @@ public abstract class AbstractEidProcessor implements INationalEidProcessor {
log.debug("Request eIdAS node with LoA: " + loa);
authnRequestBuilder.levelOfAssurance(loa);
-
+
}
}
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/INationalEidProcessor.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/INationalEidProcessor.java
index 577efbcd..5b130e48 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/INationalEidProcessor.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/handler/INationalEidProcessor.java
@@ -25,7 +25,7 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.handler;
import java.util.Map;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException;
import at.gv.egiz.eaaf.core.api.IRequest;
@@ -36,7 +36,7 @@ public interface INationalEidProcessor {
/**
* Get a friendlyName of this post-processor implementation.
- *
+ *
* @return
*/
String getName();
@@ -46,34 +46,34 @@ public interface INationalEidProcessor {
* If more than one Post-Processor implementations can handle the eID data, the
* post-processor with the highest priority are selected. The Default-Processor
* has priority '0'
- *
+ *
* @return Priority of this handler
*/
int getPriority();
/**
* Check if this postProcessor is sensitive for a specific country.
- *
+ *
* @param countryCode of the eID data that should be processed
* @return true if this implementation can handle the country, otherwise false
- *
+ *
*/
boolean canHandle(String countryCode);
/**
* Post-Process eIDAS eID data into national format.
- *
+ *
* @param eidasAttrMap Map of eIDAS attributes in format friendlyName and
* attribute
* @throws EidPostProcessingException In case of a post-processing error
* @throws EidasAttributeException In case of an invalid eIDAS attribute
*/
- ErnbEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
+ ErnpEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
EidasAttributeException;
/**
* Pre-Process eIDAS Request to national requirements.
- *
+ *
* @param pendingReq current pending request
* @param authnRequestBuilder eIDAS {@link ILightRequest} builder
*/
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/CcSpecificEidProcessingService.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/CcSpecificEidProcessingService.java
index 230d6052..c2f13aa6 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/CcSpecificEidProcessingService.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/CcSpecificEidProcessingService.java
@@ -40,7 +40,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
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.handler.INationalEidProcessor;
@@ -104,7 +104,7 @@ public class CcSpecificEidProcessingService implements ICcSpecificEidProcessingS
}
@Override
- public ErnbEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
+ public ErnpEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
EidasAttributeException {
// extract citizen country from eIDAS unique identifier
final Object eIdentifierObj = eidasAttrMap.get(Constants.eIDAS_ATTR_PERSONALIDENTIFIER);
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/ICcSpecificEidProcessingService.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/ICcSpecificEidProcessingService.java
index ebbc15e4..983830e3 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/ICcSpecificEidProcessingService.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/service/ICcSpecificEidProcessingService.java
@@ -25,7 +25,7 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.service;
import java.util.Map;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasAttributeException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidPostProcessingException;
import at.gv.egiz.eaaf.core.api.IRequest;
@@ -36,20 +36,20 @@ public interface ICcSpecificEidProcessingService {
/**
* Post-process eIDAS eID attributes into national format.
- *
+ *
* @param eidasAttrMap Map of eIDAS attributes in format friendlyName and
* attribute
- *
+ *
* @return eID attributes for SZR request
* @throws EidPostProcessingException In case of a post-processing error
* @throws EidasAttributeException In case of an invalid eIDAS attribute value
*/
- ErnbEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
+ ErnpEidData postProcess(Map<String, Object> eidasAttrMap) throws EidPostProcessingException,
EidasAttributeException;
/**
* Pre Process eIDAS request into national requirements.
- *
+ *
* @param selectedCC Citizen Country from selection
* @param pendingReq current pending request
* @param authnRequestBuilder eIDAS {@link ILightRequest} builder
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java
index 1f5837d6..684451ed 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/szr/SzrClient.java
@@ -78,7 +78,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.utils.LoggingHandler;
import at.gv.egiz.eaaf.core.api.data.PvpAttributeDefinitions;
@@ -116,7 +116,7 @@ public class SzrClient {
private static final String JOSE_HEADER_USERCERTPINNING_TYPE = "urn:at.gv.eid:bindtype";
private static final String JOSE_HEADER_USERCERTPINNING_EIDASBIND = "urn:at.gv.eid:eidasBind";
public static final String ATTR_NAME_MDS = "urn:eidgvat:mds";
-
+
@Autowired
private IConfiguration basicConfig;
@@ -234,6 +234,9 @@ public class SzrClient {
final String resp;
try {
+ //TODO wirklich immer "insertERnP=true"?
+ // wenn insertErnP=false dann returns vsz oder fehler
+ // wenn insertErnp = true dann returns vsz, ggf vom neuen Eintrag
resp = this.szr.getStammzahlEncrypted(personInfo, true);
} catch (SZRException_Exception e) {
throw new SzrCommunicationException("ernb.02", new Object[]{e.getMessage()}, e);
@@ -258,15 +261,15 @@ public class SzrClient {
* @throws SzrCommunicationException In case of a SZR error
*/
public String getEidsaBind(final String vsz, final String bindingPubKey, final String eidStatus,
- ErnbEidData eidData)throws SzrCommunicationException {
+ ErnpEidData 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, Arrays.asList(bindingPubKey));
eidsaBindMap.put(PvpAttributeDefinitions.EID_ISSUING_NATION_NAME, eidData.getCitizenCountryCode());
- injectMdsIfAvailableAndActive(eidsaBindMap, eidData);
-
+ injectMdsIfAvailableAndActive(eidsaBindMap, eidData);
+
try {
final String serializedEidasBind = mapper.writeValueAsString(eidsaBindMap);
final SignContent req = new SignContent();
@@ -493,19 +496,19 @@ public class SzrClient {
}
- private void injectMdsIfAvailableAndActive(Map<String, Object> eidsaBindMap, ErnbEidData eidData) {
+ private void injectMdsIfAvailableAndActive(Map<String, Object> eidsaBindMap, ErnpEidData eidData) {
if (basicConfig.getBasicConfigurationBoolean(
Constants.CONIG_PROPS_EIDAS_SZRCLIENT_SET_MDS_TO_EIDASBIND, false)) {
log.info("Injecting MDS into eidasBind ... ");
- final Map<String, Object> mds = new HashMap<>();
+ final Map<String, Object> mds = new HashMap<>();
mds.put(PvpAttributeDefinitions.PRINCIPAL_NAME_NAME, eidData.getFamilyName());
mds.put(PvpAttributeDefinitions.GIVEN_NAME_NAME, eidData.getGivenName());
- mds.put(PvpAttributeDefinitions.BIRTHDATE_NAME, eidData.getFormatedDateOfBirth());
+ mds.put(PvpAttributeDefinitions.BIRTHDATE_NAME, eidData.getFormatedDateOfBirth());
eidsaBindMap.put(ATTR_NAME_MDS, mds);
-
+
}
}
-
+
private byte[] sourceToByteArray(Source result) throws TransformerException {
final TransformerFactory factory = TransformerFactory.newInstance();
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
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 65e9028f..d6fdd350 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
@@ -47,7 +47,7 @@ import com.google.common.collect.ImmutableSet;
import at.asitplus.eidas.specific.connector.MsConnectorEventCodes;
import at.asitplus.eidas.specific.connector.MsEidasNodeConstants;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
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.AuthBlockSigningService;
@@ -126,7 +126,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
eidasResponse.getAttributes().getAttributeMap());
// post-process eIDAS attributes
- final ErnbEidData eidData = eidPostProcessor.postProcess(simpleAttrMap);
+ final ErnpEidData eidData = eidPostProcessor.postProcess(simpleAttrMap);
// write MDS into technical log and revision log
writeMdsLogInformation(eidData);
@@ -223,7 +223,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
}
}
- private void writeExtendedRevisionLogEntry(Map<String, Object> simpleAttrMap, ErnbEidData eidData) {
+ private void writeExtendedRevisionLogEntry(Map<String, Object> simpleAttrMap, ErnpEidData eidData) {
// write ERnB input-data into revision-log
if (basicConfig.getBasicConfigurationBoolean(
Constants.CONIG_PROPS_EIDAS_SZRCLIENT_WORKAROUND_REVISIONLOGDATASTORE_ACTIVE, false)) {
@@ -234,7 +234,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
}
}
- private PersonInfoType generateSzrRequest(ErnbEidData eidData) {
+ private PersonInfoType generateSzrRequest(ErnpEidData eidData) {
log.debug("Starting connecting SZR Gateway");
final PersonInfoType personInfo = new PersonInfoType();
final PersonNameType personName = new PersonNameType();
@@ -419,7 +419,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
return result;
}
- private void writeMdsLogInformation(ErnbEidData eidData) {
+ private void writeMdsLogInformation(ErnpEidData eidData) {
// log MDS and country code into technical log
if (basicConfig
.getBasicConfigurationBoolean(MsEidasNodeConstants.PROP_CONFIG_TECHNICALLOG_WRITE_MDS_INTO_TECH_LOG, false)) {
@@ -458,7 +458,7 @@ public class CreateIdentityLinkTask extends AbstractAuthServletTask {
* @throws IOException In case of an IDL processing error
* @throws EaafException In case of a bPK generation error
*/
- private SzrResultHolder createDummyIdentityLinkForTestDeployment(ErnbEidData eidData)
+ private SzrResultHolder createDummyIdentityLinkForTestDeployment(ErnpEidData eidData)
throws ParserConfigurationException, SAXException, IOException, EaafException {
log.warn("SZR-Dummy IS ACTIVE! IdentityLink is NOT VALID!!!!");
// create fake IdL
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTest.java
index cf4ed95c..208a008b 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTest.java
@@ -67,7 +67,7 @@ import com.skjolberg.mockito.soap.SoapServiceRule;
import at.asitplus.eidas.specific.connector.test.config.dummy.MsConnectorDummyConfigMap;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient;
@@ -103,7 +103,7 @@ public class SzrClientTest {
@Autowired MsConnectorDummyConfigMap basicConfig;
private static ObjectMapper mapper = new ObjectMapper();
-
+
private static final String givenName = "Franz";
private static final String familyName = "Mustermann";
private static final String dateOfBirth = "1989-05-05";
@@ -111,7 +111,7 @@ public class SzrClientTest {
private static final String DUMMY_TARGET = EaafConstants.URN_PREFIX_CDID + "ZP";
private SZR szrMock = null;
- ErnbEidData eidData = null;
+ ErnpEidData eidData = null;
@Rule
public SoapServiceRule soap = SoapServiceRule.newInstance();
@@ -125,16 +125,16 @@ public class SzrClientTest {
szrMock = soap.mock(SZR.class, "http://localhost:1234/demoszr");
}
-
- eidData = new ErnbEidData();
- eidData.setFamilyName(familyName);
- eidData.setGivenName(givenName);
- eidData.setDateOfBirth(new DateTime());
- eidData.setCitizenCountryCode("IS");
- eidData.setPseudonym("1234sdgsdfg56789ABCDEF");
-
+
+ eidData = ErnpEidData.builder()
+ .familyName(familyName)
+ .givenName(givenName)
+ .dateOfBirth(new DateTime())
+ .citizenCountryCode("IS")
+ .pseudonym("1234sdgsdfg56789ABCDEF").build();
+
basicConfig.putConfigValue("eidas.ms.auth.eIDAS.szrclient.eidasbind.mds.inject", "false");
-
+
}
@@ -181,40 +181,40 @@ public class SzrClientTest {
Assert.assertNotNull("bcBind is null", bcBind);
Assert.assertEquals("bcBind not match", result1.getValue(), bcBind);
-
+
}
@Test
public void eidasBindNull() throws SZRException_Exception {
when(szrMock.signContent(any(), anyList(), anyList())).thenReturn(null);
-
- try {
+
+ try {
szrClient
.getEidsaBind(RandomStringUtils.randomAlphabetic(10), RandomStringUtils.randomAlphabetic(10),
RandomStringUtils.randomAlphabetic(10), eidData);
} catch (SzrCommunicationException e) {
Assert.assertTrue("Not correct error", e.getMessage().contains("ernb.01"));
-
- }
+
+ }
}
-
+
@Test
public void eidasBindInvalidResponse() throws SZRException_Exception {
final SignContentEntry result2 = new SignContentEntry();
final SignContentResponseType content1 = new SignContentResponseType();
content1.getOut().add(result2);
when(szrMock.signContent(any(), anyList(), anyList())).thenReturn(content1);
-
+
try {
szrClient
.getEidsaBind(RandomStringUtils.randomAlphabetic(10), RandomStringUtils.randomAlphabetic(10),
RandomStringUtils.randomAlphabetic(10), eidData);
} catch (SzrCommunicationException e) {
Assert.assertTrue("Not correct error", e.getMessage().contains("ernb.01"));
-
+
}
}
-
+
public void eidasBindEmptyResponse() throws SZRException_Exception {
final SignContentEntry result2 = new SignContentEntry();
final SignContentResponseType content1 = new SignContentResponseType();
@@ -222,19 +222,19 @@ public class SzrClientTest {
result2.setKey("bcBindReq");
result2.setValue("");
when(szrMock.signContent(any(), anyList(), anyList())).thenReturn(content1);
-
+
try {
szrClient
.getEidsaBind(RandomStringUtils.randomAlphabetic(10), RandomStringUtils.randomAlphabetic(10),
RandomStringUtils.randomAlphabetic(10), eidData);
} catch (SzrCommunicationException e) {
Assert.assertTrue("Not correct error", e.getMessage().contains("ernb.01"));
-
- }
+
+ }
}
-
+
@Test
- public void eidasBindValid() throws SZRException_Exception, SzrCommunicationException, JsonMappingException,
+ public void eidasBindValid() throws SZRException_Exception, SzrCommunicationException, JsonMappingException,
JsonProcessingException, JoseException {
final SignContentResponse szrResponse = new SignContentResponse();
final SignContentEntry result1 = new SignContentEntry();
@@ -253,14 +253,14 @@ public class SzrClientTest {
Assert.assertNotNull("bcBind is null", bcBind);
Assert.assertEquals("bcBind not match", result1.getValue(), bcBind);
-
+
}
@Test
- public void eidasBindValidWithMds() throws SZRException_Exception, SzrCommunicationException, JoseException,
+ public void eidasBindValidWithMds() throws SZRException_Exception, SzrCommunicationException, JoseException,
JsonMappingException, JsonProcessingException {
basicConfig.putConfigValue("eidas.ms.auth.eIDAS.szrclient.eidasbind.mds.inject", "true");
-
+
final SignContentResponse szrResponse = new SignContentResponse();
final SignContentEntry result1 = new SignContentEntry();
final SignContentResponseType content = new SignContentResponseType();
@@ -280,7 +280,7 @@ public class SzrClientTest {
Assert.assertEquals("bcBind not match", result1.getValue(), bcBind);
}
-
+
@Test
public void getIdentityLinkRawModeValidResponse()
throws SZRException_Exception, EaafParserException, NoSuchProviderException, IOException, InvalidKeyException,
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java
index 1e7ff369..eff56ffd 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/SzrClientTestProduction.java
@@ -48,7 +48,7 @@ import org.springframework.util.Base64Utils;
import org.w3c.dom.Element;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.Constants;
-import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.EidasSAuthenticationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.SzrCommunicationException;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.szr.SzrClient;
@@ -98,32 +98,32 @@ public class SzrClientTestProduction {
}
@Test
- public void getVsz() throws SzrCommunicationException, EidasSAuthenticationException {
- String vsz = szrClient.getEncryptedStammzahl(getPersonInfo());
+ public void getVsz() throws SzrCommunicationException, EidasSAuthenticationException {
+ String vsz = szrClient.getEncryptedStammzahl(getPersonInfo());
Assert.assertNotNull("vsz", vsz);
-
+
}
@Test
- public void getEidasBind() throws SzrCommunicationException, EidasSAuthenticationException {
+ public void getEidasBind() throws SzrCommunicationException, EidasSAuthenticationException {
String vsz = RandomStringUtils.randomAlphanumeric(10);
String bindingPubKey = Base64.toBase64String(RandomStringUtils.random(20).getBytes());
String eidStatus = "urn:eidgvat:eid.status.eidas";
- ErnbEidData eidData = new ErnbEidData();
- eidData.setFamilyName(familyName);
- eidData.setGivenName(givenName);
- eidData.setDateOfBirth(new DateTime());
- eidData.setCitizenCountryCode("IS");
- eidData.setPseudonym("1234sdgsdfg56789ABCDEF");
-
-
- String eidasBind = szrClient.getEidsaBind(vsz, bindingPubKey, eidStatus, eidData);
-
+ ErnpEidData eidData = ErnpEidData.builder()
+ .familyName(familyName)
+ .givenName(givenName)
+ .dateOfBirth(new DateTime())
+ .citizenCountryCode("IS")
+ .pseudonym("1234sdgsdfg56789ABCDEF").build();
+
+
+ String eidasBind = szrClient.getEidsaBind(vsz, bindingPubKey, eidStatus, eidData);
+
Assert.assertNotNull("eidasBind", eidasBind);
-
+
}
-
-
+
+
@Test
public void getIdentityLinkRawMode() throws SZRException_Exception, EaafParserException,
NoSuchProviderException, IOException, InvalidKeyException, EidasSAuthenticationException {
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java
index 9bb51cd9..381406d2 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/validation/EidasAttributePostProcessingTest.java
@@ -41,7 +41,7 @@ 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.ErnbEidData;
+import at.asitplus.eidas.specific.modules.auth.eidas.v2.dao.ErnpEidData;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.service.CcSpecificEidProcessingService;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -116,7 +116,7 @@ public class EidasAttributePostProcessingTest {
/**
* jUnit class initializer.
- *
+ *
* @throws IOException In case of an error
*/
@BeforeClass
@@ -129,7 +129,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void deWithHexLowerCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P1_eIDASID,
P1_FAMILYNAME,
@@ -156,7 +156,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void deWithHexMixedCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P3_eIDASID,
P3_FAMILYNAME,
@@ -183,7 +183,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void deWithHexUpperCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P4_eIDASID,
P4_FAMILYNAME,
@@ -270,7 +270,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void eeTestCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P2_eIDASID,
P2_FAMILYNAME,
@@ -297,7 +297,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void eeTestFamilyNameMissingCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P2_eIDASID,
null,
@@ -326,7 +326,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void eeTestGivenNameMissingCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P2_eIDASID,
P2_FAMILYNAME,
@@ -355,7 +355,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void eeTestDateOfBirthMissingCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
P2_eIDASID,
P2_FAMILYNAME,
@@ -384,7 +384,7 @@ public class EidasAttributePostProcessingTest {
@Test
public void eeTestIdMissingCase() throws Exception {
try {
- final ErnbEidData result = postProcessor.postProcess(
+ final ErnpEidData result = postProcessor.postProcess(
generateInputData(
null,
P2_FAMILYNAME,
@@ -423,8 +423,8 @@ public class EidasAttributePostProcessingTest {
}
- private void validate(ErnbEidData result, String id, String familyName, String givenName,
- DateTime dateOfBirth, String placeOfBirth, String birthName) {
+ private void validate(ErnpEidData result, String id, String familyName, String givenName,
+ DateTime dateOfBirth, String placeOfBirth, String birthName) {
if (!result.getPseudonym().equals(id)) {
fail(result.getPseudonym() + "is not equal to " + id);
}