diff options
author | Vitaly Takmazov | 2018-05-18 15:33:38 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-07-24 14:35:02 +0300 |
commit | 8a0fbbd35c13054a947ea0d27ca117542bc452b9 (patch) | |
tree | 4266fbfaac3f1e268e780bc1cfa3cdc23ccd955c /juick-common/src/main/java/com/juick/service/security/deprecated | |
parent | 3fa18888d5ca53b59c778de3f829870614d05c27 (diff) |
JPA WIP
Diffstat (limited to 'juick-common/src/main/java/com/juick/service/security/deprecated')
-rw-r--r-- | juick-common/src/main/java/com/juick/service/security/deprecated/CookieSimpleHashRememberMeServices.java | 12 |
1 files changed, 6 insertions, 6 deletions
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()); |