Merge pull request #1354 from mposolda/master

KEYCLOAK-1260 Fix saml backchannel logout with JPA UserSession provid…
This commit is contained in:
Marek Posolda 2015-06-10 21:37:05 +02:00
commit d8880e5ff3
2 changed files with 16 additions and 1 deletions

View file

@ -374,11 +374,21 @@ public class SamlService {
for (String sessionIndex : logoutRequest.getSessionIndex()) {
ClientSessionModel clientSession = session.sessions().getClientSession(realm, sessionIndex);
if (clientSession == null) continue;
UserSessionModel userSession = clientSession.getUserSession();
if (clientSession.getClient().getClientId().equals(client.getClientId())) {
// remove requesting client from logout
clientSession.setAction(ClientSessionModel.Action.LOGGED_OUT);
// Remove also other clientSessions of this client as there could be more in this UserSession
if (userSession != null) {
for (ClientSessionModel clientSession2 : userSession.getClientSessions()) {
if (clientSession2.getClient().getId().equals(client.getId())) {
clientSession2.setAction(ClientSessionModel.Action.LOGGED_OUT);
}
UserSessionModel userSession = clientSession.getUserSession();
}
}
}
try {
authManager.backchannelLogout(session, realm, userSession, uriInfo, clientConnection, headers, true);
} catch (Exception e) {

View file

@ -45,6 +45,11 @@ public class SAMLKeyCloakServerBrokerWithSignatureTest extends AbstractIdentityP
}
};
// @Test
public void testSleep() throws Exception {
Thread.sleep(100000000);
}
@Override
protected String getProviderId() {
return "kc-saml-signed-idp";