Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
org.zapodot:embedded-ldap-junit
Advanced tools
Library that provides a JUnit rule for setting up an in-memory LDAP server by using the glorious Unboundid LDAP SDK
A JUnit Rule for running an embedded LDAP server in your JUnit test based on the wonderful UnboundID LDAP SDK. Inspired by the Embedded Database JUnit Rule.
This library is distributed through the Sonatype OSS repo and should thus be widely available. Java 8 or higher is required. It has proven pretty useful for several users and should be considered safe for running tests for all kinds of LDAP integrating code.
See releases
<dependency>
<groupId>org.zapodot</groupId>
<artifactId>embedded-ldap-junit</artifactId>
<version>0.8.3</version>
</dependency>
libraryDependencies += "org.zapodot" % "embedded-ldap-junit" % "0.8.3"
import com.unboundid.ldap.sdk.LDAPInterface;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
...
@Rule
public EmbeddedLdapRule embeddedLdapRule = EmbeddedLdapRuleBuilder
.newInstance()
.usingDomainDsn("dc=example,dc=com")
.importingLdifs("example.ldif")
.build();
@Test
public void testLdapInteface() throws Exception {
// Test using the UnboundID LDAP SDK directly
final LdapInterface ldapConnection = embeddedLdapRule.ldapConnection();
final SearchResult searchResult = ldapConnection.search(DOMAIN_DSN, SearchScope.SUB, "(objectClass=person)");
assertEquals(1, searchResult.getEntryCount());
}
@Test
public void testUnsharedLdapConnection() throws Exception {
// Test using the UnboundID LDAP SDK directly by using the UnboundID LDAPConnection type
final LDAPConnection ldapConnection = embeddedLdapRule.unsharedLdapConnection();
final SearchResult searchResult = ldapConnection.search(DOMAIN_DSN, SearchScope.SUB, "(objectClass=person)");
assertEquals(1, searchResult.getEntryCount());
}
@Test
public void testDirContext() throws Exception {
// Test using the good ol' JDNI-LDAP integration
final DirContext dirContext = embeddedLdapRule.dirContext();
final SearchControls searchControls = new SearchControls();
searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
final NamingEnumeration<javax.naming.directory.SearchResult> resultNamingEnumeration =
dirContext.search(DOMAIN_DSN, "(objectClass=person)", searchControls);
assertEquals(1, Iterators.size(Iterators.forEnumeration(resultNamingEnumeration)));
}
@Test
public void testContext() throws Exception {
// Another test using the good ol' JDNI-LDAP integration, this time with the Context interface
final Context context = embeddedLdapRule.context();
final Object user = context.lookup("cn=John Doe,ou=people,dc=example,dc=com");
assertNotNull(user);
}
FAQs
Library that provides a JUnit rule for setting up an in-memory LDAP server by using the glorious Unboundid LDAP SDK
We found that org.zapodot:embedded-ldap-junit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.