From 6bd9903633452f01531e9830db0242e9bf081242 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 31 Oct 2019 09:48:29 +0100 Subject: add country specific pre-processing to build country specific eIDAS requests --- .../service/eIDASAttributeRegistry.java | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java index 116f2197..6e934c59 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/main/java/at/asitplus/eidas/specific/modules/authmodule_eIDASv2/service/eIDASAttributeRegistry.java @@ -23,6 +23,7 @@ package at.asitplus.eidas.specific.modules.authmodule_eIDASv2.service; import java.io.File; +import java.text.MessageFormat; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,6 +40,7 @@ import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; import at.gv.egiz.eaaf.core.api.idp.IConfigurationWithSP; import at.gv.egiz.eaaf.core.exceptions.EAAFConfigurationException; import at.gv.egiz.eaaf.core.impl.utils.KeyValueUtils; +import edu.umd.cs.findbugs.annotations.NonNull; import eu.eidas.auth.commons.attribute.AttributeRegistries; import eu.eidas.auth.commons.attribute.AttributeRegistry; @@ -93,8 +95,25 @@ public class eIDASAttributeRegistry { return coreAttributeRegistry; } - public Map getAttributeSetFromConfiguration() { - Map result = new HashMap(); + @NonNull + public Map getDefaultAttributeSetFromConfiguration() { + /*TODO: select set for representation if mandates should be used. + * It's an open task in respect to requested eIDAS attributes and isRequired flag, + * because there can be a decision problem in case of natural or legal person representation! + * From an Austrian use-case point of view, an Austrian service provider can support mandates for + * natural and legal persons at the same time. However, we CAN NOT request attributes for natural AND + * legal persons on the same time, because it's not possible to represent both simultaneously. + */ + Map configAttributes = + basicConfig.getBasicConfigurationWithPrefix( + Constants.CONIG_PROPS_EIDAS_NODE_ATTRIBUTES_REQUESTED_DEFAULT_ONLYNATURAL); + return processAttributeInfosFromConfig(configAttributes); + + } + + @NonNull + public Map getAttributeSetFromConfiguration(String countryCode) { + /*TODO: select set for representation if mandates should be used. * It's an open task in respect to requested eIDAS attributes and isRequired flag, @@ -105,7 +124,16 @@ public class eIDASAttributeRegistry { */ Map configAttributes = basicConfig.getBasicConfigurationWithPrefix( - Constants.CONIG_PROPS_EIDAS_NODE_ATTRIBUTES_REQUESTED_ONLYNATURAL); + MessageFormat.format( + Constants.CONIG_PROPS_EIDAS_NODE_ATTRIBUTES_REQUESTED_CC_SPECIFIC_ONLYNATURAL, + countryCode.toLowerCase())); + return processAttributeInfosFromConfig(configAttributes); + + } + + private Map processAttributeInfosFromConfig(Map configAttributes) { + + Map result = new HashMap(); for (String el: configAttributes.values()) { if (StringUtils.isNotEmpty(el.trim())) { List attrDef = KeyValueUtils.getListOfCSVValues(el.trim()); @@ -122,8 +150,7 @@ public class eIDASAttributeRegistry { return result; } - - + public void setEidasAttributesFile(String eidasAttributesFile) { this.eidasAttributesFile = eidasAttributesFile; } -- cgit v1.2.3