Formatted project
Change-Id: I6993ddfab02e06541b4138040280a4777c719562
diff --git a/full/src/main/java/de/ids_mannheim/korap/server/EmbeddedLdapServer.java b/full/src/main/java/de/ids_mannheim/korap/server/EmbeddedLdapServer.java
index 88dfe2e..4b1c17e 100644
--- a/full/src/main/java/de/ids_mannheim/korap/server/EmbeddedLdapServer.java
+++ b/full/src/main/java/de/ids_mannheim/korap/server/EmbeddedLdapServer.java
@@ -15,36 +15,56 @@
public class EmbeddedLdapServer {
static InMemoryDirectoryServer server;
- public static void startIfNotRunning(LDAPConfig ldapConfig) throws LDAPException, GeneralSecurityException, UnknownHostException {
+ public static void startIfNotRunning (LDAPConfig ldapConfig)
+ throws LDAPException, GeneralSecurityException,
+ UnknownHostException {
if (server != null) {
return;
}
- InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(ldapConfig.searchBase);
+ InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(
+ ldapConfig.searchBase);
final MessageDigest sha1Digest = CryptoHelper.getMessageDigest("SHA1");
- final MessageDigest sha256Digest = CryptoHelper.getMessageDigest("SHA-256");
- config.setPasswordEncoders(new ClearInMemoryPasswordEncoder("{CLEAR}", null), new ClearInMemoryPasswordEncoder("{HEX}", HexPasswordEncoderOutputFormatter.getLowercaseInstance()), new ClearInMemoryPasswordEncoder("{BASE64}", Base64PasswordEncoderOutputFormatter.getInstance()), new UnsaltedMessageDigestInMemoryPasswordEncoder("{SHA}", Base64PasswordEncoderOutputFormatter.getInstance(), sha1Digest), new UnsaltedMessageDigestInMemoryPasswordEncoder("{SHA256}", Base64PasswordEncoderOutputFormatter.getInstance(), sha256Digest));
- config.addAdditionalBindCredentials(ldapConfig.sLoginDN, ldapConfig.sPwd);
+ final MessageDigest sha256Digest = CryptoHelper
+ .getMessageDigest("SHA-256");
+ config.setPasswordEncoders(
+ new ClearInMemoryPasswordEncoder("{CLEAR}", null),
+ new ClearInMemoryPasswordEncoder("{HEX}",
+ HexPasswordEncoderOutputFormatter
+ .getLowercaseInstance()),
+ new ClearInMemoryPasswordEncoder("{BASE64}",
+ Base64PasswordEncoderOutputFormatter.getInstance()),
+ new UnsaltedMessageDigestInMemoryPasswordEncoder("{SHA}",
+ Base64PasswordEncoderOutputFormatter.getInstance(),
+ sha1Digest),
+ new UnsaltedMessageDigestInMemoryPasswordEncoder("{SHA256}",
+ Base64PasswordEncoderOutputFormatter.getInstance(),
+ sha256Digest));
+ config.addAdditionalBindCredentials(ldapConfig.sLoginDN,
+ ldapConfig.sPwd);
config.setSchema(null);
final SSLUtil clientSslUtil = new SSLUtil(new TrustAllTrustManager());
- config.setListenerConfigs(InMemoryListenerConfig.createLDAPConfig("LDAP", // Listener name
- InetAddress.getByName("localhost"), // Listen address. (null = listen on all interfaces)
- ldapConfig.port, // Listen port (0 = automatically choose an available port)
- clientSslUtil.createSSLSocketFactory()));
+ config.setListenerConfigs(
+ InMemoryListenerConfig.createLDAPConfig("LDAP", // Listener name
+ InetAddress.getByName("localhost"), // Listen address. (null = listen on all interfaces)
+ ldapConfig.port, // Listen port (0 = automatically choose an available port)
+ clientSslUtil.createSSLSocketFactory()));
server = new InMemoryDirectoryServer(config);
server.importFromLDIF(true, ldapConfig.ldif);
server.startListening();
}
- public static void startIfNotRunning(String ldapConfigFilename) throws LDAPException, GeneralSecurityException, UnknownHostException {
+ public static void startIfNotRunning (String ldapConfigFilename)
+ throws LDAPException, GeneralSecurityException,
+ UnknownHostException {
LDAPConfig ldapConfig = new LDAPConfig(ldapConfigFilename);
startIfNotRunning(ldapConfig);
}
- public static void stop() {
+ public static void stop () {
if (server != null) {
server.shutDown(true);
server = null;