use of org.springframework.security.oauth2.client.oidc.web.server.logout.OidcClientInitiatedServerLogoutSuccessHandler in project spring-security by spring-projects.
the class OidcClientInitiatedServerLogoutSuccessHandlerTests method logoutWhenClientRegistrationHasNoEndSessionEndpointThenDefaults.
@Test
public void logoutWhenClientRegistrationHasNoEndSessionEndpointThenDefaults() {
ClientRegistration registration = TestClientRegistrations.clientRegistration().build();
ReactiveClientRegistrationRepository repository = new InMemoryReactiveClientRegistrationRepository(registration);
OidcClientInitiatedServerLogoutSuccessHandler handler = new OidcClientInitiatedServerLogoutSuccessHandler(repository);
OAuth2AuthenticationToken token = new OAuth2AuthenticationToken(TestOidcUsers.create(), AuthorityUtils.NO_AUTHORITIES, registration.getRegistrationId());
given(this.exchange.getPrincipal()).willReturn(Mono.just(token));
WebFilterExchange f = new WebFilterExchange(this.exchange, this.chain);
handler.setLogoutSuccessUrl(URI.create("https://default"));
handler.onLogoutSuccess(f, token).block();
assertThat(redirectedUrl(this.exchange)).isEqualTo("https://default");
}
Aggregations