DomainFilter { protected static boolean doesEmailDomainMatchProvider(IdentityProvider provider, String domain, boolean explicit) { List<String> domainList = getEmailDomain(provider); List<String> wildcardList; wildcardList = domainList; if (!explicit) { if (UAA.equals(provider.getOriginKey())) { wildcardList = domainList == null ? Arrays.asList("*.*", "*.*.*", "*.*.*.*") : domainList; } } if (wildcardList==null) { return false; } else { Set<Pattern> patterns = UaaStringUtils.constructWildcards(wildcardList); return UaaStringUtils.matches(patterns, domain); } }  static List<IdentityProvider> filter(List<IdentityProvider> activeProviders, ClientDetails client, String email); static List<IdentityProvider> filter(List<IdentityProvider> activeProviders, ClientDetails client, String email, boolean useUaaFallback); static List<IdentityProvider> getIdpsForEmailDomain(List<IdentityProvider> activeProviders, String email);  }
@Test public void test_domain_filter_match() { assertFalse(filter.doesEmailDomainMatchProvider(uaaProvider, "test.org", true)); assertTrue(filter.doesEmailDomainMatchProvider(uaaProvider, "test.org", false)); assertFalse(filter.doesEmailDomainMatchProvider(ldapProvider, "test.org", false)); assertFalse(filter.doesEmailDomainMatchProvider(ldapProvider, "test.org", true)); assertFalse(filter.doesEmailDomainMatchProvider(samlProvider1, "test.org", false)); assertFalse(filter.doesEmailDomainMatchProvider(samlProvider1, "test.org", true)); }