diff options
author | Christian Kollmann <christian.kollmann@a-sit.at> | 2021-03-04 15:07:56 +0100 |
---|---|---|
committer | Christian Kollmann <christian.kollmann@a-sit.at> | 2021-03-04 15:07:56 +0100 |
commit | 5326c05f8d07d2935549b929511b9e0578bb022d (patch) | |
tree | 819f72cd6c56f76a3a65ac75c6c9f726ded4d9d9 /eidas_modules/authmodule-eIDAS-v2/src | |
parent | 76fcc8227de6375a6ae5e988acd368c2cf893516 (diff) | |
download | National_eIDAS_Gateway-5326c05f8d07d2935549b929511b9e0578bb022d.tar.gz National_eIDAS_Gateway-5326c05f8d07d2935549b929511b9e0578bb022d.tar.bz2 National_eIDAS_Gateway-5326c05f8d07d2935549b929511b9e0578bb022d.zip |
Refactor SimpleMobilePhoneData to make it immutable
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src')
3 files changed, 15 insertions, 13 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java index e147b8aa..0c977016 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/MergedRegisterSearchResult.java @@ -31,8 +31,8 @@ import java.util.List; @Data public class MergedRegisterSearchResult { - final List<RegisterResult> resultsZmr; - final List<RegisterResult> resultsErnp; + private final List<RegisterResult> resultsZmr; + private final List<RegisterResult> resultsErnp; public MergedRegisterSearchResult(List<RegisterResult> resultsZmr, List<RegisterResult> resultsErnp) { this.resultsZmr = resultsZmr; diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleMobileSignatureData.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleMobileSignatureData.java index e7a5547a..4a27e60e 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleMobileSignatureData.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/dao/SimpleMobileSignatureData.java @@ -23,17 +23,19 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.dao; +import lombok.Builder; import lombok.Data; import org.apache.commons.lang3.builder.EqualsBuilder; @Data +@Builder public class SimpleMobileSignatureData { - private String citizenCountryCode; - private String bpk; - private String givenName; - private String familyName; - private String dateOfBirth; + private final String citizenCountryCode; + private final String bpk; + private final String givenName; + private final String familyName; + private final String dateOfBirth; /** * Compares the received authentication data from the mobile phone signature with the eid data received via eIDAS. diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java index 57531493..64327d40 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/tasks/ReceiveMobilePhoneSignatureResponseTask.java @@ -340,7 +340,7 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet private SimpleMobileSignatureData getAuthDataFromInterfederation(AssertionAttributeExtractor extractor) throws EaafBuilderException { List<String> requiredAttributes = IdAustriaClientAuthConstants.DEFAULT_REQUIRED_PVP_ATTRIBUTE_NAMES; - SimpleMobileSignatureData result = new SimpleMobileSignatureData(); + SimpleMobileSignatureData.SimpleMobileSignatureDataBuilder builder = SimpleMobileSignatureData.builder(); if (!extractor.containsAllRequiredAttributes(requiredAttributes)) { log.warn("PVP Response from 'ID Austria node' contains not all requested attributes."); AssertionValidationExeption e = new AssertionValidationExeption(ERROR_PVP_06, @@ -350,23 +350,23 @@ public class ReceiveMobilePhoneSignatureResponseTask extends AbstractAuthServlet final Set<String> includedAttrNames = extractor.getAllIncludeAttributeNames(); for (final String attrName : includedAttrNames) { if (PvpAttributeDefinitions.BPK_NAME.equals(attrName)) { - result.setBpk(extractor.getSingleAttributeValue(attrName)); + builder.bpk(extractor.getSingleAttributeValue(attrName)); } if (PvpAttributeDefinitions.GIVEN_NAME_NAME.equals(attrName)) { - result.setGivenName(extractor.getSingleAttributeValue(attrName)); + builder.givenName(extractor.getSingleAttributeValue(attrName)); } if (PvpAttributeDefinitions.PRINCIPAL_NAME_NAME.equals(attrName)) { - result.setFamilyName(extractor.getSingleAttributeValue(attrName)); + builder.familyName(extractor.getSingleAttributeValue(attrName)); } if (PvpAttributeDefinitions.BIRTHDATE_NAME.equals(attrName)) { - result.setDateOfBirth(extractor.getSingleAttributeValue(attrName)); + builder.dateOfBirth(extractor.getSingleAttributeValue(attrName)); } if (PvpAttributeDefinitions.EID_CITIZEN_EIDAS_QAA_LEVEL_NAME.equals(attrName)) { getAuthProcessDataWrapper().setQaaLevel(extractor.getSingleAttributeValue(attrName)); } } getAuthProcessDataWrapper().setIssueInstant(extractor.getAssertionIssuingDate()); - return result; + return builder.build(); } |