File tree 2 files changed +17
-0
lines changed
components/org.wso2.carbon.identity.application.authenticator.oidc/src
main/java/org/wso2/carbon/identity/application/authenticator/oidc/logout/idpinit/processor
test/java/org/wso2/carbon/identity/application/authenticator/oidc/logout/idpinit/processor
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 59
59
import org .wso2 .carbon .idp .mgt .IdentityProviderManager ;
60
60
61
61
import java .text .ParseException ;
62
+ import java .util .Collections ;
62
63
import java .util .Date ;
63
64
import java .util .HashMap ;
64
65
import java .util .List ;
@@ -190,6 +191,7 @@ protected LogoutResponse.LogoutResponseBuilder logoutUsingSid(String sid)
190
191
OpenIDConnectAuthenticatorDataHolder .getInstance ().getServerSessionManagementService ();
191
192
serverSessionManagementService .removeSession (sessionId );
192
193
removeFederatedIDPSessionMapping (sessionId );
194
+ removeTerminatedSessionRecords (sessionId );
193
195
if (log .isDebugEnabled ()) {
194
196
log .debug ("Session terminated for session Id: " + sessionId );
195
197
}
@@ -727,4 +729,9 @@ private void removeFederatedIDPSessionMapping(String sessionID) throws LogoutSer
727
729
throw new LogoutServerException ("Exception occurred while removing federated IDP session mapping." );
728
730
}
729
731
}
732
+
733
+ private void removeTerminatedSessionRecords (String sessionId ) {
734
+
735
+ UserSessionStore .getInstance ().removeTerminatedSessionRecords (Collections .singletonList (sessionId ));
736
+ }
730
737
}
Original file line number Diff line number Diff line change 73
73
import javax .xml .stream .XMLInputFactory ;
74
74
75
75
import static org .mockito .ArgumentMatchers .anyBoolean ;
76
+ import static org .mockito .ArgumentMatchers .anyList ;
76
77
import static org .mockito .ArgumentMatchers .anyString ;
78
+ import static org .mockito .Mockito .doNothing ;
77
79
import static org .mockito .Mockito .mock ;
80
+ import static org .mockito .Mockito .times ;
81
+ import static org .mockito .Mockito .verify ;
78
82
import static org .powermock .api .mockito .PowerMockito .mockStatic ;
79
83
import static org .powermock .api .mockito .PowerMockito .when ;
80
84
import static org .testng .Assert .assertEquals ;
@@ -501,11 +505,17 @@ public void testOidcFederatedLogout() throws Exception {
501
505
// Mock removeSession method.
502
506
when (serverSessionManagementService .removeSession (SESSION_CONTEXT_KEY )).thenReturn (true );
503
507
508
+ mockStatic (UserSessionStore .class );
509
+ UserSessionStore userSessionStore = mock (UserSessionStore .class );
510
+ when (UserSessionStore .getInstance ()).thenReturn (userSessionStore );
511
+ doNothing ().when (userSessionStore ).removeTerminatedSessionRecords (anyList ());
512
+
504
513
// Mock tenantID.
505
514
mockStatic (IdentityTenantUtil .class );
506
515
when (IdentityTenantUtil .getTenantId (anyString ())).thenReturn (-1234 );
507
516
508
517
assertNotNull (logoutProcessor .handleOIDCFederatedLogoutRequest (mockLogoutRequest ));
518
+ verify (userSessionStore , times (1 )).removeTerminatedSessionRecords (anyList ());
509
519
}
510
520
511
521
@ Test
You can’t perform that action at this time.
0 commit comments