From 7bf30c7b020cfaa527b813085b49b86a2385d146 Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Tue, 11 Oct 2022 18:52:20 +0200 Subject: feat(proxyservice): log warning in case of missing attributes --- .../protocol/ProxyServiceAuthenticationAction.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/ProxyServiceAuthenticationAction.java b/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/ProxyServiceAuthenticationAction.java index 7d01deda..d3c93421 100644 --- a/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/ProxyServiceAuthenticationAction.java +++ b/modules/eidas_proxy-sevice/src/main/java/at/asitplus/eidas/specific/modules/msproxyservice/protocol/ProxyServiceAuthenticationAction.java @@ -239,7 +239,7 @@ public class ProxyServiceAuthenticationAction implements IAction { IEidAuthData eidAuthData) { eidasReq.getRequestedAttributes().getAttributeMap().keySet().stream() .forEach(el -> injectEidasAttribute(attributeMap, eidAuthData, - el.getNameUri().toString(), eidAuthData.isUseMandate())); + el.getNameUri().toString(), eidAuthData.isUseMandate(), el.isRequired())); } @@ -248,12 +248,12 @@ public class ProxyServiceAuthenticationAction implements IAction { ImmutableAttributeMap requestedAttributes) { attrRegistry.getRepresentativeAttributesToAddByDefault() .filter(el -> requestedAttributes.getAttributeValuesByNameUri(el) == null) - .forEach(el -> injectEidasAttribute(attributeMap, eidAuthData, el, true)); + .forEach(el -> injectEidasAttribute(attributeMap, eidAuthData, el, true, true)); } private void injectEidasAttribute(ImmutableAttributeMap.Builder attributeMap, IEidAuthData eidAuthData, - String eidasAttrName, boolean mandatesUsed) { + String eidasAttrName, boolean mandatesUsed, boolean isRequired) { final Optional releatedIdaAttribute = attrRegistry.mapEidasAttributeToSpecificIdaAttribute(eidasAttrName, mandatesUsed); if (releatedIdaAttribute.isPresent()) { @@ -267,7 +267,10 @@ public class ProxyServiceAuthenticationAction implements IAction { attrRegistry.getCoreRegistry().getCoreAttributeRegistry().getByName(eidasAttrName), idaAttrValue); - } else { + } else if (isRequired) { + log.warn("eIDAS attribute: {} is marked as required, but no attribute-value available", eidasAttrName); + + } else { log.info("No IDA attribute: {}, eIDAS attribute: {} will be ignored", releatedIdaAttribute.get(), eidasAttrName); -- cgit v1.2.3