diff options
author | James Moger <james.moger@gitblit.com> | 2013-12-11 09:08:26 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-12-11 09:08:26 -0500 |
commit | c1b0e4a5a3acc31bd469cf498d1ba7d390c379b2 (patch) | |
tree | 7d9b26ed2583935edd705d04c6e147cb7afe4a38 /src/main/java/com/gitblit/auth/RedmineAuthProvider.java | |
parent | 1293c279d1ab41ba7f4721009f87e89d4d48bf3d (diff) | |
download | gitblit-c1b0e4a5a3acc31bd469cf498d1ba7d390c379b2.tar.gz gitblit-c1b0e4a5a3acc31bd469cf498d1ba7d390c379b2.zip |
Centralize cookie creation
Change-Id: I1a17416121764f33a8d05a88c80cece0c03ac41d
Diffstat (limited to 'src/main/java/com/gitblit/auth/RedmineAuthProvider.java')
-rw-r--r-- | src/main/java/com/gitblit/auth/RedmineAuthProvider.java | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/auth/RedmineAuthProvider.java b/src/main/java/com/gitblit/auth/RedmineAuthProvider.java index 176c576b..04adc459 100644 --- a/src/main/java/com/gitblit/auth/RedmineAuthProvider.java +++ b/src/main/java/com/gitblit/auth/RedmineAuthProvider.java @@ -26,7 +26,6 @@ import com.gitblit.Constants.AccountType; import com.gitblit.Keys; import com.gitblit.auth.AuthenticationProvider.UsernamePasswordAuthenticationProvider; import com.gitblit.models.UserModel; -import com.gitblit.utils.ArrayUtils; import com.gitblit.utils.ConnectionUtils; import com.gitblit.utils.StringUtils; import com.google.gson.Gson; @@ -122,13 +121,13 @@ public class RedmineAuthProvider extends UsernamePasswordAuthenticationProvider } UserModel user = userManager.getUserModel(username); - if (user == null) // create user object for new authenticated user + if (user == null) { + // create user object for new authenticated user user = new UserModel(username.toLowerCase()); + } // create a user cookie - if (StringUtils.isEmpty(user.cookie) && !ArrayUtils.isEmpty(password)) { - user.cookie = StringUtils.getSHA1(user.username + new String(password)); - } + setCookie(user, password); // update user attributes from Redmine user.accountType = getAccountType(); |