From c1b0e4a5a3acc31bd469cf498d1ba7d390c379b2 Mon Sep 17 00:00:00 2001 From: James Moger Date: Wed, 11 Dec 2013 09:08:26 -0500 Subject: Centralize cookie creation Change-Id: I1a17416121764f33a8d05a88c80cece0c03ac41d --- src/main/java/com/gitblit/auth/RedmineAuthProvider.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/gitblit/auth/RedmineAuthProvider.java') 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(); -- cgit v1.2.3