Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.BindException;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -81,6 +82,8 @@
public abstract class AbstractServer {

public static final String EXAMPLE_DN = "dc=example,dc=com";
private static final String TLS_KEYSTORE_RESOURCE = "org/apache/jackrabbit/oak/security/authentication/ldap/apacheds-server.p12";
private static final String TLS_KEYSTORE_PASSWORD = "secret";

private static final Logger LOG = LoggerFactory.getLogger(AbstractServer.class);
private static final List<LdifEntry> EMPTY_LIST = Collections.unmodifiableList(new ArrayList<LdifEntry>(0));
Expand Down Expand Up @@ -230,7 +233,12 @@ private void startLdapServer() throws Exception {
protected void setupLdapServer() throws Exception {
TcpTransport transport = new TcpTransport((port));
transport.enableSSL(enableSSL);

URL keyStoreUrl = AbstractServer.class.getClassLoader().getResource(TLS_KEYSTORE_RESOURCE);
if (keyStoreUrl == null) {
throw new IOException("Unable to locate test TLS keystore: " + TLS_KEYSTORE_RESOURCE);
}
ldapServer.setKeystoreFile(new File(keyStoreUrl.toURI()).getAbsolutePath());
ldapServer.setCertificatePassword(TLS_KEYSTORE_PASSWORD);
Comment thread
mbaedke marked this conversation as resolved.
ldapServer.setTransports(transport);
ldapServer.setDirectoryService(directoryService);
ldapServer.addExtendedOperationHandler(new StartTlsHandler());
Expand Down
Binary file not shown.
Loading