KEYCLOAK-4939 ConcurrentLoginTest broken in latest master

This commit is contained in:
mposolda 2017-05-19 14:00:42 +02:00
parent 336d05dd34
commit e2a7b71cf3
4 changed files with 6 additions and 15 deletions

View file

@ -69,10 +69,6 @@ public class AuthenticatedClientSessionAdapter implements AuthenticatedClientSes
}
} else {
this.userSession = (UserSessionAdapter) userSession;
if (sessionEntity.getAuthenticatedClientSessions() == null) {
sessionEntity.setAuthenticatedClientSessions(new HashMap<>());
}
sessionEntity.getAuthenticatedClientSessions().put(clientUUID, entity);
update();
}

View file

@ -53,6 +53,7 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -518,7 +519,8 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
entity.setBrokerUserId(userSession.getBrokerUserId());
entity.setIpAddress(userSession.getIpAddress());
entity.setLoginUsername(userSession.getLoginUsername());
entity.setNotes(userSession.getNotes());
entity.setNotes(userSession.getNotes()== null ? new ConcurrentHashMap<>() : userSession.getNotes());
entity.setAuthenticatedClientSessions(new ConcurrentHashMap<>());
entity.setRememberMe(userSession.isRememberMe());
entity.setState(userSession.getState());
entity.setUser(userSession.getUser().getId());
@ -555,10 +557,6 @@ public class InfinispanUserSessionProvider implements UserSessionProvider {
entity.setTimestamp(clientSession.getTimestamp());
Map<String, AuthenticatedClientSessionEntity> clientSessions = importedUserSession.getEntity().getAuthenticatedClientSessions();
if (clientSessions == null) {
clientSessions = new HashMap<>();
importedUserSession.getEntity().setAuthenticatedClientSessions(clientSessions);
}
clientSessions.put(clientSession.getClient().getId(), entity);

View file

@ -159,9 +159,6 @@ public class UserSessionAdapter implements UserSessionModel {
@Override
public void setNote(String name, String value) {
if (entity.getNotes() == null) {
entity.setNotes(new ConcurrentHashMap<>());
}
if (value == null) {
if (entity.getNotes().containsKey(name)) {
removeNote(name);
@ -201,8 +198,8 @@ public class UserSessionAdapter implements UserSessionModel {
provider.updateSessionEntity(entity, realm, user, loginUsername, ipAddress, authMethod, rememberMe, brokerSessionId, brokerUserId);
entity.setState(null);
entity.setNotes(null);
entity.setAuthenticatedClientSessions(null);
entity.getNotes().clear();
entity.getAuthenticatedClientSessions().clear();
update();
}

View file

@ -50,7 +50,7 @@ public class UserSessionEntity extends SessionEntity {
private Map<String, String> notes = new ConcurrentHashMap<>();
private Map<String, AuthenticatedClientSessionEntity> authenticatedClientSessions;
private Map<String, AuthenticatedClientSessionEntity> authenticatedClientSessions = new ConcurrentHashMap<>();
public String getUser() {
return user;