aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--juick-server-web/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java1
-rw-r--r--juick-www/src/test/java/com/juick/www/WebAppTests.java6
2 files changed, 6 insertions, 1 deletions
diff --git a/juick-server-web/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java b/juick-server-web/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
index e8ea0492..b56b98c8 100644
--- a/juick-server-web/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
+++ b/juick-server-web/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
@@ -70,6 +70,7 @@ public class HashParamAuthenticationFilter extends OncePerRequestFilter {
if (!user.isAnonymous()) {
User userWithPassword = userService.getFullyUserByName(user.getName());
+ userWithPassword.setAuthHash(userService.getHashByUID(userWithPassword.getUid()));
Authentication authentication = new RememberMeAuthenticationToken(
((AbstractRememberMeServices)rememberMeServices).getKey(), new JuickUser(userWithPassword), JuickUser.USER_AUTHORITY);
diff --git a/juick-www/src/test/java/com/juick/www/WebAppTests.java b/juick-www/src/test/java/com/juick/www/WebAppTests.java
index ef33506c..dcbcb66c 100644
--- a/juick-www/src/test/java/com/juick/www/WebAppTests.java
+++ b/juick-www/src/test/java/com/juick/www/WebAppTests.java
@@ -308,7 +308,11 @@ public class WebAppTests {
@Test
public void hashLoginShouldNotUseSession() throws Exception {
String hash = userService.getHashByUID(ugnich.getUid());
- MvcResult hashLoginResult = mockMvc.perform(get("/?show=my&hash=" + hash)).andExpect(status().isOk()).andReturn();
+ MvcResult hashLoginResult = mockMvc.perform(get("/?show=my&hash=" + hash))
+ .andExpect(status().isOk())
+ .andExpect(model().attribute("visitor", hasProperty("authHash", equalTo(hash))))
+ .andExpect(content().string(containsString(hash)))
+ .andReturn();
Cookie rememberMeFromHash = hashLoginResult.getResponse().getCookie("juick-remember-me");
MvcResult formLoginResult = mockMvc.perform(post("/login")
.param("username", ugnichName)