Skip to content

Instantly share code, notes, and snippets.

@edgarmueller
Created May 10, 2017 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgarmueller/31dcdb0303e7d4324852481c8dd6d97b to your computer and use it in GitHub Desktop.
Save edgarmueller/31dcdb0303e7d4324852481c8dd6d97b to your computer and use it in GitHub Desktop.
EMFStore LDAP Example Test
public class LDAPUserVerifierTest extends ESTestWithMockServer {
@BeforeClass
public static void beforeClass() {
startEMFStore();
}
@AfterClass
public static void afterClass() {
stopEMFStore();
}
@Test
public void ldapVerifyUser() throws AccessControlException {
final ESOrgUnitRepositoryImpl repository = new ESOrgUnitRepositoryImpl(getServerMock().getServerSpace());
final ESOrgUnitProvider orgUnitProvider = new ESOrgUnitProviderImpl(repository);
final LDAPUserVerifier ldapVerifier = new LDAPUserVerifier(
orgUnitProvider,
"ldap://ldap.forumsys.com", // url
"dc=example,dc=com", // base
"uid", // searchdn
"cn=read-only-admin,dc=example,dc=com", // authuser
"password"); // authpass
assertTrue(ldapVerifier.verifyPassword("gauss", "password"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment