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 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) {
|
public void add(Integer id, String token) {
|
||||||
hashOperations.put(KEY, id, token);
|
hashOperations.put(KEY, token, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(final Integer id) {
|
public void delete(final String token) {
|
||||||
hashOperations.delete(KEY, id);
|
hashOperations.delete(KEY, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String find(final Integer id) {
|
public Integer find(final String token) {
|
||||||
return (String) hashOperations.get(KEY, id);
|
return (Integer)hashOperations.get(KEY, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,8 @@ public abstract class AbstractBaseService implements TokenValidation {
|
|||||||
private Status validateUserToken(Integer userId, String token) {
|
private Status validateUserToken(Integer userId, String token) {
|
||||||
Status status = new Status();
|
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);
|
status.setCode(Constants.ERROR_CODE_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
status.setCode(Constants.ERROR_CODE_AUTH_FAILURE);
|
status.setCode(Constants.ERROR_CODE_AUTH_FAILURE);
|
||||||
|
|||||||
Reference in New Issue
Block a user