mallowlabs
2012-09-08 7cb82b858b853ef3d09d85853573ec91b038547a
src/com/gitblit/RedmineUserService.java
@@ -4,13 +4,14 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import org.apache.wicket.util.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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;
            }
@@ -109,8 +106,8 @@
            return testingJson;
        }
        URL apiUrl = new URL(url + "users/current.json?key=" + apiKey);
        HttpURLConnection http = (HttpURLConnection) apiUrl.openConnection();
        String apiUrl = url + "users/current.json?key=" + apiKey;
        HttpURLConnection http = (HttpURLConnection) ConnectionUtils.openConnection(apiUrl, null, null);
        http.setRequestMethod("GET");
        http.connect();
        InputStreamReader reader = new InputStreamReader(http.getInputStream());