Rename ldap .properties to .conf
Change-Id: I8a6a49fa5c8ae1e03c9f699d22825a767b8041ea
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 dc9e3ae..9df6359 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
@@ -16,14 +16,14 @@
import java.security.GeneralSecurityException;
-import static de.ids_mannheim.korap.authentication.LdapAuth3.LDAP_AUTH_ROK;
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;
public class LdapAuth3Test {
- public static final String TEST_LDAP_PROPERTIES = "src/test/resources/test-ldap.properties";
- public static final String TEST_LDAPS_PROPERTIES = "src/test/resources/test-ldaps.properties";
- public static final String TEST_LDAPS_TS_PROPERTIES = "src/test/resources/test-ldaps-with-truststore.properties";
+ public static final String TEST_LDAP_CONF = "src/test/resources/test-ldap.conf";
+ public static final String TEST_LDAPS_CONF = "src/test/resources/test-ldaps.conf";
+ public static final String TEST_LDAPS_TS_CONF = "src/test/resources/test-ldaps-with-truststore.conf";
public static final String TEST_LDAP_USERS_LDIF = "src/test/resources/test-ldap-users.ldif";
private static final String keyStorePath = "src/test/resources/keystore.p12";
static InMemoryDirectoryServer server;
@@ -60,76 +60,76 @@
@Test
public void testLoginWithUsername() throws LDAPException {
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", "topsecret", TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", "topsecret", TEST_LDAP_CONF));
}
@Test
public void testLoginWithUid() throws LDAPException {
final byte[] passwordBytes = StaticUtils.getBytes("password");
String pw = Base64.encode(passwordBytes);
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", pw, TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", pw, TEST_LDAP_CONF));
}
@Test
public void testLoginWithEmail() throws LDAPException {
final byte[] passwordBytes = StaticUtils.getBytes("password");
String pw = Base64.encode(passwordBytes);
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser@example.com", pw, TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser@example.com", pw, TEST_LDAP_CONF));
}
@Test
public void testFailingLoginWithWrongEmail() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("notestuser@example.com", "topsecret", TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("notestuser@example.com", "topsecret", TEST_LDAP_CONF));
}
@Test
public void testFailingLoginWithEmailAndWrongPassword() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser@example.com", "wrongpw", TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser@example.com", "wrongpw", TEST_LDAP_CONF));
}
@Test
public void testFailingLoginWithUsernameAndWrongPassword() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "wrongpw", TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "wrongpw", TEST_LDAP_CONF));
}
@Test
public void testFailingLoginWithoutC2Attr() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("doe", "topsecret", TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("doe", "topsecret", TEST_LDAP_CONF));
}
@Test
public void testFailingLoginWithoutBadStatus() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("berserker", "topsecret", TEST_LDAP_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("berserker", "topsecret", TEST_LDAP_CONF));
}
@Test
public void testSecureLoginWithUsername() throws LDAPException {
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", "topsecret", TEST_LDAPS_PROPERTIES));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", "topsecret", TEST_LDAPS_CONF));
}
@Test
public void testSecureLoginWithTrustStoreAndUsername() throws LDAPException {
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", "topsecret", TEST_LDAPS_TS_PROPERTIES));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("testuser", "topsecret", TEST_LDAPS_TS_CONF));
}
@Test
public void testFailingSecureLoginWithTrustStoreAndUsernameAndWrongPW() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "topsecrets", TEST_LDAPS_TS_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "topsecrets", TEST_LDAPS_TS_CONF));
}
@Test
public void testPasswordWithAsterisk() throws LDAPException {
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("test", "top*ecret", TEST_LDAPS_PROPERTIES));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("test", "top*ecret", TEST_LDAPS_CONF));
}
@Test
public void testFailingEscapedPW() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "top*", TEST_LDAPS_TS_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "top*", TEST_LDAPS_TS_CONF));
}
@Test
public void testFailingIllegalPW() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "*", TEST_LDAPS_TS_PROPERTIES));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("testuser", "*", TEST_LDAPS_TS_CONF));
}
}
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 8a32281..8532839 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
@@ -13,6 +13,8 @@
public class EmbeddedLdapServerTest {
+ public static final String EMBEDDED_LDAP_DEFAULT_CONF = "src/main/resources/embedded-ldap-default.conf";
+
@AfterClass
public static void shutdownEmbeddedLdapServer() {
EmbeddedLdapServer.stop();
@@ -23,21 +25,21 @@
final byte[] passwordBytes = StaticUtils.getBytes("password");
String pw = Base64.encode(passwordBytes);
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("user", pw, "src/main/resources/ldap.properties"));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("user", pw, EMBEDDED_LDAP_DEFAULT_CONF));
}
@Test
public void usersWithUnencodedPasswowrdCanLogin() throws LDAPException {
- assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("user1", "password1", "src/main/resources/ldap.properties"));
+ assertEquals(LDAP_AUTH_ROK, LdapAuth3.login("user1", "password1", EMBEDDED_LDAP_DEFAULT_CONF));
}
@Test
public void asteriskPasswordsFail() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("user1", "*", "src/main/resources/ldap.properties"));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("user1", "*", EMBEDDED_LDAP_DEFAULT_CONF));
}
@Test
public void unauthorizedUsersAreNotAllowed() throws LDAPException {
- assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("yuser", "password", "src/main/resources/ldap.properties"));
+ assertEquals(LDAP_AUTH_RNAUTH, LdapAuth3.login("yuser", "password", EMBEDDED_LDAP_DEFAULT_CONF));
}
-}
\ No newline at end of file
+}
diff --git a/full/src/test/resources/test-ldap-users.ldif b/full/src/test/resources/test-ldap-users.ldif
index a965181..9a143f4 100644
--- a/full/src/test/resources/test-ldap-users.ldif
+++ b/full/src/test/resources/test-ldap-users.ldif
@@ -50,7 +50,7 @@
title: Herr
uid: doe
-dn: uid=berserker,ou=people,dc=example,dc=com
+dn: uid=berserk,ou=people,dc=example,dc=com
cn: Bernd Berserker
sn: berserker
givenName: Joe
@@ -64,3 +64,18 @@
idsC2News: TRUE
title: Herr
uid: berserk
+
+dn: uid=testuser2,ou=people,dc=example,dc=com
+cn: Peter Testuser
+sn: Testuser2
+givenName: Peter
+mail: peter@example.org
+userPassword: cGFzc3dvcmQ=
+displayName: Dr. Peter Testuser
+idsStatus: 0
+idsC2: TRUE
+idsC2Profile: testuser2
+idsC2Password: topsecret
+idsC2News: TRUE
+title: Herr
+uid: testuser2
diff --git a/full/src/test/resources/test-ldap.properties b/full/src/test/resources/test-ldap.conf
similarity index 100%
rename from full/src/test/resources/test-ldap.properties
rename to full/src/test/resources/test-ldap.conf
diff --git a/full/src/test/resources/test-ldaps-with-truststore.properties b/full/src/test/resources/test-ldaps-with-truststore.conf
similarity index 100%
rename from full/src/test/resources/test-ldaps-with-truststore.properties
rename to full/src/test/resources/test-ldaps-with-truststore.conf
diff --git a/full/src/test/resources/test-ldaps.properties b/full/src/test/resources/test-ldaps.conf
similarity index 100%
rename from full/src/test/resources/test-ldaps.properties
rename to full/src/test/resources/test-ldaps.conf