mallowlabs
2012-09-08 7cb82b858b853ef3d09d85853573ec91b038547a
Added cookie suport
2 files modified
9 ■■■■■ changed files
src/com/gitblit/RedmineUserService.java 7 ●●●● patch | view | raw | blame | history
tests/com/gitblit/tests/RedmineUserServiceTest.java 2 ●●●●● patch | view | raw | blame | history
src/com/gitblit/RedmineUserService.java
@@ -11,6 +11,7 @@
import com.gitblit.models.UserModel;
import com.gitblit.utils.ConnectionUtils;
import com.gitblit.utils.StringUtils;
import com.google.gson.Gson;
/**
@@ -72,11 +73,6 @@
    }
    @Override
    public boolean supportsCookies() {
        return false;
    }
    @Override
    public UserModel authenticate(String username, char[] password) {
        String urlText = this.settings.getString(Keys.realm.redmine.url, "");
        if (!urlText.endsWith("/")) {
@@ -95,6 +91,7 @@
                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;
            }
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 @@
        assertThat(userModel.getName(), is("RedmineUserId"));
        assertThat(userModel.getDisplayName(), is("baz foo"));
        assertThat(userModel.emailAddress, is("baz@example.com"));
        assertNotNull(userModel.cookie);
    }
    @Test