[java-identity-provider COMMIT] in /trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Jul 10 07:22:56 EDT 2013
Author: rdw
Date: Wed Jul 10 07:22:55 2013
New Revision: 4548
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4548&view=rev
Log:
IDP-287Add tristate handling the the logical matchers
Modified:
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/AndMatcher.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/NotMatcher.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/OrMatcher.java
trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/package-info.java
Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/AndMatcher.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/AndMatcher.java?rev=4548&r1=4547&r2=4548&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/AndMatcher.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/AndMatcher.java Wed Jul 10 07:22:55 2013
@@ -43,8 +43,8 @@
/**
* {@link Matcher} that implements the conjunction of matchers. That is, a given attribute value is considered to have
- * matched if, and only if, it is returned by every composed {@link Matcher}. The predicate is true if and only if all
- * composed {@link Matcher} returns true.
+ * matched if, and only if, it is returned by every composed {@link Matcher}. If any of the matchers fail then
+ * failure is returned.
*/
@ThreadSafe
public class AndMatcher extends AbstractComposedMatcher {
@@ -60,10 +60,11 @@
/**
- * A given attribute value is considered to have matched if, and only if, it is returned by every composed
+ * A given attribute value is considered to have matched if, and only if, it is returned by every composed.
+ * If any of the matchers fail then failure is returned
* {@link Matcher}. {@inheritDoc}
*/
- @Nonnull @NonnullElements public Set<AttributeValue> getMatchingValues(@Nonnull final Attribute attribute,
+ @Nullable @NonnullElements public Set<AttributeValue> getMatchingValues(@Nonnull final Attribute attribute,
@Nonnull final AttributeFilterContext filterContext) throws AttributeFilterException {
Constraint.isNotNull(attribute, "Attribute to be filtered can not be null");
Constraint.isNotNull(filterContext, "Attribute filter context can not be null");
@@ -76,9 +77,17 @@
Iterator<Matcher> matcherItr = currentMatchers.iterator();
- Set<AttributeValue> matchingValues = new HashSet(matcherItr.next().getMatchingValues(attribute, filterContext));
+ Set<AttributeValue> match = matcherItr.next().getMatchingValues(attribute, filterContext);
+ if (null == match) {
+ return null;
+ }
+ Set<AttributeValue> matchingValues = new HashSet(match);
while (matcherItr.hasNext()) {
- matchingValues.retainAll(matcherItr.next().getMatchingValues(attribute, filterContext));
+ match = matcherItr.next().getMatchingValues(attribute, filterContext);
+ if (null == match) {
+ return null;
+ }
+ matchingValues.retainAll(match);
if (matchingValues.isEmpty()) {
return Collections.emptySet();
}
@@ -119,7 +128,7 @@
/** {@inheritDoc} */
public String toString() {
- return Objects.toStringHelper(this).add("composedMatchers", getComposedMatchers()).toString();
+ return Objects.toStringHelper(this).add("Composed Matchers : ", getComposedMatchers()).toString();
}
}
Modified: trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/NotMatcher.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/NotMatcher.java?rev=4548&r1=4547&r2=4548&view=diff
==============================================================================
--- trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/NotMatcher.java (original)
+++ trunk/idp-attribute-filter-impl/src/main/java/net/shibboleth/idp/attribute/filter/impl/matcher/logic/NotMatcher.java Wed Jul 10 07:22:55 2013
@@ -22,6 +22,7 @@
import java.util.Set;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
import net.shibboleth.idp.attribute.Attribute;
@@ -29,6 +30,7 @@
import net.shibboleth.idp.attribute.filter.AttributeFilterContext;
import net.shibboleth.idp.attribute.filter.AttributeFilterException;
import net.shibboleth.idp.attribute.filter.Matcher;
[... 128 lines stripped ...]
More information about the commits
mailing list