Merge pull request #1354 from mposolda/master
KEYCLOAK-1260 Fix saml backchannel logout with JPA UserSession provid…
This commit is contained in:
commit
d8880e5ff3
2 changed files with 16 additions and 1 deletions
|
@ -374,11 +374,21 @@ public class SamlService {
|
||||||
for (String sessionIndex : logoutRequest.getSessionIndex()) {
|
for (String sessionIndex : logoutRequest.getSessionIndex()) {
|
||||||
ClientSessionModel clientSession = session.sessions().getClientSession(realm, sessionIndex);
|
ClientSessionModel clientSession = session.sessions().getClientSession(realm, sessionIndex);
|
||||||
if (clientSession == null) continue;
|
if (clientSession == null) continue;
|
||||||
|
UserSessionModel userSession = clientSession.getUserSession();
|
||||||
if (clientSession.getClient().getClientId().equals(client.getClientId())) {
|
if (clientSession.getClient().getClientId().equals(client.getClientId())) {
|
||||||
// remove requesting client from logout
|
// remove requesting client from logout
|
||||||
clientSession.setAction(ClientSessionModel.Action.LOGGED_OUT);
|
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 {
|
try {
|
||||||
authManager.backchannelLogout(session, realm, userSession, uriInfo, clientConnection, headers, true);
|
authManager.backchannelLogout(session, realm, userSession, uriInfo, clientConnection, headers, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -45,6 +45,11 @@ public class SAMLKeyCloakServerBrokerWithSignatureTest extends AbstractIdentityP
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void testSleep() throws Exception {
|
||||||
|
Thread.sleep(100000000);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getProviderId() {
|
protected String getProviderId() {
|
||||||
return "kc-saml-signed-idp";
|
return "kc-saml-signed-idp";
|
||||||
|
|
Loading…
Reference in a new issue