[java-identity-provider COMMIT] in /trunk/idp-authn-impl/src: main/java/net/shibboleth/idp/authn/impl/InexactPrincipa...
noreply at shibboleth.net
noreply at shibboleth.net
Fri Aug 16 10:50:26 EDT 2013
Author: rdw
Date: Fri Aug 16 10:50:25 2013
New Revision: 4699
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4699&view=rev
Log:
Test for R4698
Modified:
trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactory.java
trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactoryTest.java
Modified: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactory.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactory.java?rev=4699&r1=4698&r2=4699&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactory.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactory.java Fri Aug 16 10:50:25 2013
@@ -18,6 +18,7 @@
package net.shibboleth.idp.authn.impl;
import java.security.Principal;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -75,11 +76,11 @@
*
* @param rules matching rules
*/
- public void setMatchingRules(@Nonnull @NonnullElements final Map<String,Set<String>> rules) {
+ public void setMatchingRules(@Nonnull @NonnullElements final Map<String,Collection<String>> rules) {
Constraint.isNotNull(rules, "Map cannot be null");
matchingRules.clear();
- for (Map.Entry<String,Set<String>> e : rules.entrySet()) {
+ for (Map.Entry<String,Collection<String>> e : rules.entrySet()) {
if (!Strings.isNullOrEmpty(e.getKey()) && e.getValue() != null) {
matchingRules.putAll(e.getKey(), new HashSet(Collections2.filter(e.getValue(), Predicates.notNull())));
}
Modified: trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactoryTest.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactoryTest.java?rev=4699&r1=4698&r2=4699&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactoryTest.java (original)
+++ trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InexactPrincipalEvalPredicateFactoryTest.java Fri Aug 16 10:50:25 2013
@@ -83,6 +83,17 @@
Assert.assertFalse(factory.getPredicate(baz).apply(sample));
}
+ @Test public void testMultiplePrincipalMatchMap() {
+ AuthenticationResult sample = new AuthenticationResult("test", new Subject());
+ sample.getSubject().getPrincipals().add(new UsernamePrincipal("bar"));
+ sample.getSubject().getPrincipals().add(new UsernamePrincipal("baz"));
+ InexactPrincipalEvalPredicateFactory mapFactory = new InexactPrincipalEvalPredicateFactory();
+ mapFactory.setMatchingRules(factory.getMatchingRules().asMap());
+ Assert.assertTrue(mapFactory.getPredicate(foo).apply(sample));
+ Assert.assertFalse(mapFactory.getPredicate(bar).apply(sample));
+ Assert.assertFalse(mapFactory.getPredicate(baz).apply(sample));
+ }
+
@Test public void testMultiplePrincipalNoMatch() {
AuthenticationResult sample = new AuthenticationResult("test", new Subject());
sample.getSubject().getPrincipals().add(new UsernamePrincipal("foo"));
More information about the commits
mailing list