supported app multiple signin requirement according to public-server change
This commit is contained in:
@@ -14,7 +14,7 @@ public interface IUserAppRepository {
|
||||
|
||||
void add(Integer id, String token);
|
||||
|
||||
void delete(Integer id);
|
||||
void delete(String token);
|
||||
|
||||
String find(Integer id);
|
||||
Integer find(String token);
|
||||
}
|
||||
@@ -38,15 +38,15 @@ public class UserAppRepositoryImpl implements IUserAppRepository {
|
||||
}
|
||||
|
||||
public void add(Integer id, String token) {
|
||||
hashOperations.put(KEY, id, token);
|
||||
hashOperations.put(KEY, token, id);
|
||||
}
|
||||
|
||||
public void delete(final Integer id) {
|
||||
hashOperations.delete(KEY, id);
|
||||
public void delete(final String token) {
|
||||
hashOperations.delete(KEY, token);
|
||||
}
|
||||
|
||||
public String find(final Integer id) {
|
||||
return (String) hashOperations.get(KEY, id);
|
||||
public Integer find(final String token) {
|
||||
return (Integer)hashOperations.get(KEY, token);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -95,7 +95,8 @@ public abstract class AbstractBaseService implements TokenValidation {
|
||||
private Status validateUserToken(Integer userId, String token) {
|
||||
Status status = new Status();
|
||||
|
||||
if (userAppRepository.find(userId).equals(token)) {
|
||||
Integer cachedId = userAppRepository.find(token);
|
||||
if (null != cachedId && cachedId.equals(userId)) {
|
||||
status.setCode(Constants.ERROR_CODE_SUCCESS);
|
||||
} else {
|
||||
status.setCode(Constants.ERROR_CODE_AUTH_FAILURE);
|
||||
|
||||
Reference in New Issue
Block a user