@Test public void testCustomQueryNegative() { testCase = defaultBuilder() .baseDN("ou=People,dc=example,dc=com") .customQuery( String.format("(&(objectClass=person)(uid=%s))", USER1.getId())) .build(); testCase.assertAuthenticateFails(USER2.credentialsWithDn()); testCase.assertAuthenticateFails(USER2.credentialsWithId()); }
@Test public void testCustomQueryWithGroupsNegative() { testCase = defaultBuilder() .baseDN("dc=example,dc=com") .userDNPatterns( "cn=%s,ou=People,dc=example,dc=com", "uid=%s,ou=People,dc=example,dc=com") .customQuery( String.format("(&(objectClass=groupOfNames)(|(cn=%s)(cn=%s)))", GROUP1_NAME, GROUP2_NAME)) .build(); testCase.assertAuthenticateFails(USER3.credentialsWithDn()); testCase.assertAuthenticateFails(USER3.credentialsWithId()); }
@Test public void testCustomQueryPositive() { testCase = defaultBuilder() .baseDN("ou=People,dc=example,dc=com") .userDNPatterns( "cn=%s,ou=People,dc=example,dc=com", "uid=%s,ou=People,dc=example,dc=com") .groupDNPatterns("cn=%s,ou=People,dc=example,dc=com") .customQuery( String.format("(&(objectClass=person)(|(uid=%s)(uid=%s)))", USER1.getId(), USER4.getId())) .build(); testCase.assertAuthenticatePasses(USER1.credentialsWithId()); testCase.assertAuthenticatePasses(USER1.credentialsWithDn()); testCase.assertAuthenticatePasses(USER4.credentialsWithId()); testCase.assertAuthenticatePasses(USER4.credentialsWithDn()); }
public void testCustomQueryWithGroupsPositive() { testCase = defaultBuilder() .baseDN("dc=example,dc=com") .userDNPatterns( "cn=%s,ou=People,dc=example,dc=com", .baseDN("dc=example,dc=com") .userDNPatterns( "cn=%s,ou=People,dc=example,dc=com", .baseDN("dc=example,dc=com") .userDNPatterns( "cn=%s,ou=People,dc=example,dc=com",
@Test public void testUserBindNegativeWithDNOldConfig() { testCase = defaultBuilder() .baseDN("ou=People,dc=example,dc=com") .build(); testCase.assertAuthenticateFailsUsingWrongPassword(USER1.credentialsWithDn()); testCase.assertAuthenticateFails( USER1.getDn(), USER2.getPassword()); testCase.assertAuthenticateFailsUsingWrongPassword(USER2.credentialsWithDn()); }
@Test public void testUserBindPositiveWithDNBlankOldConfig() throws Exception { testCase = defaultBuilder() .baseDN("") .build(); testCase.assertAuthenticatePasses(USER1.credentialsWithDn()); testCase.assertAuthenticatePasses(USER2.credentialsWithDn()); }
@Test public void testUserBindNegativeWithShortnameOldConfig() { testCase = defaultBuilder() .baseDN("ou=People,dc=example,dc=com") .build(); testCase.assertAuthenticateFailsUsingWrongPassword(USER1.credentialsWithId()); testCase.assertAuthenticateFails( USER1.getDn(), USER2.getPassword()); testCase.assertAuthenticateFailsUsingWrongPassword(USER2.credentialsWithId()); }
@Test public void testUserBindPositiveWithDNWrongOldConfig() { testCase = defaultBuilder() .baseDN("ou=DummyPeople,dc=example,dc=com") .build(); testCase.assertAuthenticatePasses(USER1.credentialsWithDn()); testCase.assertAuthenticatePasses(USER2.credentialsWithDn()); }
@Test public void testUserBindPositiveWithDNOldConfig() { testCase = defaultBuilder() .baseDN("ou=People,dc=example,dc=com") .build(); testCase.assertAuthenticatePasses(USER1.credentialsWithDn()); testCase.assertAuthenticatePasses(USER2.credentialsWithDn()); }
@Test public void testUserBindPositiveWithShortnameOldConfig() { testCase = defaultBuilder() .baseDN("ou=People,dc=example,dc=com") .build(); testCase.assertAuthenticatePasses(USER1.credentialsWithId()); testCase.assertAuthenticatePasses(USER2.credentialsWithId()); }