aboutsummaryrefslogtreecommitdiff
path: root/eidas_modules/authmodule-eIDAS-v2/src/main
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2021-03-04 15:04:08 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2021-03-04 15:04:08 +0100
commit20fcdf7cd830af9f23645c71f536af95418ad1be (patch)
treee9837d42665b3172b09bda45617e61568fe1dd3d /eidas_modules/authmodule-eIDAS-v2/src/main
parentc5d36685c294a383baecf4e12aaeda5be1f13529 (diff)
downloadNational_eIDAS_Gateway-20fcdf7cd830af9f23645c71f536af95418ad1be.tar.gz
National_eIDAS_Gateway-20fcdf7cd830af9f23645c71f536af95418ad1be.tar.bz2
National_eIDAS_Gateway-20fcdf7cd830af9f23645c71f536af95418ad1be.zip
Refactor SimpleEidasData to make it immutable
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main')
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java22
-rw-r--r--eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java27
2 files changed, 24 insertions, 25 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
index f60a9906..748994bb 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleEidasData.java
@@ -26,28 +26,28 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao;
import at.asitplus.eidas.specific.modules.auth.eidas.v2.exception.WorkflowException;
import at.gv.e_government.reference.namespace.persondata._20020228.PostalAddressType;
import lombok.AllArgsConstructor;
+import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.EqualsBuilder;
@Data
-@AllArgsConstructor
-@NoArgsConstructor
+@Builder
public class SimpleEidasData {
- private String citizenCountryCode;
+ private final String citizenCountryCode;
// MDS
- private String pseudonym;
- private String givenName;
- private String familyName;
- private String dateOfBirth;
+ private final String pseudonym;
+ private final String givenName;
+ private final String familyName;
+ private final String dateOfBirth;
// additional attributes
- private String placeOfBirth;
- private String birthName;
- private PostalAddressType address;
- private String taxNumber;
+ private final String placeOfBirth;
+ private final String birthName;
+ private final PostalAddressType address;
+ private final String taxNumber;
/**
* Compares the register result with the eidas data.
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
index d7bec42b..89b5444f 100644
--- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
+++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/InitialSearchTask.java
@@ -246,23 +246,22 @@ public class InitialSearchTask extends AbstractAuthServletTask {
private SimpleEidasData convertSimpleMapToSimpleData(Map<String, Object> eidasAttrMap)
throws EidasAttributeException {
- SimpleEidasData result = new SimpleEidasData();
- result.setCitizenCountryCode(EidasResponseUtils.processCountryCode(
- eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
- // MDS attributes
- result.setPseudonym(EidasResponseUtils.processPseudonym(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)));
- result.setFamilyName(EidasResponseUtils.processFamilyName(eidasAttrMap.get(eIDAS_ATTR_CURRENTFAMILYNAME)));
- result.setGivenName(EidasResponseUtils.processGivenName(eidasAttrMap.get(eIDAS_ATTR_CURRENTGIVENNAME)));
- result.setDateOfBirth(EidasResponseUtils.processDateOfBirthToString(eidasAttrMap.get(eIDAS_ATTR_DATEOFBIRTH)));
- // additional attributes
- result.setPlaceOfBirth(EidasResponseUtils.processPlaceOfBirth(eidasAttrMap.get(eIDAS_ATTR_PLACEOFBIRTH)));
- result.setBirthName(EidasResponseUtils.processBirthName(eidasAttrMap.get(eIDAS_ATTR_BIRTHNAME)));
- result.setAddress(EidasResponseUtils.processAddress(eidasAttrMap.get(eIDAS_ATTR_CURRENTADDRESS)));
+ SimpleEidasData.SimpleEidasDataBuilder builder = SimpleEidasData.builder()
+ .citizenCountryCode(EidasResponseUtils.processCountryCode(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)))
+ // MDS attributes
+ .pseudonym(EidasResponseUtils.processPseudonym(eidasAttrMap.get(eIDAS_ATTR_PERSONALIDENTIFIER)))
+ .familyName(EidasResponseUtils.processFamilyName(eidasAttrMap.get(eIDAS_ATTR_CURRENTFAMILYNAME)))
+ .givenName(EidasResponseUtils.processGivenName(eidasAttrMap.get(eIDAS_ATTR_CURRENTGIVENNAME)))
+ .dateOfBirth(EidasResponseUtils.processDateOfBirthToString(eidasAttrMap.get(eIDAS_ATTR_DATEOFBIRTH)))
+ // additional attributes
+ .placeOfBirth(EidasResponseUtils.processPlaceOfBirth(eidasAttrMap.get(eIDAS_ATTR_PLACEOFBIRTH)))
+ .birthName(EidasResponseUtils.processBirthName(eidasAttrMap.get(eIDAS_ATTR_BIRTHNAME)))
+ .address(EidasResponseUtils.processAddress(eidasAttrMap.get(eIDAS_ATTR_CURRENTADDRESS)));
if (eidasAttrMap.containsKey(eIDAS_ATTR_TAXREFERENCE)) {
- result.setTaxNumber(EidasResponseUtils.processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
+ builder.taxNumber(EidasResponseUtils.processTaxReference(eidasAttrMap.get(eIDAS_ATTR_TAXREFERENCE)));
}
//TODO other additional attributes
- return result;
+ return builder.build();
}
private Map<String, Object> convertEidasAttrToSimpleMap(