aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-21 12:34:56 +0300
committerGravatar Vitaly Takmazov2018-08-21 12:36:59 +0300
commit4fab4e8df0defce8338b48eda0349a15724d1d4e (patch)
tree7766ca73cf95bff7be2d4bf75e534e0dfc2366af /juick-common/src/main/java/com
parentd4a9a95f43e0b911b76d03150603d191d463550c (diff)
User refactoring
Diffstat (limited to 'juick-common/src/main/java/com')
-rw-r--r--juick-common/src/main/java/com/juick/User.java10
-rw-r--r--juick-common/src/main/java/com/juick/server/helpers/AnonymousUser.java10
-rw-r--r--juick-common/src/main/java/com/juick/service/UserService.java4
-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.java2
-rw-r--r--juick-common/src/main/java/com/juick/service/security/deprecated/RequestParamHashRememberMeServices.java2
7 files changed, 4 insertions, 28 deletions
diff --git a/juick-common/src/main/java/com/juick/User.java b/juick-common/src/main/java/com/juick/User.java
index b81739a2..7aa92469 100644
--- a/juick-common/src/main/java/com/juick/User.java
+++ b/juick-common/src/main/java/com/juick/User.java
@@ -44,7 +44,6 @@ public class User {
private String authHash;
private boolean banned;
private String credentials;
- private String lang;
private List<ExternalToken> tokens;
private List<User> read;
private List<User> readers;
@@ -72,7 +71,6 @@ public class User {
.append("name", name)
.append("fullName", fullName)
.append("messagesCount", messagesCount)
- .append("lang", lang)
.append("banned", banned)
.toString();
}
@@ -154,14 +152,6 @@ public class User {
this.credentials = credentials;
}
- public String getLang() {
- return lang;
- }
-
- public void setLang(String lang) {
- this.lang = lang;
- }
-
@XmlTransient
public int getMessagesCount() {
return messagesCount;
diff --git a/juick-common/src/main/java/com/juick/server/helpers/AnonymousUser.java b/juick-common/src/main/java/com/juick/server/helpers/AnonymousUser.java
index 122bbe29..9a201552 100644
--- a/juick-common/src/main/java/com/juick/server/helpers/AnonymousUser.java
+++ b/juick-common/src/main/java/com/juick/server/helpers/AnonymousUser.java
@@ -34,7 +34,6 @@ public final class AnonymousUser extends User {
super.setAuthHash(getAuthHash());
super.setBanned(isBanned());
super.setCredentials(getCredentials());
- super.setLang(getLang());
}
@Override
@@ -83,11 +82,6 @@ public final class AnonymousUser extends User {
}
@Override
- public String getLang() {
- return "__";
- }
-
- @Override
public int getMessagesCount() {
return 0;
}
@@ -130,10 +124,6 @@ public final class AnonymousUser extends User {
}
@Override
- public void setLang(String lang) {
- }
-
- @Override
public void setMessagesCount(int messagesCount) {
}
}
diff --git a/juick-common/src/main/java/com/juick/service/UserService.java b/juick-common/src/main/java/com/juick/service/UserService.java
index 08a7a6ed..ef49a8ab 100644
--- a/juick-common/src/main/java/com/juick/service/UserService.java
+++ b/juick-common/src/main/java/com/juick/service/UserService.java
@@ -46,12 +46,8 @@ public interface UserService {
User getUserByName(String username);
- User getFullyUserByName(String username);
-
User getUserByEmail(String email);
- List<User> getFullyUsersByNames(Collection<String> usernames);
-
User getUserByJID(String jid);
List<User> getUsersByName(Collection<String> unames);
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..9215d09a 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
@@ -69,7 +69,7 @@ public class HashParamAuthenticationFilter extends OncePerRequestFilter {
User user = userService.getUserByHash(hash);
if (!user.isAnonymous()) {
- User userWithPassword = userService.getFullyUserByName(user.getName());
+ User userWithPassword = userService.getUserByName(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-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java b/juick-common/src/main/java/com/juick/service/security/JuickUserDetailsService.java
index f6ae8909..adb0ab44 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
@@ -41,7 +41,7 @@ public class JuickUserDetailsService implements UserDetailsService {
if (StringUtils.isBlank(username))
throw new UsernameNotFoundException("Invalid user name " + username);
- com.juick.User user = userService.getFullyUserByName(username);
+ com.juick.User user = userService.getUserByName(username);
if (user != null) {
user.setAuthHash(userService.getHashByUID(user.getUid()));
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 bda5e902..e385d7dd 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
@@ -115,7 +115,7 @@ public class CookieSimpleHashRememberMeServices extends AbstractRememberMeServic
Assert.isTrue(userOptional.isPresent());
- return new JuickUser(userService.getFullyUserByName(userOptional.get().getName()));
+ return new JuickUser(userService.getUserByName(userOptional.get().getName()));
}
@Override
diff --git a/juick-common/src/main/java/com/juick/service/security/deprecated/RequestParamHashRememberMeServices.java b/juick-common/src/main/java/com/juick/service/security/deprecated/RequestParamHashRememberMeServices.java
index 71159e17..3631e5a4 100644
--- a/juick-common/src/main/java/com/juick/service/security/deprecated/RequestParamHashRememberMeServices.java
+++ b/juick-common/src/main/java/com/juick/service/security/deprecated/RequestParamHashRememberMeServices.java
@@ -81,7 +81,7 @@ public class RequestParamHashRememberMeServices extends AbstractRememberMeServic
if (StringUtils.isNotBlank(hash)) {
User user = userService.getUserByHash(hash);
if (!user.isAnonymous())
- return new JuickUser(userService.getFullyUserByName(user.getName()));
+ return new JuickUser(userService.getUserByName(user.getName()));
}
throw new UsernameNotFoundException("User not found by hash " + hash);
}