use of org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken in project spring-security by spring-projects.
the class OidcClientInitiatedLogoutSuccessHandlerTests method logoutWhenClientRegistrationHasNoEndSessionEndpointThenDefaults.
@Test
public void logoutWhenClientRegistrationHasNoEndSessionEndpointThenDefaults() throws Exception {
ClientRegistration registration = TestClientRegistrations.clientRegistration().build();
ClientRegistrationRepository repository = new InMemoryClientRegistrationRepository(registration);
OidcClientInitiatedLogoutSuccessHandler handler = new OidcClientInitiatedLogoutSuccessHandler(repository);
OAuth2AuthenticationToken token = new OAuth2AuthenticationToken(TestOidcUsers.create(), AuthorityUtils.NO_AUTHORITIES, registration.getRegistrationId());
this.request.setUserPrincipal(token);
handler.setDefaultTargetUrl("https://default");
handler.onLogoutSuccess(this.request, this.response, token);
assertThat(this.response.getRedirectedUrl()).isEqualTo("https://default");
}
Aggregations