Remove deprecations in OidcClientInitiatedLogoutSuccessHandler

Closes gh-11565
This commit is contained in:
Joe Grandja 2022-07-15 13:59:17 -04:00
parent cae22867b2
commit 743b6a5bfe
4 changed files with 2 additions and 60 deletions

View File

@ -137,18 +137,6 @@ public final class OidcClientInitiatedLogoutSuccessHandler extends SimpleUrlLogo
// @formatter:on
}
/**
* Set the post logout redirect uri to use
* @param postLogoutRedirectUri - A valid URL to which the OP should redirect after
* logging out the user
* @deprecated {@link #setPostLogoutRedirectUri(String)}
*/
@Deprecated
public void setPostLogoutRedirectUri(URI postLogoutRedirectUri) {
Assert.notNull(postLogoutRedirectUri, "postLogoutRedirectUri cannot be null");
this.postLogoutRedirectUri = postLogoutRedirectUri.toASCIIString();
}
/**
* Set the post logout redirect uri template.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -153,18 +153,6 @@ public class OidcClientInitiatedServerLogoutSuccessHandler implements ServerLogo
// @formatter:on
}
/**
* Set the post logout redirect uri to use
* @param postLogoutRedirectUri - A valid URL to which the OP should redirect after
* logging out the user
* @deprecated {@link #setPostLogoutRedirectUri(String)}
*/
@Deprecated
public void setPostLogoutRedirectUri(URI postLogoutRedirectUri) {
Assert.notNull(postLogoutRedirectUri, "postLogoutRedirectUri cannot be empty");
this.postLogoutRedirectUri = postLogoutRedirectUri.toASCIIString();
}
/**
* Set the post logout redirect uri template.
*

View File

@ -17,7 +17,6 @@
package org.springframework.security.oauth2.client.oidc.web.logout;
import java.io.IOException;
import java.net.URI;
import java.util.Collections;
import jakarta.servlet.ServletException;
@ -111,17 +110,6 @@ public class OidcClientInitiatedLogoutSuccessHandlerTests {
assertThat(this.response.getRedirectedUrl()).isEqualTo("https://default");
}
@Test
public void logoutWhenUsingPostLogoutRedirectUriThenIncludesItInRedirect() throws IOException, ServletException {
OAuth2AuthenticationToken token = new OAuth2AuthenticationToken(TestOidcUsers.create(),
AuthorityUtils.NO_AUTHORITIES, this.registration.getRegistrationId());
this.handler.setPostLogoutRedirectUri(URI.create("https://postlogout?encodedparam=value"));
this.request.setUserPrincipal(token);
this.handler.onLogoutSuccess(this.request, this.response, token);
assertThat(this.response.getRedirectedUrl()).isEqualTo("https://endpoint?" + "id_token_hint=id-token&"
+ "post_logout_redirect_uri=https://postlogout?encodedparam%3Dvalue");
}
@Test
public void logoutWhenUsingPostLogoutBaseUrlRedirectUriTemplateThenBuildsItForRedirect()
throws IOException, ServletException {
@ -196,11 +184,6 @@ public class OidcClientInitiatedLogoutSuccessHandlerTests {
+ "post_logout_redirect_uri=https://rp.example.org/context?forwardUrl%3Dsecured%253Fparam%253Dtrue");
}
@Test
public void setPostLogoutRedirectUriWhenGivenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.handler.setPostLogoutRedirectUri((URI) null));
}
@Test
public void setPostLogoutRedirectUriTemplateWhenGivenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.handler.setPostLogoutRedirectUri((String) null));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -122,18 +122,6 @@ public class OidcClientInitiatedServerLogoutSuccessHandlerTests {
assertThat(redirectedUrl(this.exchange)).isEqualTo("https://default");
}
@Test
public void logoutWhenUsingPostLogoutRedirectUriThenIncludesItInRedirect() {
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.setPostLogoutRedirectUri(URI.create("https://postlogout?encodedparam=value"));
this.handler.onLogoutSuccess(f, token).block();
assertThat(redirectedUrl(this.exchange)).isEqualTo("https://endpoint?" + "id_token_hint=id-token&"
+ "post_logout_redirect_uri=https://postlogout?encodedparam%3Dvalue");
}
@Test
public void logoutWhenUsingPostLogoutBaseUrlRedirectUriTemplateThenBuildsItForRedirect()
throws IOException, ServletException {
@ -206,11 +194,6 @@ public class OidcClientInitiatedServerLogoutSuccessHandlerTests {
this.registration.getRegistrationId()));
}
@Test
public void setPostLogoutRedirectUriWhenGivenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.handler.setPostLogoutRedirectUri((URI) null));
}
@Test
public void setPostLogoutRedirectUriTemplateWhenGivenNullThenThrowsException() {
assertThatIllegalArgumentException().isThrownBy(() -> this.handler.setPostLogoutRedirectUri((String) null));