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 @@ -272,6 +272,7 @@ private LogoutFilter createRelyingPartyLogoutFilter(RelyingPartyRegistrationReso
272272 LogoutHandler [] logoutHandlers = this .logoutHandlers .toArray (new LogoutHandler [0 ]);
273273 Saml2RelyingPartyInitiatedLogoutSuccessHandler logoutRequestSuccessHandler = createSaml2LogoutRequestSuccessHandler (
274274 registrations );
275+ logoutRequestSuccessHandler .setLogoutRequestRepository (this .logoutRequestConfigurer .logoutRequestRepository );
275276 LogoutFilter logoutFilter = new LogoutFilter (logoutRequestSuccessHandler , logoutHandlers );
276277 logoutFilter .setLogoutRequestMatcher (createLogoutMatcher ());
277278 return postProcess (logoutFilter );
Original file line number Diff line number Diff line change 8585import static org .assertj .core .api .Assertions .assertThat ;
8686import static org .hamcrest .Matchers .containsString ;
8787import static org .mockito .ArgumentMatchers .any ;
88+ import static org .mockito .ArgumentMatchers .eq ;
8889import static org .mockito .BDDMockito .given ;
8990import static org .mockito .BDDMockito .mock ;
9091import static org .mockito .BDDMockito .verify ;
@@ -407,6 +408,18 @@ public void saml2LogoutResponseWhenCustomLogoutResponseHandlerThenUses() throws
407408 verify (getBean (Saml2LogoutResponseValidator .class )).validate (any ());
408409 }
409410
411+ @ Test
412+ public void saml2LogoutWhenCustomLogoutRequestRepositoryThenUses () throws Exception {
413+ this .spring .register (Saml2LogoutComponentsConfig .class ).autowire ();
414+ RelyingPartyRegistration registration = this .repository .findByRegistrationId ("registration-id" );
415+ Saml2LogoutRequest logoutRequest = Saml2LogoutRequest .withRelyingPartyRegistration (registration )
416+ .samlRequest (this .rpLogoutRequest ).id (this .rpLogoutRequestId ).relayState (this .rpLogoutRequestRelayState )
417+ .parameters ((params ) -> params .put ("Signature" , this .rpLogoutRequestSignature )).build ();
418+ given (getBean (Saml2LogoutRequestResolver .class ).resolve (any (), any ())).willReturn (logoutRequest );
419+ this .mvc .perform (post ("/logout" ).with (authentication (this .user )).with (csrf ()));
420+ verify (getBean (Saml2LogoutRequestRepository .class )).saveLogoutRequest (eq (logoutRequest ), any (), any ());
421+ }
422+
410423 @ Test
411424 public void saml2LogoutWhenLogoutGetThenLogsOutAndSendsLogoutRequest () throws Exception {
412425 this .spring .register (Saml2LogoutWithHttpGet .class ).autowire ();
You can’t perform that action at this time.
0 commit comments