From 7cb82b858b853ef3d09d85853573ec91b038547a Mon Sep 17 00:00:00 2001 From: mallowlabs Date: Sat, 8 Sep 2012 23:50:47 +0900 Subject: [PATCH] Added cookie suport --- src/com/gitblit/RedmineUserService.java | 7 ++----- tests/com/gitblit/tests/RedmineUserServiceTest.java | 2 ++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/com/gitblit/RedmineUserService.java b/src/com/gitblit/RedmineUserService.java index 6ff61c73..47bb80a5 100644 --- a/src/com/gitblit/RedmineUserService.java +++ b/src/com/gitblit/RedmineUserService.java @@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory; import com.gitblit.models.UserModel; import com.gitblit.utils.ConnectionUtils; +import com.gitblit.utils.StringUtils; import com.google.gson.Gson; /** @@ -71,11 +72,6 @@ public class RedmineUserService extends GitblitUserService { return false; } - @Override - public boolean supportsCookies() { - return false; - } - @Override public UserModel authenticate(String username, char[] password) { String urlText = this.settings.getString(Keys.realm.redmine.url, ""); @@ -95,6 +91,7 @@ public class RedmineUserService extends GitblitUserService { userModel.displayName = current.user.firstname + " " + current.user.lastname; userModel.emailAddress = current.user.mail; userModel.canAdmin = true; + userModel.cookie = StringUtils.getSHA1(userModel.username + new String(password)); return userModel; } diff --git a/tests/com/gitblit/tests/RedmineUserServiceTest.java b/tests/com/gitblit/tests/RedmineUserServiceTest.java index a6a8a5eb..0ba58ec5 100644 --- a/tests/com/gitblit/tests/RedmineUserServiceTest.java +++ b/tests/com/gitblit/tests/RedmineUserServiceTest.java @@ -1,6 +1,7 @@ package com.gitblit.tests; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; @@ -27,6 +28,7 @@ public class RedmineUserServiceTest { assertThat(userModel.getName(), is("RedmineUserId")); assertThat(userModel.getDisplayName(), is("baz foo")); assertThat(userModel.emailAddress, is("baz@example.com")); + assertNotNull(userModel.cookie); } @Test -- 2.39.5