|
63 | 63 | import static org.assertj.core.api.Assertions.assertThat; |
64 | 64 | import static org.hamcrest.Matchers.containsString; |
65 | 65 | import static org.mockito.ArgumentMatchers.any; |
| 66 | +import static org.mockito.ArgumentMatchers.eq; |
66 | 67 | import static org.mockito.BDDMockito.given; |
67 | 68 | import static org.mockito.Mockito.atLeastOnce; |
68 | 69 | import static org.mockito.Mockito.verify; |
@@ -380,6 +381,22 @@ public void saml2LogoutResponseWhenCustomLogoutResponseHandlerThenUses() throws |
380 | 381 | verify(getBean(Saml2LogoutResponseValidator.class)).validate(any()); |
381 | 382 | } |
382 | 383 |
|
| 384 | + // gh-11363 |
| 385 | + @Test |
| 386 | + public void saml2LogoutWhenCustomLogoutRequestRepositoryThenUses() throws Exception { |
| 387 | + this.spring.configLocations(this.xml("CustomComponents")).autowire(); |
| 388 | + RelyingPartyRegistration registration = this.repository.findByRegistrationId("get"); |
| 389 | + Saml2LogoutRequest logoutRequest = Saml2LogoutRequest.withRelyingPartyRegistration(registration) |
| 390 | + .samlRequest(this.rpLogoutRequest) |
| 391 | + .id(this.rpLogoutRequestId) |
| 392 | + .relayState(this.rpLogoutRequestRelayState) |
| 393 | + .parameters((params) -> params.put("Signature", this.rpLogoutRequestSignature)) |
| 394 | + .build(); |
| 395 | + given(getBean(Saml2LogoutRequestResolver.class).resolve(any(), any())).willReturn(logoutRequest); |
| 396 | + this.mvc.perform(post("/logout").with(authentication(this.saml2User)).with(csrf())); |
| 397 | + verify(getBean(Saml2LogoutRequestRepository.class)).saveLogoutRequest(eq(logoutRequest), any(), any()); |
| 398 | + } |
| 399 | + |
383 | 400 | private <T> T getBean(Class<T> clazz) { |
384 | 401 | return this.spring.getContext().getBean(clazz); |
385 | 402 | } |
|
0 commit comments