summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJani Averbach <jaa@jaa.iki.fi>2014-03-31 00:53:21 +0300
committerJani Averbach <jaa@jaa.iki.fi>2014-03-31 00:53:21 +0300
commita74d6756c031929a69388b7390b34108ed13ea37 (patch)
tree5069ce7768d0df796e4412f4bdea3968da2ff575 /src
parenteb9318ef571fee34c6b94a4621f7a23d76e19125 (diff)
downloadgitblit-a74d6756c031929a69388b7390b34108ed13ea37.tar.gz
gitblit-a74d6756c031929a69388b7390b34108ed13ea37.zip
LDAP: Added test for binding without special account (e.g. userbased
bind)
Diffstat (limited to 'src')
-rw-r--r--src/test/java/com/gitblit/tests/LdapAuthenticationTest.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java b/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
index b037754c..21063d58 100644
--- a/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
@@ -258,6 +258,19 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
assertNull(userThreeModel.getTeam("git_admins"));
assertTrue(userThreeModel.canAdmin);
}
+
+ @Test
+ public void testBindWithUser() {
+ settings.put(Keys.realm.ldap.bindpattern, "CN=${username},OU=US,OU=Users,OU=UserControl,OU=MyOrganization,DC=MyDomain");
+ settings.put(Keys.realm.ldap.username, "");
+ settings.put(Keys.realm.ldap.password, "");
+
+ UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray());
+ assertNotNull(userOneModel);
+
+ UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray());
+ assertNull(userOneModelFailedAuth);
+ }
private int countLdapUsersInUserManager() {
int ldapAccountCount = 0;