diff options
author | Jani Averbach <jaa@jaa.iki.fi> | 2014-03-31 00:53:21 +0300 |
---|---|---|
committer | Jani Averbach <jaa@jaa.iki.fi> | 2014-03-31 00:53:21 +0300 |
commit | a74d6756c031929a69388b7390b34108ed13ea37 (patch) | |
tree | 5069ce7768d0df796e4412f4bdea3968da2ff575 /src | |
parent | eb9318ef571fee34c6b94a4621f7a23d76e19125 (diff) | |
download | gitblit-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.java | 13 |
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; |