use of org.springframework.security.web.server.WebFilterExchange in project spring-security by spring-projects.
the class OidcClientInitiatedServerLogoutSuccessHandlerTests method logoutWhenOidcRedirectUrlConfiguredThenRedirects.
@Test
public void logoutWhenOidcRedirectUrlConfiguredThenRedirects() {
OAuth2AuthenticationToken token = new OAuth2AuthenticationToken(TestOidcUsers.create(), AuthorityUtils.NO_AUTHORITIES, this.registration.getRegistrationId());
given(this.exchange.getPrincipal()).willReturn(Mono.just(token));
WebFilterExchange f = new WebFilterExchange(this.exchange, this.chain);
this.handler.onLogoutSuccess(f, token).block();
assertThat(redirectedUrl(this.exchange)).isEqualTo("https://endpoint?id_token_hint=id-token");
}
use of org.springframework.security.web.server.WebFilterExchange in project spring-security by spring-projects.
the class OidcClientInitiatedServerLogoutSuccessHandlerTests method logoutWhenNotOAuth2AuthenticationThenDefaults.
@Test
public void logoutWhenNotOAuth2AuthenticationThenDefaults() {
Authentication token = mock(Authentication.class);
given(this.exchange.getPrincipal()).willReturn(Mono.just(token));
WebFilterExchange f = new WebFilterExchange(this.exchange, this.chain);
this.handler.setLogoutSuccessUrl(URI.create("https://default"));
this.handler.onLogoutSuccess(f, token).block();
assertThat(redirectedUrl(this.exchange)).isEqualTo("https://default");
}
Aggregations