Skip to content

Commit d6804de

Browse files
fjumarsearls
authored andcommitted
[ELY-2534] Use the client ID and sid from the ID token in the key for the sessionsMarkedForInvalidation map
1 parent b2d4c6e commit d6804de

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

http/oidc/src/main/java/org/wildfly/security/http/oidc/LogoutHandler.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ final class LogoutHandler {
4242
public static final String ID_TOKEN_HINT_PARAM = "id_token_hint";
4343
private static final String LOGOUT_TOKEN_PARAM = "logout_token";
4444
private static final String LOGOUT_TOKEN_TYPE = "Logout";
45+
private static final String CLIENT_ID_SID_SEPARATOR = "-";
4546
public static final String SID = "sid";
4647
public static final String ISS = "iss";
4748

@@ -99,7 +100,7 @@ boolean isSessionMarkedForInvalidation(OidcHttpFacade facade) {
99100
if (idToken == null) {
100101
return false;
101102
}
102-
return sessionsMarkedForInvalidation.containsKey(idToken.getSid());
103+
return sessionsMarkedForInvalidation.remove(getSessionKey(facade, idToken.getSid())) != null;
103104
}
104105

105106
private void redirectEndSessionEndpoint(OidcHttpFacade facade) {
@@ -170,7 +171,11 @@ private void handleBackChannelLogoutRequest(OidcHttpFacade facade) {
170171
}
171172

172173
log.debug("Marking session for invalidation during back-channel logout");
173-
sessionsMarkedForInvalidation.put(sessionId, facade.getOidcClientConfiguration());
174+
sessionsMarkedForInvalidation.put(getSessionKey(facade, sessionId), facade.getOidcClientConfiguration());
175+
}
176+
177+
private String getSessionKey(OidcHttpFacade facade, String sessionId) {
178+
return facade.getOidcClientConfiguration().getClientId() + CLIENT_ID_SID_SEPARATOR + sessionId;
174179
}
175180

176181
private void handleFrontChannelLogoutRequest(OidcHttpFacade facade) {

0 commit comments

Comments
 (0)