[java-identity-provider] 02/02: IDP-1450 Review feedback
Rod Widdowson
rdw at steadingsoftware.com
Sat Jul 13 09:47:55 EDT 2019
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch master
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=e9365e27d32d58cf205d6cfaea6c018efc1692cf
commit e9365e27d32d58cf205d6cfaea6c018efc1692cf
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Jul 13 09:11:24 2019 -0400
IDP-1450 Review feedback
https://issues.shibboleth.net/jira/browse/IDP-1450
We want to match the type of the setters and the getters so just
changing just the setters to Boolean (from boolean) won't work.
Adding a new setter with the same name and a Boolean also doesn't work
because Spring chooses the boolean setter - even when given a Boolean
value, which blows up with nulls, the avoidance of which is the point
of the entire exercise.
---
.../filter/matcher/impl/AbstractStringMatcher.java | 11 +++++++-
.../saml/impl/AttributeInMetadataMatcher.java | 30 +++++++++++++++++++---
.../impl/AbstractEntityAttributePolicyRule.java | 18 +++++++++++--
.../AttributeRequesterInEntityGroupPolicyRule.java | 21 ++++++++++++---
.../matcher/impl/AbstractStringMatcherParser.java | 2 +-
.../impl/AbstractEntityAttributeRuleParser.java | 2 +-
.../AttributeRequesterInEntityGroupRuleParser.java | 2 +-
.../impl/MappedAttributeInMetadataRuleParser.java | 4 +--
.../ad/mapped/impl/MappedAttributeDefinition.java | 16 ++++++++++--
.../resolver/dc/impl/SubjectDataConnector.java | 19 ++++++++++++++
.../dc/ldap/impl/ConnectionFactoryValidator.java | 3 ++-
.../impl/MappedAttributeDefinitionParser.java | 2 +-
.../spring/dc/impl/SubjectDataConnectorParser.java | 10 ++++----
.../impl/AttributeResolverServiceStrategy.java | 10 +++++---
.../spring/dc/SubjectDataConnectorParserTest.java | 9 +++++++
.../spring/dc/resolver/subjectAttributesNull.xml | 6 +++++
16 files changed, 138 insertions(+), 27 deletions(-)
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractStringMatcher.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractStringMatcher.java
index 263e1e8..f312d67 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractStringMatcher.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/impl/AbstractStringMatcher.java
@@ -94,9 +94,18 @@ public abstract class AbstractStringMatcher extends AbstractMatcher implements M
* Sets whether the match evaluation is case sensitive.
*
* @param isCaseSensitive whether the match evaluation is case sensitive
+ */
+ public void setCaseSensitive(final boolean isCaseSensitive) {
+ caseSensitive = isCaseSensitive;
+ }
+
+ /**
+ * Sets whether the match evaluation is case sensitive (Boolean Object parameter).
+ *
+ * @param isCaseSensitive whether the match evaluation is case sensitive
* @since 4.0.0
*/
- public void setCaseSensitive(final @Nullable Boolean isCaseSensitive) {
+ public void setCaseSensitiveBoolean(final @Nullable Boolean isCaseSensitive) {
if (null == isCaseSensitive) {
log.warn("{} empty property passed to isCaseSensitive", getLogPrefix());
return;
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/AttributeInMetadataMatcher.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/AttributeInMetadataMatcher.java
index 6b19d7b..551a73c 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/AttributeInMetadataMatcher.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/matcher/saml/impl/AttributeInMetadataMatcher.java
@@ -97,11 +97,12 @@ public class AttributeInMetadataMatcher extends AbstractIdentifiableInitializabl
}
/**
- * Sets whether optionally requested attributes should be matched.
+ * Sets whether optionally requested attributes should be matched (Boolean Object parameter).
*
* @param flag whether optionally requested attributes should be matched
+ * @since 4.0.0
*/
- public void setOnlyIfRequired(final @Nullable Boolean flag) {
+ public void setOnlyIfRequiredBoolean(final @Nullable Boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
if (null == flag) {
log.warn("{} empty property passed to onlyIfRequired", getLogPrefix());
@@ -111,6 +112,16 @@ public class AttributeInMetadataMatcher extends AbstractIdentifiableInitializabl
}
/**
+ * Sets whether optionally requested attributes should be matched.
+ *
+ * @param flag whether optionally requested attributes should be matched
+ */
+ public void setOnlyIfRequired(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ onlyIfRequired = flag;
+ }
+
+ /**
* Gets whether to matched if the metadata contains no AttributeConsumingService.
*
* @return whether to match if the metadata contains no AttributeConsumingService
@@ -120,11 +131,12 @@ public class AttributeInMetadataMatcher extends AbstractIdentifiableInitializabl
}
/**
- * Sets whether to match if the metadata contains no AttributeConsumingService.
+ * Sets whether to match if the metadata contains no AttributeConsumingService (Boolean object parameter).
*
* @param flag whether to match if the metadata contains no AttributeConsumingService
+ * @since 4.0.0
*/
- public void setMatchIfMetadataSilent(final @Nullable Boolean flag) {
+ public void setMatchIfMetadataSilentBoolean(final @Nullable Boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
if (null == flag) {
log.warn("{} empty property passed to matchIfMetadataSilent", getLogPrefix());
@@ -134,6 +146,16 @@ public class AttributeInMetadataMatcher extends AbstractIdentifiableInitializabl
}
/**
+ * Sets whether to match if the metadata contains no AttributeConsumingService.
+ *
+ * @param flag whether to match if the metadata contains no AttributeConsumingService
+ */
+ public void setMatchIfMetadataSilent(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ matchIfMetadataSilent = flag;
+ }
+
+ /**
* Get the SAML Attribute Name to look for in the metadata. If not used, the
* evaluated attribute's own eventual encoded name(s) will be used to find a match.
*
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AbstractEntityAttributePolicyRule.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AbstractEntityAttributePolicyRule.java
index 961e249..d13223f 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AbstractEntityAttributePolicyRule.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AbstractEntityAttributePolicyRule.java
@@ -136,13 +136,15 @@ public abstract class AbstractEntityAttributePolicyRule extends AbstractPolicyRu
}
/**
- * Sets whether to ignore unmapped/decoded EntityAttribute extensions as an optimization.
+ * Sets whether to ignore unmapped/decoded EntityAttribute extensions as an optimization
+ * (Boolean Object parameter)
*
* <p>Defaults to false. Only applies if {@link #nameFormat} property is set.</p>
*
* @param flag flag to set
+ * @since 4.0.0
*/
- public void setIgnoreUnmappedEntityAttributes(final @Nullable Boolean flag) {
+ public void setIgnoreUnmappedEntityAttributesBoolean(final @Nullable Boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
if (null == flag) {
log.warn("{} empty property passed to ignoreUnmappedEntityAttribute", getLogPrefix());
@@ -150,6 +152,18 @@ public abstract class AbstractEntityAttributePolicyRule extends AbstractPolicyRu
}
ignoreUnmappedEntityAttributes = flag;
}
+
+ /**
+ * Sets whether to ignore unmapped/decoded EntityAttribute extensions as an optimization.
+ *
+ * <p>Defaults to false. Only applies if {@link #nameFormat} property is set.</p>
+ *
+ * @param flag flag to set
+ */
+ public void setIgnoreUnmappedEntityAttributes(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ignoreUnmappedEntityAttributes = flag;
+ }
/** {@inheritDoc} */
@Override protected void doInitialize() throws ComponentInitializationException {
diff --git a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeRequesterInEntityGroupPolicyRule.java b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeRequesterInEntityGroupPolicyRule.java
index e611e9c..2dd7cd7 100644
--- a/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeRequesterInEntityGroupPolicyRule.java
+++ b/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/policyrule/saml/impl/AttributeRequesterInEntityGroupPolicyRule.java
@@ -75,14 +75,14 @@ public class AttributeRequesterInEntityGroupPolicyRule extends AbstractPolicyRul
/**
* Set whether to check a supplied {@link org.opensaml.saml.metadata.resolver.MetadataResolver}
- * for membership in an AffiliationDescriptor
- * as a form of group policy.
+ * for membership in an AffiliationDescriptor as a form of group policy (Boolean parameter).
*
* <p>Defaults to false.</p>
*
* @param flag flag to set
+ * @since 4.0.0
*/
- public void setCheckAffiliations(final @Nullable Boolean flag) {
+ public void setCheckAffiliationsBoolean(final @Nullable Boolean flag) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
if (null == flag) {
log.warn("{} empty property passed to checkAffiliations", getLogPrefix());
@@ -91,6 +91,21 @@ public class AttributeRequesterInEntityGroupPolicyRule extends AbstractPolicyRul
checkAffiliations = flag;
}
+
+ /**
+ * Set whether to check a supplied {@link org.opensaml.saml.metadata.resolver.MetadataResolver}
+ * for membership in an AffiliationDescriptor
+ * as a form of group policy.
+ *
+ * <p>Defaults to false.</p>
+ *
+ * @param flag flag to set
+ */
+ public void setCheckAffiliations(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ checkAffiliations = flag;
+ }
+
/**
* Returns whether we check a supplied {@link org.opensaml.saml.metadata.resolver.MetadataResolver}
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/impl/AbstractStringMatcherParser.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/impl/AbstractStringMatcherParser.java
index b207d1b..5965299 100644
--- a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/impl/AbstractStringMatcherParser.java
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/matcher/impl/AbstractStringMatcherParser.java
@@ -53,7 +53,7 @@ public abstract class AbstractStringMatcherParser extends BaseAttributeValueMatc
parserContext.getReaderContext().getResource().getDescription());
}
- builder.addPropertyValue("caseSensitive", SpringSupport.getStringValueAsBoolean(
+ builder.addPropertyValue("caseSensitiveBoolean", SpringSupport.getStringValueAsBoolean(
StringSupport.trimOrNull(element.getAttributeNS(null, "caseSensitive"))));
} else if (element.hasAttributeNS(null, "ignoreCase")) {
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AbstractEntityAttributeRuleParser.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AbstractEntityAttributeRuleParser.java
index e030bf3..9ac2c9d 100644
--- a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AbstractEntityAttributeRuleParser.java
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AbstractEntityAttributeRuleParser.java
@@ -45,7 +45,7 @@ public abstract class AbstractEntityAttributeRuleParser extends BasePolicyRulePa
}
if (element.hasAttributeNS(null, "ignoreUnmappedEntityAttributes")) {
- builder.addPropertyValue("ignoreUnmappedEntityAttributes", SpringSupport.getStringValueAsBoolean(
+ builder.addPropertyValue("ignoreUnmappedEntityAttributesBoolean", SpringSupport.getStringValueAsBoolean(
StringSupport.trimOrNull(element.getAttributeNS(null, "ignoreUnmappedEntityAttributes"))));
}
}
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AttributeRequesterInEntityGroupRuleParser.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AttributeRequesterInEntityGroupRuleParser.java
index 7bd7f4a..a004881 100644
--- a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AttributeRequesterInEntityGroupRuleParser.java
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/AttributeRequesterInEntityGroupRuleParser.java
@@ -49,7 +49,7 @@ public class AttributeRequesterInEntityGroupRuleParser extends BasePolicyRulePar
builder.addPropertyValue("entityGroup", StringSupport.trimOrNull(element.getAttributeNS(null, "groupID")));
if (element.hasAttributeNS(null, "checkAffiliations")) {
- builder.addPropertyValue("checkAffiliations", SpringSupport.getStringValueAsBoolean(
+ builder.addPropertyValue("checkAffiliationsBoolean", SpringSupport.getStringValueAsBoolean(
StringSupport.trimOrNull(element.getAttributeNS(null, "checkAffiliations"))));
}
}
diff --git a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/MappedAttributeInMetadataRuleParser.java b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/MappedAttributeInMetadataRuleParser.java
index 9563ae7..8be782e 100644
--- a/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/MappedAttributeInMetadataRuleParser.java
+++ b/idp-attribute-filter-spring/src/main/java/net/shibboleth/idp/attribute/filter/spring/saml/impl/MappedAttributeInMetadataRuleParser.java
@@ -58,12 +58,12 @@ public class MappedAttributeInMetadataRuleParser extends BaseAttributeValueMatch
super.doParse(config, builder);
if (config.hasAttributeNS(null, "onlyIfRequired")) {
- builder.addPropertyValue("onlyIfRequired", SpringSupport.getStringValueAsBoolean(
+ builder.addPropertyValue("onlyIfRequiredBoolean", SpringSupport.getStringValueAsBoolean(
StringSupport.trimOrNull(config.getAttributeNS(null, "onlyIfRequired"))));
}
if (config.hasAttributeNS(null, "matchIfMetadataSilent")) {
- builder.addPropertyValue("matchIfMetadataSilent", SpringSupport.getStringValueAsBoolean(
+ builder.addPropertyValue("matchIfMetadataSilentBoolean", SpringSupport.getStringValueAsBoolean(
StringSupport.trimOrNull(config.getAttributeNS(null, "matchIfMetadataSilent"))));
}
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeDefinition.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeDefinition.java
index 231d631..360021a 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeDefinition.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/ad/mapped/impl/MappedAttributeDefinition.java
@@ -143,11 +143,12 @@ public class MappedAttributeDefinition extends AbstractAttributeDefinition {
}
/**
- * Sets whether the definition passes unmatched values through.
+ * Sets whether the definition passes unmatched values through (Boolean object parameter).
*
* @param newPassThru whether the definition passes unmatched values unchanged or suppresses them.
+ * @since 4.0.0
*/
- public void setPassThru(final @Nullable Boolean newPassThru) {
+ public void setPassThruBoolean(final @Nullable Boolean newPassThru) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
if (newPassThru == null) {
@@ -158,6 +159,17 @@ public class MappedAttributeDefinition extends AbstractAttributeDefinition {
}
/**
+ * Sets whether the definition passes unmatched values through.
+ *
+ * @param newPassThru whether the definition passes unmatched values unchanged or suppresses them.
+ */
+ public void setPassThru(final boolean newPassThru) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+ passThru = newPassThru;
+ }
+
+ /**
* Maps the value from a dependency in to the value(s) for this attribute.
*
* @param value the value from the dependency
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/SubjectDataConnector.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/SubjectDataConnector.java
index e2539dc..d0663a1 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/SubjectDataConnector.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/impl/SubjectDataConnector.java
@@ -23,6 +23,7 @@ import java.util.Map;
import java.util.function.Function;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import javax.security.auth.Subject;
@@ -98,6 +99,24 @@ public class SubjectDataConnector extends AbstractDataConnector {
noResultIsError = flag;
}
+ /**
+ * Sets whether obtaining no results should be treated as an error.
+ *
+ * <p>Defaults to false.</p>
+ *
+ * @param flag flag to set
+ * @since 4.0.0
+ */
+ public void setNoResultIsErrorBoolean(final @Nullable Boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ if (null == flag) {
+ log.warn("{} empty property passed to setNoResultIsError", getLogPrefix());
+ return;
+ }
+
+ noResultIsError = flag;
+ }
+
/** {@inheritDoc} */
@Override
@Nonnull protected Map<String,IdPAttribute> doDataConnectorResolve(
diff --git a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ConnectionFactoryValidator.java b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ConnectionFactoryValidator.java
index 5e752fe..9df9c06 100644
--- a/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ConnectionFactoryValidator.java
+++ b/idp-attribute-resolver-impl/src/main/java/net/shibboleth/idp/attribute/resolver/dc/ldap/impl/ConnectionFactoryValidator.java
@@ -18,6 +18,7 @@
package net.shibboleth.idp.attribute.resolver.dc.ldap.impl;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.ldaptive.Connection;
import org.ldaptive.ConnectionFactory;
@@ -84,7 +85,7 @@ public class ConnectionFactoryValidator extends AbstractInitializableComponent i
*
* @param what whether {@link #validate()} should throw or log errors
*/
- public void setThrowValidateError(final Boolean what) {
+ public void setThrowValidateError(@Nullable final Boolean what) {
if (null != what) {
throwOnValidateError = what;
}
diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/ad/mapped/impl/MappedAttributeDefinitionParser.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/ad/mapped/impl/MappedAttributeDefinitionParser.java
index 1fd96bd..151ef5c 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/ad/mapped/impl/MappedAttributeDefinitionParser.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/ad/mapped/impl/MappedAttributeDefinitionParser.java
@@ -80,7 +80,7 @@ public class MappedAttributeDefinitionParser extends BaseResolverPluginParser {
log.info("{} Default value and passThru both specified", getLogPrefix(), getDefinitionId());
}
passThru = StringSupport.trimOrNull(defaultValueElement.getAttributeNS(null, "passThru"));
- builder.addPropertyValue("passThru", SpringSupport.getStringValueAsBoolean(passThru));
+ builder.addPropertyValue("passThruBoolean", SpringSupport.getStringValueAsBoolean(passThru));
}
}
diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/SubjectDataConnectorParser.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/SubjectDataConnectorParser.java
index 64eae8a..d71c2e3 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/SubjectDataConnectorParser.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/dc/impl/SubjectDataConnectorParser.java
@@ -24,10 +24,11 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
+import net.shibboleth.ext.spring.util.SpringSupport;
import net.shibboleth.idp.attribute.resolver.dc.impl.SubjectDataConnector;
import net.shibboleth.idp.attribute.resolver.spring.dc.AbstractDataConnectorParser;
import net.shibboleth.idp.attribute.resolver.spring.impl.AttributeResolverNamespaceHandler;
-import net.shibboleth.utilities.java.support.xml.AttributeSupport;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
/** Bean definition Parser for a {@link SubjectDataConnector}. */
public class SubjectDataConnectorParser extends AbstractDataConnectorParser {
@@ -45,10 +46,9 @@ public class SubjectDataConnectorParser extends AbstractDataConnectorParser {
@Override protected void doV2Parse(@Nonnull final Element config, @Nonnull final ParserContext parserContext,
@Nonnull final BeanDefinitionBuilder builder) {
- final String noResultIsError =
- AttributeSupport.getAttributeValue(config, new QName("noResultIsError"));
- if (noResultIsError != null) {
- builder.addPropertyValue("noResultIsError", noResultIsError);
+ if (config.hasAttributeNS(null, "noResultIsError")) {
+ builder.addPropertyValue("noResultIsErrorBoolean", SpringSupport.getStringValueAsBoolean(
+ StringSupport.trimOrNull(config.getAttributeNS(null, "noResultIsError"))));
}
}
diff --git a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/AttributeResolverServiceStrategy.java b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/AttributeResolverServiceStrategy.java
index 025833e..450ba70 100644
--- a/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/AttributeResolverServiceStrategy.java
+++ b/idp-attribute-resolver-spring/src/main/java/net/shibboleth/idp/attribute/resolver/spring/impl/AttributeResolverServiceStrategy.java
@@ -38,8 +38,8 @@ import net.shibboleth.utilities.java.support.service.ServiceableComponent;
/**
* Strategy for summoning up an {@link AttributeResolverImpl} from a populated {@link ApplicationContext}. We do this by
- * finding all the configured {@link AttributeDefinition}, {@link DataConnector} and {@link PrincipalConnector} beans
- * and bunging them into the Attribute Resolver which we then initialize.
+ * finding all the configured {@link AttributeDefinition} and {@link DataConnector} beans and bunging them into the
+ * Attribute Resolver which we then initialize.
*/
public class AttributeResolverServiceStrategy extends AbstractIdentifiableInitializableComponent implements
Function<ApplicationContext,ServiceableComponent<AttributeResolver>> {
@@ -61,7 +61,11 @@ public class AttributeResolverServiceStrategy extends AbstractIdentifiableInitia
* Sets whether to strip nulls from attribute values.
* @param doStripNulls what to set
*/
- public void setStripNulls(final Boolean doStripNulls) {
+ public void setStripNulls(@Nullable final Boolean doStripNulls) {
+ if (null == doStripNulls) {
+ log.warn("Attribute resolver: {} empty value passed to stripNulls. Ignored", getId());
+ return;
+ }
stripNulls = doStripNulls;
}
diff --git a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/SubjectDataConnectorParserTest.java b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/SubjectDataConnectorParserTest.java
index acfdc2c..9e5128f 100644
--- a/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/SubjectDataConnectorParserTest.java
+++ b/idp-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/SubjectDataConnectorParserTest.java
@@ -41,4 +41,13 @@ public class SubjectDataConnectorParserTest extends BaseAttributeDefinitionParse
assertTrue(connector.isNoResultIsError());
}
+ @Test public void emptyNoResultIsError() {
+ final SubjectDataConnector connector = getDataConnector("resolver/subjectAttributesNull.xml", SubjectDataConnector.class);
+
+ assertFalse(connector.isExportAllAttributes());
+ assertEquals(connector.getExportAttributes().size(), 2);
+ assertTrue(connector.getExportAttributes().contains("foo"));
+ assertTrue(connector.getExportAttributes().contains("bar"));
+ assertFalse(connector.isNoResultIsError());
+ }
}
\ No newline at end of file
diff --git a/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/subjectAttributesNull.xml b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/subjectAttributesNull.xml
new file mode 100644
index 0000000..e2f5e12
--- /dev/null
+++ b/idp-attribute-resolver-spring/src/test/resources/net/shibboleth/idp/attribute/resolver/spring/dc/resolver/subjectAttributesNull.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<DataConnector id="subjectAttributes" xsi:type="Subject"
+ xmlns="urn:mace:shibboleth:2.0:resolver" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ exportAttributes="foo bar"
+ noResultIsError=" "
+ xsi:schemaLocation="urn:mace:shibboleth:2.0:resolver http://shibboleth.net/schema/idp/shibboleth-attribute-resolver.xsd" />
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list