aboutsummaryrefslogtreecommitdiff
path: root/modules/eidas_proxy-sevice/src/main/java
diff options
context:
space:
mode:
authorThomas <>2022-08-17 09:53:46 +0200
committerThomas <>2022-08-17 09:53:46 +0200
commit920d33465e5ab1a71d81cc280e41de10cd8b5247 (patch)
tree1cf2bf2853d604d8579cc3f5bf411d10f80c0207 /modules/eidas_proxy-sevice/src/main/java
parentee60dcbde9210e6ecf417af9fd7e4f13e8d95bbd (diff)
downloadNational_eIDAS_Gateway-920d33465e5ab1a71d81cc280e41de10cd8b5247.tar.gz
National_eIDAS_Gateway-920d33465e5ab1a71d81cc280e41de10cd8b5247.tar.bz2
National_eIDAS_Gateway-920d33465e5ab1a71d81cc280e41de10cd8b5247.zip
feat(eidas): extend EJusticePersonRoleHandler to include additional requested attributes
Diffstat (limited to 'modules/eidas_proxy-sevice/src/main/java')
-rw-r--r--modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/handler/EJusticePersonRoleHandler.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/handler/EJusticePersonRoleHandler.java b/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/handler/EJusticePersonRoleHandler.java
index 87a033eb..6a5e4967 100644
--- a/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/handler/EJusticePersonRoleHandler.java
+++ b/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/handler/EJusticePersonRoleHandler.java
@@ -33,6 +33,9 @@ public class EJusticePersonRoleHandler implements IEidasAttributeHandler {
public static final String CONFIG_PROP_IDA_MANDATE_PROFILE = "advanced.attributes.ejusticerole.mandate.profiles";
public static final String CONFIG_PROP_IDA_MANDATE_MODE = "advanced.attributes.ejusticerole.mandate.mode";
+ public static final String CONFIG_PROP_IDA_ADDITIONAL_ATTRIBUTES =
+ "advanced.attributes.ejusticerole.additional.ida.attributes";
+
public static final String CONFIG_PROP_RESULT_PREFIX = "advanced.attributes.ejusticerole.value";
public static final String CONFIG_PROP_RESULT_VALUE_DELIMITER = "=";
@@ -41,14 +44,21 @@ public class EJusticePersonRoleHandler implements IEidasAttributeHandler {
private SpMandateModes mandateMode;
private List<String> mandateProfiles;
+ private List<String> additionalReqAttributes;
private Map<String, String> resultMapper;
@Override
public void performSpConfigPostprocessing(ServiceProviderConfiguration spConfig) {
spConfig.setMandateMode(mandateMode);
- spConfig.setMandateProfiles(mandateProfiles);
+ spConfig.setMandateProfiles(mandateProfiles);
log.info("Enforcing mandate-mode: {} with profile: {}", mandateMode, mandateProfiles);
+ if (!additionalReqAttributes.isEmpty()) {
+ spConfig.getRequestedAttributes().addAll(additionalReqAttributes);
+ log.info("Add additional requested attributes: {}", additionalReqAttributes);
+
+ }
+
}
@Override
@@ -80,8 +90,10 @@ public class EJusticePersonRoleHandler implements IEidasAttributeHandler {
@PostConstruct
private void initialize() throws EaafConfigurationException {
- mandateMode = SpMandateModes.fromString(loadConfigValue(CONFIG_PROP_IDA_MANDATE_MODE));
- mandateProfiles = KeyValueUtils.getListOfCsvValues(loadConfigValue(CONFIG_PROP_IDA_MANDATE_PROFILE));
+ mandateMode = SpMandateModes.fromString(loadConfigValue(CONFIG_PROP_IDA_MANDATE_MODE, true));
+ mandateProfiles = KeyValueUtils.getListOfCsvValues(loadConfigValue(CONFIG_PROP_IDA_MANDATE_PROFILE, true));
+ additionalReqAttributes = KeyValueUtils.getListOfCsvValues(
+ loadConfigValue(CONFIG_PROP_IDA_ADDITIONAL_ATTRIBUTES, false));
resultMapper = config.getBasicConfigurationWithPrefix(CONFIG_PROP_RESULT_PREFIX).values().stream()
.filter(el -> el.contains(CONFIG_PROP_RESULT_VALUE_DELIMITER))
.collect(Collectors.toMap(x -> split(x, 0), x -> split(x, 1)));
@@ -111,9 +123,9 @@ public class EJusticePersonRoleHandler implements IEidasAttributeHandler {
}
- private String loadConfigValue(String configProp) throws EaafConfigurationException {
+ private String loadConfigValue(String configProp, boolean isRequired) throws EaafConfigurationException {
String value = config.getBasicConfiguration(configProp);
- if (StringUtils.isEmpty(value)) {
+ if (StringUtils.isEmpty(value) && isRequired) {
throw new EaafConfigurationException("internal.configuration.00",
new Object[]{configProp});