summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorPaul Martin <paul@paulsputer.com>2015-10-25 16:12:32 +0000
committerPaul Martin <paul@paulsputer.com>2015-10-25 16:12:32 +0000
commit0d7c650b3b59d8a7bbc47135975f040c832e04c0 (patch)
tree4b27ccafc33a23e2f5decf60d664b3ec8ce03889 /src/test
parenta3a18a0ebfeb65777ad5bd065e26fa9c00e8100c (diff)
downloadgitblit-0d7c650b3b59d8a7bbc47135975f040c832e04c0.tar.gz
gitblit-0d7c650b3b59d8a7bbc47135975f040c832e04c0.zip
Log update for Fail2Ban usage
+ Adds standard logging for all authentication providers + Updates help page to use default GitBlit SSH port
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/gitblit/tests/AuthenticationManagerTest.java4
-rw-r--r--src/test/java/com/gitblit/tests/GitBlitTest.java2
-rw-r--r--src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java48
-rw-r--r--src/test/java/com/gitblit/tests/LdapAuthenticationTest.java12
-rw-r--r--src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java2
5 files changed, 34 insertions, 34 deletions
diff --git a/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java b/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java
index d6ca89c6..f8dc8885 100644
--- a/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java
+++ b/src/test/java/com/gitblit/tests/AuthenticationManagerTest.java
@@ -657,11 +657,11 @@ public class AuthenticationManagerTest extends GitblitUnitTest {
user.password = "password";
users.updateUserModel(user);
- assertNotNull(auth.authenticate(user.username, user.password.toCharArray()));
+ assertNotNull(auth.authenticate(user.username, user.password.toCharArray(), null));
user.disabled = true;
users.updateUserModel(user);
- assertNull(auth.authenticate(user.username, user.password.toCharArray()));
+ assertNull(auth.authenticate(user.username, user.password.toCharArray(), null));
users.deleteUserModel(user);
}
diff --git a/src/test/java/com/gitblit/tests/GitBlitTest.java b/src/test/java/com/gitblit/tests/GitBlitTest.java
index 9eaae7f8..e873ced2 100644
--- a/src/test/java/com/gitblit/tests/GitBlitTest.java
+++ b/src/test/java/com/gitblit/tests/GitBlitTest.java
@@ -176,7 +176,7 @@ public class GitBlitTest extends GitblitUnitTest {
@Test
public void testAuthentication() throws Exception {
- assertTrue(authentication().authenticate("admin", "admin".toCharArray()) != null);
+ assertTrue(authentication().authenticate("admin", "admin".toCharArray(), null) != null);
}
@Test
diff --git a/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java b/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java
index e2bb764e..26a49b24 100644
--- a/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/HtpasswdAuthenticationTest.java
@@ -200,43 +200,43 @@ public class HtpasswdAuthenticationTest extends GitblitUnitTest {
public void testAuthenticationManager()
{
MS.put(KEY_SUPPORT_PLAINTEXT_PWD, "true");
- UserModel user = auth.authenticate("user1", "pass1".toCharArray());
+ UserModel user = auth.authenticate("user1", "pass1".toCharArray(), null);
assertNotNull(user);
assertEquals("user1", user.username);
- user = auth.authenticate("user2", "pass2".toCharArray());
+ user = auth.authenticate("user2", "pass2".toCharArray(), null);
assertNotNull(user);
assertEquals("user2", user.username);
// Test different encryptions
- user = auth.authenticate("plain", "passWord".toCharArray());
+ user = auth.authenticate("plain", "passWord".toCharArray(), null);
assertNotNull(user);
assertEquals("plain", user.username);
MS.put(KEY_SUPPORT_PLAINTEXT_PWD, "false");
- user = auth.authenticate("crypt", "password".toCharArray());
+ user = auth.authenticate("crypt", "password".toCharArray(), null);
assertNotNull(user);
assertEquals("crypt", user.username);
- user = auth.authenticate("md5", "password".toCharArray());
+ user = auth.authenticate("md5", "password".toCharArray(), null);
assertNotNull(user);
assertEquals("md5", user.username);
- user = auth.authenticate("sha", "password".toCharArray());
+ user = auth.authenticate("sha", "password".toCharArray(), null);
assertNotNull(user);
assertEquals("sha", user.username);
// Test leading and trailing whitespace
- user = auth.authenticate("trailing", "whitespace".toCharArray());
+ user = auth.authenticate("trailing", "whitespace".toCharArray(), null);
assertNotNull(user);
assertEquals("trailing", user.username);
- user = auth.authenticate("tabbed", "frontAndBack".toCharArray());
+ user = auth.authenticate("tabbed", "frontAndBack".toCharArray(), null);
assertNotNull(user);
assertEquals("tabbed", user.username);
- user = auth.authenticate("leading", "whitespace".toCharArray());
+ user = auth.authenticate("leading", "whitespace".toCharArray(), null);
assertNotNull(user);
assertEquals("leading", user.username);
}
@@ -323,55 +323,55 @@ public class HtpasswdAuthenticationTest extends GitblitUnitTest {
{
UserModel user = null;
MS.put(KEY_SUPPORT_PLAINTEXT_PWD, "true");
- user = auth.authenticate("user1", "".toCharArray());
+ user = auth.authenticate("user1", "".toCharArray(), null);
assertNull("User 'user1' falsely authenticated.", user);
- user = auth.authenticate("user1", "pass2".toCharArray());
+ user = auth.authenticate("user1", "pass2".toCharArray(), null);
assertNull("User 'user1' falsely authenticated.", user);
- user = auth.authenticate("user2", "lalala".toCharArray());
+ user = auth.authenticate("user2", "lalala".toCharArray(), null);
assertNull("User 'user2' falsely authenticated.", user);
- user = auth.authenticate("user3", "disabled".toCharArray());
+ user = auth.authenticate("user3", "disabled".toCharArray(), null);
assertNull("User 'user3' falsely authenticated.", user);
- user = auth.authenticate("user4", "disabled".toCharArray());
+ user = auth.authenticate("user4", "disabled".toCharArray(), null);
assertNull("User 'user4' falsely authenticated.", user);
- user = auth.authenticate("plain", "text".toCharArray());
+ user = auth.authenticate("plain", "text".toCharArray(), null);
assertNull("User 'plain' falsely authenticated.", user);
- user = auth.authenticate("plain", "password".toCharArray());
+ user = auth.authenticate("plain", "password".toCharArray(), null);
assertNull("User 'plain' falsely authenticated.", user);
MS.put(KEY_SUPPORT_PLAINTEXT_PWD, "false");
- user = auth.authenticate("crypt", "".toCharArray());
+ user = auth.authenticate("crypt", "".toCharArray(), null);
assertNull("User 'cyrpt' falsely authenticated.", user);
- user = auth.authenticate("crypt", "passwd".toCharArray());
+ user = auth.authenticate("crypt", "passwd".toCharArray(), null);
assertNull("User 'crypt' falsely authenticated.", user);
- user = auth.authenticate("md5", "".toCharArray());
+ user = auth.authenticate("md5", "".toCharArray(), null);
assertNull("User 'md5' falsely authenticated.", user);
- user = auth.authenticate("md5", "pwd".toCharArray());
+ user = auth.authenticate("md5", "pwd".toCharArray(), null);
assertNull("User 'md5' falsely authenticated.", user);
- user = auth.authenticate("sha", "".toCharArray());
+ user = auth.authenticate("sha", "".toCharArray(), null);
assertNull("User 'sha' falsely authenticated.", user);
- user = auth.authenticate("sha", "letmein".toCharArray());
+ user = auth.authenticate("sha", "letmein".toCharArray(), null);
assertNull("User 'sha' falsely authenticated.", user);
- user = auth.authenticate(" tabbed", "frontAndBack".toCharArray());
+ user = auth.authenticate(" tabbed", "frontAndBack".toCharArray(), null);
assertNull("User 'tabbed' falsely authenticated.", user);
- user = auth.authenticate(" leading", "whitespace".toCharArray());
+ user = auth.authenticate(" leading", "whitespace".toCharArray(), null);
assertNull("User 'leading' falsely authenticated.", user);
}
diff --git a/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java b/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
index 7c84ecc2..84dd138d 100644
--- a/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/LdapAuthenticationTest.java
@@ -240,23 +240,23 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
@Test
public void testAuthenticationManager() {
- UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray());
+ UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray(), null);
assertNotNull(userOneModel);
assertNotNull(userOneModel.getTeam("git_admins"));
assertNotNull(userOneModel.getTeam("git_users"));
assertTrue(userOneModel.canAdmin);
- UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray());
+ UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray(), null);
assertNull(userOneModelFailedAuth);
- UserModel userTwoModel = auth.authenticate("UserTwo", "userTwoPassword".toCharArray());
+ UserModel userTwoModel = auth.authenticate("UserTwo", "userTwoPassword".toCharArray(), null);
assertNotNull(userTwoModel);
assertNotNull(userTwoModel.getTeam("git_users"));
assertNull(userTwoModel.getTeam("git_admins"));
assertNotNull(userTwoModel.getTeam("git admins"));
assertTrue(userTwoModel.canAdmin);
- UserModel userThreeModel = auth.authenticate("UserThree", "userThreePassword".toCharArray());
+ UserModel userThreeModel = auth.authenticate("UserThree", "userThreePassword".toCharArray(), null);
assertNotNull(userThreeModel);
assertNotNull(userThreeModel.getTeam("git_users"));
assertNull(userThreeModel.getTeam("git_admins"));
@@ -269,10 +269,10 @@ public class LdapAuthenticationTest extends GitblitUnitTest {
settings.put(Keys.realm.ldap.username, "");
settings.put(Keys.realm.ldap.password, "");
- UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray());
+ UserModel userOneModel = auth.authenticate("UserOne", "userOnePassword".toCharArray(), null);
assertNotNull(userOneModel);
- UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray());
+ UserModel userOneModelFailedAuth = auth.authenticate("UserOne", "userTwoPassword".toCharArray(), null);
assertNull(userOneModelFailedAuth);
}
diff --git a/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java b/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java
index ad773b7a..7136fa79 100644
--- a/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java
+++ b/src/test/java/com/gitblit/tests/RedmineAuthenticationTest.java
@@ -65,7 +65,7 @@ public class RedmineAuthenticationTest extends GitblitUnitTest {
@Test
public void testAuthenticationManager() throws Exception {
AuthenticationManager auth = newAuthenticationManager();
- UserModel userModel = auth.authenticate("RedmineAdminId", "RedmineAPIKey".toCharArray());
+ UserModel userModel = auth.authenticate("RedmineAdminId", "RedmineAPIKey".toCharArray(), null);
assertThat(userModel.getName(), is("redmineadminid"));
assertThat(userModel.getDisplayName(), is("baz foo"));
assertThat(userModel.emailAddress, is("baz@example.com"));