LdapAuth3: factor out configuration class

including the renaming of some configuration properties

Change-Id: I0268c88a0bb7a3255debf045beab3faa71e9dce2
diff --git a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java
index 30d585b..6f3edc4 100644
--- a/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java
+++ b/full/src/test/java/de/ids_mannheim/korap/authentication/LdapAuth3Test.java
@@ -138,4 +138,11 @@
         assertEquals("peter@example.org", LdapAuth3.getEmail("testuser2", TEST_LDAPS_CONF));
         assertEquals(null, LdapAuth3.getEmail("non-exsting", TEST_LDAPS_CONF));
     }
+
+    @Test
+    public void canLoadLdapConfig() {
+        LDAPConfig ldapConfig = new LDAPConfig(TEST_LDAPS_CONF);
+        assertEquals(3269, ldapConfig.port);
+        assertEquals("localhost", ldapConfig.host);
+    }
 }
diff --git a/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java b/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
index e5e5cb7..7783274 100644
--- a/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/server/EmbeddedLdapServerTest.java
@@ -7,6 +7,9 @@
 import org.junit.AfterClass;
 import org.junit.Test;
 
+import java.net.UnknownHostException;
+import java.security.GeneralSecurityException;
+
 import static de.ids_mannheim.korap.authentication.LdapAuth3.LDAP_AUTH_RNAUTH;
 import static de.ids_mannheim.korap.authentication.LdapAuth3.LDAP_AUTH_ROK;
 import static org.junit.Assert.assertEquals;
@@ -44,12 +47,14 @@
     }
 
     @Test
-    public void gettingMailForUser() throws LDAPException {
+    public void gettingMailForUser() throws LDAPException, UnknownHostException, GeneralSecurityException {
+        EmbeddedLdapServer.startIfNotRunning(EMBEDDED_LDAP_DEFAULT_CONF);
         assertEquals("user2@example.com", LdapAuth3.getEmail("user2", EMBEDDED_LDAP_DEFAULT_CONF));
     }
 
     @Test
-    public void gettingMailForUnknownUserIsNull() throws LDAPException {
+    public void gettingMailForUnknownUserIsNull() throws LDAPException, UnknownHostException, GeneralSecurityException {
+        EmbeddedLdapServer.startIfNotRunning(EMBEDDED_LDAP_DEFAULT_CONF);
         assertEquals(null, LdapAuth3.getEmail("user1000", EMBEDDED_LDAP_DEFAULT_CONF));
     }
 }
diff --git a/full/src/test/resources/test-ldap.conf b/full/src/test/resources/test-ldap.conf
index aa27f14..eb97168 100644
--- a/full/src/test/resources/test-ldap.conf
+++ b/full/src/test/resources/test-ldap.conf
@@ -1,6 +1,6 @@
-ldapHost=localhost
-ldapPort=3268
-ldapBase=dc=example,dc=com
+host=localhost
+port=3268
+searchBase=dc=example,dc=com
 sLoginDN=cn=admin,dc=example,dc=com
 pwd=adminpassword
-ldapFilter=(&(|(&(|(uid=${username})(mail=${username}))(userPassword=${password}))(&(idsC2Profile=${username})(idsC2Password=${password})))(&(idsC2=TRUE)(|(idsStatus=1)(|(idsStatus=0)(!(idsStatus=*))))))
+searchFilter=(&(|(&(|(uid=${login})(mail=${login}))(userPassword=${password}))(&(idsC2Profile=${login})(idsC2Password=${password})))(&(idsC2=TRUE)(|(idsStatus=1)(|(idsStatus=0)(!(idsStatus=*))))))
diff --git a/full/src/test/resources/test-ldaps-with-truststore.conf b/full/src/test/resources/test-ldaps-with-truststore.conf
index d785301..0e58b65 100644
--- a/full/src/test/resources/test-ldaps-with-truststore.conf
+++ b/full/src/test/resources/test-ldaps-with-truststore.conf
@@ -1,8 +1,8 @@
-ldapHost=localhost
-ldapPort=3269
-ldapS=true
+host=localhost
+port=3269
+useSSL=true
 trustStore=src/test/resources/truststore.jks
-ldapBase=dc=example,dc=com
+searchBase=dc=example,dc=com
 sLoginDN=cn=admin,dc=example,dc=com
 pwd=adminpassword
-ldapFilter=(&(|(&(|(uid=${username})(mail=${username}))(userPassword=${password}))(&(idsC2Profile=${username})(idsC2Password=${password})))(&(idsC2=TRUE)(|(idsStatus=1)(|(idsStatus=0)(!(idsStatus=*))))))
+searchFilter=(&(|(&(|(uid=${login})(mail=${login}))(userPassword=${password}))(&(idsC2Profile=${login})(idsC2Password=${password})))(&(idsC2=TRUE)(|(idsStatus=1)(|(idsStatus=0)(!(idsStatus=*))))))
diff --git a/full/src/test/resources/test-ldaps.conf b/full/src/test/resources/test-ldaps.conf
index 732076f..2189432 100644
--- a/full/src/test/resources/test-ldaps.conf
+++ b/full/src/test/resources/test-ldaps.conf
@@ -1,8 +1,8 @@
-ldapHost=localhost
-ldapPort=3269
-ldapS=true
+host=localhost
+port=3269
+useSSL=true
 trustStore=
-ldapBase=dc=example,dc=com
+searchBase=dc=example,dc=com
 sLoginDN=cn=admin,dc=example,dc=com
 pwd=adminpassword
-ldapFilter=(&(|(&(|(uid=${username})(mail=${username}))(userPassword=${password}))(&(idsC2Profile=${username})(idsC2Password=${password})))(&(idsC2=TRUE)(|(idsStatus=1)(|(idsStatus=0)(!(idsStatus=*))))))
+searchFilter=(&(|(&(|(uid=${login})(mail=${login}))(userPassword=${password}))(&(idsC2Profile=${login})(idsC2Password=${password})))(&(idsC2=TRUE)(|(idsStatus=1)(|(idsStatus=0)(!(idsStatus=*))))))