File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
main/java/org/springframework/security/config/annotation/web/configurers/saml2
test/java/org/springframework/security/config/annotation/web/configurers/saml2 Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -265,6 +265,7 @@ private LogoutFilter createRelyingPartyLogoutFilter(RelyingPartyRegistrationReso
265
265
LogoutHandler [] logoutHandlers = this .logoutHandlers .toArray (new LogoutHandler [0 ]);
266
266
Saml2RelyingPartyInitiatedLogoutSuccessHandler logoutRequestSuccessHandler = createSaml2LogoutRequestSuccessHandler (
267
267
registrations );
268
+ logoutRequestSuccessHandler .setLogoutRequestRepository (this .logoutRequestConfigurer .logoutRequestRepository );
268
269
LogoutFilter logoutFilter = new LogoutFilter (logoutRequestSuccessHandler , logoutHandlers );
269
270
logoutFilter .setLogoutRequestMatcher (createLogoutMatcher ());
270
271
return postProcess (logoutFilter );
Original file line number Diff line number Diff line change 86
86
import static org .assertj .core .api .Assertions .assertThat ;
87
87
import static org .hamcrest .Matchers .containsString ;
88
88
import static org .mockito .ArgumentMatchers .any ;
89
+ import static org .mockito .ArgumentMatchers .eq ;
89
90
import static org .mockito .BDDMockito .given ;
90
91
import static org .mockito .BDDMockito .mock ;
91
92
import static org .mockito .BDDMockito .verify ;
@@ -408,6 +409,18 @@ public void saml2LogoutResponseWhenCustomLogoutResponseHandlerThenUses() throws
408
409
verify (getBean (Saml2LogoutResponseValidator .class )).validate (any ());
409
410
}
410
411
412
+ @ Test
413
+ public void saml2LogoutWhenCustomLogoutRequestRepositoryThenUses () throws Exception {
414
+ this .spring .register (Saml2LogoutComponentsConfig .class ).autowire ();
415
+ RelyingPartyRegistration registration = this .repository .findByRegistrationId ("registration-id" );
416
+ Saml2LogoutRequest logoutRequest = Saml2LogoutRequest .withRelyingPartyRegistration (registration )
417
+ .samlRequest (this .rpLogoutRequest ).id (this .rpLogoutRequestId ).relayState (this .rpLogoutRequestRelayState )
418
+ .parameters ((params ) -> params .put ("Signature" , this .rpLogoutRequestSignature )).build ();
419
+ given (getBean (Saml2LogoutRequestResolver .class ).resolve (any (), any ())).willReturn (logoutRequest );
420
+ this .mvc .perform (post ("/logout" ).with (authentication (this .user )).with (csrf ()));
421
+ verify (getBean (Saml2LogoutRequestRepository .class )).saveLogoutRequest (eq (logoutRequest ), any (), any ());
422
+ }
423
+
411
424
@ Test
412
425
public void saml2LogoutWhenLogoutGetThenLogsOutAndSendsLogoutRequest () throws Exception {
413
426
this .spring .register (Saml2LogoutWithHttpGet .class ).autowire ();
You can’t perform that action at this time.
0 commit comments