aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/service/security
diff options
context:
space:
mode:
Diffstat (limited to 'juick-common/src/main/java/com/juick/service/security')
-rw-r--r--juick-common/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java2
-rw-r--r--juick-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java2
-rw-r--r--juick-common/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java12
3 files changed, 8 insertions, 8 deletions
diff --git a/juick-common/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java b/juick-common/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
index b56b98c8..9bf83f86 100644
--- a/juick-common/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
+++ b/juick-common/src/main/java/com/juick/service/security/HashParamAuthenticationFilter.java
@@ -70,7 +70,7 @@ public class HashParamAuthenticationFilter extends OncePerRequestFilter {
if (!user.isAnonymous()) {
User userWithPassword = userService.getFullyUserByName(user.getName());
- userWithPassword.setAuthHash(userService.getHashByUID(userWithPassword.getUid()));
+ userWithPassword.setAuthHash(userService.getHashForUser(userWithPassword));
Authentication authentication = new RememberMeAuthenticationToken(
((AbstractRememberMeServices)rememberMeServices).getKey(), new JuickUser(userWithPassword), JuickUser.USER_AUTHORITY);
diff --git a/juick-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java b/juick-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java
index f6ae8909..78293f38 100644
--- a/juick-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java
+++ b/juick-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java
@@ -44,7 +44,7 @@ public class JuickUserDetailsService implements UserDetailsService {
com.juick.User user = userService.getFullyUserByName(username);
if (user != null) {
- user.setAuthHash(userService.getHashByUID(user.getUid()));
+ user.setAuthHash(userService.getHashForUser(user));
return new JuickUser(user);
}
diff --git a/juick-common/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java b/juick-common/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java
index b658e16f..019ee502 100644
--- a/juick-common/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java
+++ b/juick-common/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java
@@ -80,13 +80,13 @@ public class CookieSimpleHashRememberMeServices extends AbstractRememberMeServic
logger.debug("Creating new persistent login for user {}", username);
try {
- int uid = userService.getUIDbyName(username);
+ User user = userService.getUserByName(username);
- Assert.isTrue(uid > 0);
+ Assert.isTrue(user.getUid() > 0);
String hash = RandomStringUtils.randomAlphanumeric(16).toUpperCase();
- userService.setLoginForUser(uid, hash);
+ userService.setLoginForUser(user.getUid(), hash);
setCookie(new String[]{hash}, getTokenValiditySeconds(), request, response);
} catch (Exception e) {
@@ -107,11 +107,11 @@ public class CookieSimpleHashRememberMeServices extends AbstractRememberMeServic
throw new InvalidCookieException("Cookie is invalid and hash parameter not found");
}
- int uid = userService.getUIDbyHash(hash);
- if (uid <= 0)
+ User user = userService.getUserByHash(hash);
+ if (user.getUid() <= 0)
throw new UsernameNotFoundException("User not found by hash, cookies" + cookieTokens);
- Optional<User> userOptional = userService.getUserByUID(uid);
+ Optional<User> userOptional = userService.getUserByUID(user.getUid());
Assert.isTrue(userOptional.isPresent());