Skip to content

Commit

Permalink
Fix test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Apr 24, 2024
1 parent 6404ba5 commit 1fc6b74
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ protected LogoutResponse.LogoutResponseBuilder logoutUsingSid(String sid)
ServerSessionManagementService serverSessionManagementService =
OpenIDConnectAuthenticatorDataHolder.getInstance().getServerSessionManagementService();
serverSessionManagementService.removeSession(sessionId);
try {
UserSessionStore.getInstance().removeFederatedAuthSessionInfo(sessionId);
} catch (UserSessionException e) {
throw new LogoutServerException("Exception occurred while removing federated IDP session mapping.");
}
removeFederatedIDPSessionMapping(sessionId);
if (log.isDebugEnabled()) {
log.debug("Session terminated for session Id: " + sessionId);
}
Expand Down Expand Up @@ -721,4 +717,13 @@ private IdentityProvider getResidentIDPForIssuer(String tenantDomain, String jwt
}
return jwtIssuer.equals(issuer) ? residentIdentityProvider : null;
}

private void removeFederatedIDPSessionMapping(String sessionID) throws LogoutServerException {

try {
UserSessionStore.getInstance().removeFederatedAuthSessionInfo(sessionID);
} catch (UserSessionException e) {
throw new LogoutServerException("Exception occurred while removing federated IDP session mapping.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import javax.sql.DataSource;
import javax.xml.stream.XMLInputFactory;

import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
Expand Down Expand Up @@ -485,7 +486,7 @@ public void testOidcFederatedLogout() throws Exception {
DataSource dataSource = mock(DataSource.class);
mockStatic(IdentityDatabaseUtil.class);
when(IdentityDatabaseUtil.getDataSource()).thenReturn(dataSource);
when(IdentityDatabaseUtil.getDBConnection(false)).thenReturn(getConnection(DB_NAME));
when(IdentityDatabaseUtil.getDBConnection(anyBoolean())).thenReturn(getConnection(DB_NAME));
when(dataSource.getConnection()).thenReturn(getConnection(DB_NAME));

// Mock the server session management service.
Expand Down

0 comments on commit 1fc6b74

Please sign in to comment.