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
272
272
LogoutHandler [] logoutHandlers = this .logoutHandlers .toArray (new LogoutHandler [0 ]);
273
273
Saml2RelyingPartyInitiatedLogoutSuccessHandler logoutRequestSuccessHandler = createSaml2LogoutRequestSuccessHandler (
274
274
registrations );
275
+ logoutRequestSuccessHandler .setLogoutRequestRepository (this .logoutRequestConfigurer .logoutRequestRepository );
275
276
LogoutFilter logoutFilter = new LogoutFilter (logoutRequestSuccessHandler , logoutHandlers );
276
277
logoutFilter .setLogoutRequestMatcher (createLogoutMatcher ());
277
278
return postProcess (logoutFilter );
Original file line number Diff line number Diff line change 85
85
import static org .assertj .core .api .Assertions .assertThat ;
86
86
import static org .hamcrest .Matchers .containsString ;
87
87
import static org .mockito .ArgumentMatchers .any ;
88
+ import static org .mockito .ArgumentMatchers .eq ;
88
89
import static org .mockito .BDDMockito .given ;
89
90
import static org .mockito .BDDMockito .mock ;
90
91
import static org .mockito .BDDMockito .verify ;
@@ -407,6 +408,18 @@ public void saml2LogoutResponseWhenCustomLogoutResponseHandlerThenUses() throws
407
408
verify (getBean (Saml2LogoutResponseValidator .class )).validate (any ());
408
409
}
409
410
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
+
410
423
@ Test
411
424
public void saml2LogoutWhenLogoutGetThenLogsOutAndSendsLogoutRequest () throws Exception {
412
425
this .spring .register (Saml2LogoutWithHttpGet .class ).autowire ();
You can’t perform that action at this time.
0 commit comments