+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public String remove(Object key) {

@Override
public void clear() {
userSessionModel.getNotes().forEach((k, v) -> userSessionModel.removeNote(k));
userSessionModel.getNotes().clear();
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.keycloak.testsuite.model;

import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand Down Expand Up @@ -49,6 +50,7 @@
import java.util.UUID;
import java.util.stream.Collectors;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -148,9 +150,19 @@ public void testRestartSession(KeycloakSession session) {
UserSessionModel userSession = kcSession.sessions().getUserSession(realm, sessions[0].getId());
assertSession(userSession, kcSession.users().getUserByUsername(realm, "user1"), "127.0.0.1", started, started, "test-app", "third-party");

// add some dummy session notes just to test if restart bellow will work
userSession.setNote("k1", "v1");
userSession.setNote("k2", "v2");
userSession.setNote("k3", "v3");

userSession.restartSession(realm, kcSession.users().getUserByUsername(realm, "user2"), "user2", "127.0.0.6", "form", true, null, null);
});

KeycloakModelUtils.runJobInTransaction(session.getKeycloakSessionFactory(), kcSession -> {
UserSessionModel userSession = kcSession.sessions().getUserSession(realm, sessions[0].getId());

assertThat(userSession.getNotes(), Matchers.anEmptyMap());

userSession = kcSession.sessions().getUserSession(realm, sessions[0].getId());
assertSession(userSession, kcSession.users().getUserByUsername(realm, "user2"), "127.0.0.6", started + 100, started + 100);
});
} finally {
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载