[java-identity-provider] branch master updated: IDP-1619 - Deprecate terms from classes and configuration
Scott Cantor
cantor.2 at osu.edu
Wed Jun 10 16:56:11 UTC 2020
This is an automated email from the git hooks/post-receive script.
scantor 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=65e52ee4325daf3eee03feec4f2c4501c74a4e80
The following commit(s) were added to refs/heads/master by this push:
new 65e52ee43 IDP-1619 - Deprecate terms from classes and configuration
65e52ee43 is described below
commit 65e52ee4325daf3eee03feec4f2c4501c74a4e80
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jun 10 12:56:09 2020 -0400
IDP-1619 - Deprecate terms from classes and configuration
https://issues.shibboleth.net/jira/browse/IDP-1619
Update prompt/ignore configuration for attribute consent.
---
.../conf/intercept/consent-intercept-config.xml | 10 +++---
.../flows/intercept/attribute-release-beans.xml | 13 ++++++--
.../idp/consent/logic/impl/AttributePredicate.java | 36 +++++++++++-----------
.../consent/logic/impl/AttributePredicateTest.java | 30 +++++++++---------
4 files changed, 49 insertions(+), 40 deletions(-)
diff --git a/idp-conf/src/main/resources/conf/intercept/consent-intercept-config.xml b/idp-conf/src/main/resources/conf/intercept/consent-intercept-config.xml
index 6e899e632..26172a23e 100644
--- a/idp-conf/src/main/resources/conf/intercept/consent-intercept-config.xml
+++ b/idp-conf/src/main/resources/conf/intercept/consent-intercept-config.xml
@@ -43,19 +43,19 @@
<!-- Attribute Release configuration -->
<!--
- Attribute release whitelist, blacklist, and match expressions to determine
+ Attribute release control sets and match expressions to determine
whether consent should be obtained for an attribute based on the attribute ID.
-->
- <util:list id="shibboleth.consent.attribute-release.WhitelistedAttributeIDs">
+ <util:set id="shibboleth.consent.attribute-release.PromptedAttributeIDs">
<!--
<value>mail</value>
-->
- </util:list>
+ </util:set>
- <util:list id="shibboleth.consent.attribute-release.BlacklistedAttributeIDs">
+ <util:set id="shibboleth.consent.attribute-release.IgnoredAttributeIDs">
<value>samlPairwiseID</value>
- </util:list>
+ </util:set>
<!--
<bean id="shibboleth.consent.attribute-release.MatchExpression" class="java.util.regex.Pattern" factory-method="compile"
diff --git a/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml b/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml
index 555a39a86..aac7ef2d3 100644
--- a/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml
+++ b/idp-conf/src/main/resources/system/flows/intercept/attribute-release-beans.xml
@@ -16,6 +16,15 @@
<import resource="../../../conf/intercept/consent-intercept-config.xml" />
+ <bean class="net.shibboleth.ext.spring.util.DeprecatedBeanDetector" c:_1="consent-intercept-config.xml">
+ <constructor-arg index="0">
+ <map>
+ <entry key="shibboleth.consent.attribute-release.WhitelistedAttributeIDs" value="shibboleth.consent.attribute-release.PromptedAttributeIDs" />
+ <entry key="shibboleth.consent.attribute-release.BlacklistedAttributeIDs" value="shibboleth.consent.attribute-release.IgnoredAttributeIDs" />
+ </map>
+ </constructor-arg>
+ </bean>
+
<bean id="AttributeReleaseConsentFunction"
class="net.shibboleth.idp.consent.logic.impl.AttributeReleaseConsentFunction" scope="prototype" />
@@ -32,8 +41,8 @@
<!-- Predicate used to determine if consent should be obtained for an attribute. -->
<bean id="AttributePredicate"
class="net.shibboleth.idp.consent.logic.impl.AttributePredicate"
- p:whitelistedAttributeIds-ref="shibboleth.consent.attribute-release.WhitelistedAttributeIDs"
- p:blacklistedAttributeIds-ref="shibboleth.consent.attribute-release.BlacklistedAttributeIDs"
+ p:promptedAttributeIds="#{getObject('shibboleth.consent.attribute-release.PromptedAttributeIDs') ?: getObject('shibboleth.consent.attribute-release.WhitelistedAttributeIDs')}"
+ p:ignoredAttributeIds="#{getObject('shibboleth.consent.attribute-release.IgnoredAttributeIDs') ?: getObject('shibboleth.consent.attribute-release.BlacklistedAttributeIDs')}"
p:attributeIdMatchExpression="#{getObject('shibboleth.consent.attribute-release.MatchExpression')}" />
<!-- Functions to return a storage key consisting of the user identifier. -->
diff --git a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java
index ab0bf6c2e..ac0dff684 100644
--- a/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java
+++ b/idp-consent-impl/src/main/java/net/shibboleth/idp/consent/logic/impl/AttributePredicate.java
@@ -40,41 +40,41 @@ import net.shibboleth.utilities.java.support.primitive.StringSupport;
*/
public class AttributePredicate extends AbstractInitializableComponent implements Predicate<IdPAttribute> {
- /** Whitelist of attribute IDs to allow. */
- @Nonnull @NonnullElements private Set<String> whitelistedAttributeIds;
+ /** Set of attribute IDs for which to prompt for consent. */
+ @Nonnull @NonnullElements private Set<String> promptedAttributeIds;
- /** Blacklist of attribute IDs to deny. */
- @Nonnull @NonnullElements private Set<String> blacklistedAttributeIds;
+ /** Set of attribute IDs to ignore for consent. */
+ @Nonnull @NonnullElements private Set<String> ignoredAttributeIds;
/** Regular expression to apply for acceptance testing. */
@Nullable private Pattern matchExpression;
/** Constructor. */
public AttributePredicate() {
- whitelistedAttributeIds = Collections.emptySet();
- blacklistedAttributeIds = Collections.emptySet();
+ promptedAttributeIds = Collections.emptySet();
+ ignoredAttributeIds = Collections.emptySet();
}
/**
- * Set the whitelisted attribute IDs.
+ * Set the attribute IDs for which to prompt for consent.
*
- * @param whitelist whitelisted attribute IDs
+ * @param prompted prompted attribute IDs
*/
- public void setWhitelistedAttributeIds(@Nonnull @NonnullElements final Collection<String> whitelist) {
+ public void setPromptedAttributeIds(@Nonnull @NonnullElements final Collection<String> prompted) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- whitelistedAttributeIds = new HashSet<>(StringSupport.normalizeStringCollection(whitelist));
+ promptedAttributeIds = new HashSet<>(StringSupport.normalizeStringCollection(prompted));
}
/**
- * Set the blacklisted attribute IDs.
+ * Set the attribute IDs to ignore for consent.
*
- * @param blacklist blacklisted attribute IDs
+ * @param ignored ignored attribute IDs
*/
- public void setBlacklistedAttributeIds(@Nonnull @NonnullElements final Collection<String> blacklist) {
+ public void setIgnoredAttributeIds(@Nonnull @NonnullElements final Collection<String> ignored) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
- blacklistedAttributeIds = new HashSet<>(StringSupport.normalizeStringCollection(blacklist));
+ ignoredAttributeIds = new HashSet<>(StringSupport.normalizeStringCollection(ignored));
}
/**
@@ -101,16 +101,16 @@ public class AttributePredicate extends AbstractInitializableComponent implement
final String attributeId = input.getId();
- if (!whitelistedAttributeIds.isEmpty() && !whitelistedAttributeIds.contains(attributeId)) {
- // Not in whitelist. Only accept if a regexp applies.
+ if (!promptedAttributeIds.isEmpty() && !promptedAttributeIds.contains(attributeId)) {
+ // Not in prompted set. Only prompt if a regexp applies.
if (matchExpression == null) {
return false;
}
return matchExpression.matcher(attributeId).matches();
}
- // In whitelist (or none). Check blacklist, and if necessary a regexp.
- return !blacklistedAttributeIds.contains(attributeId)
+ // In prompted set (or none). Check unprompted set, and if necessary a regexp.
+ return !ignoredAttributeIds.contains(attributeId)
&& (matchExpression == null || matchExpression.matcher(attributeId).matches());
}
diff --git a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributePredicateTest.java b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributePredicateTest.java
index 3630ccc5a..5ff7f92e4 100644
--- a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributePredicateTest.java
+++ b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/logic/impl/AttributePredicateTest.java
@@ -45,13 +45,13 @@ public class AttributePredicateTest {
}
@Test public void testWhitelist() {
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
Assert.assertTrue(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
}
@Test public void testBlacklist() {
- p.setBlacklistedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute1"));
Assert.assertFalse(p.test(attribute1));
Assert.assertTrue(p.test(attribute2));
}
@@ -63,18 +63,18 @@ public class AttributePredicateTest {
}
@Test public void testWhitelistAndBlacklist() {
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
- p.setBlacklistedAttributeIds(Arrays.asList("attribute1"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute1"));
Assert.assertFalse(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
- p.setBlacklistedAttributeIds(Arrays.asList("attribute2"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute2"));
Assert.assertTrue(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
}
@Test public void testWhitelistAndMatchExpression() {
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
p.setAttributeIdMatchExpression(Pattern.compile(".*1"));
Assert.assertTrue(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
@@ -85,7 +85,7 @@ public class AttributePredicateTest {
}
@Test public void testBlacklistAndMatchExpression() {
- p.setBlacklistedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute1"));
p.setAttributeIdMatchExpression(Pattern.compile(".*1"));
Assert.assertFalse(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
@@ -96,26 +96,26 @@ public class AttributePredicateTest {
}
@Test public void testWhitelistAndBlacklistAndMatchExpression() {
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
- p.setBlacklistedAttributeIds(Arrays.asList("attribute1"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute1"));
p.setAttributeIdMatchExpression(Pattern.compile(".*1"));
Assert.assertFalse(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
- p.setBlacklistedAttributeIds(Arrays.asList("attribute2"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute2"));
p.setAttributeIdMatchExpression(Pattern.compile(".*1"));
Assert.assertTrue(p.test(attribute1));
Assert.assertFalse(p.test(attribute2));
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
- p.setBlacklistedAttributeIds(Arrays.asList("attribute1"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute1"));
p.setAttributeIdMatchExpression(Pattern.compile(".*2"));
Assert.assertFalse(p.test(attribute1));
Assert.assertTrue(p.test(attribute2));
- p.setWhitelistedAttributeIds(Arrays.asList("attribute1"));
- p.setBlacklistedAttributeIds(Arrays.asList("attribute2"));
+ p.setPromptedAttributeIds(Arrays.asList("attribute1"));
+ p.setIgnoredAttributeIds(Arrays.asList("attribute2"));
p.setAttributeIdMatchExpression(Pattern.compile(".*2"));
Assert.assertFalse(p.test(attribute1));
Assert.assertTrue(p.test(attribute2));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list