Skip to content

Commit 4c245d9

Browse files
committed
Polish Session Logout Support
Issue gh-13841
1 parent 05cb2a0 commit 4c245d9

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/client/OidcLogoutConfigurer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ public BackChannelLogoutConfigurer logoutUri(String logoutUri) {
227227
*
228228
* <p>
229229
* By default, the URI is set to
230-
* {@code {baseScheme}://localhost{basePort}/logout/connect/back-channel/{registrationId}},
231-
* which is simply an internal version of the same endpoint exposed to your
232-
* Back-Channel services. You can use {@link SessionLogoutConfigurer#logoutUri} to
233-
* alter the scheme, server name, or port in the {@code Host} header to
234-
* accommodate how your application would address itself internally.
230+
* {@code {baseUrl}/logout/connect/back-channel/{registrationId}}, which is simply
231+
* an internal version of the same endpoint exposed to your Back-Channel services.
232+
* You can use {@link SessionLogoutConfigurer#logoutUri} to alter the scheme,
233+
* server name, or port in the {@code Host} header to accommodate how your
234+
* application would address itself internally.
235235
*
236236
* <p>
237237
* For example, if the way your application would internally call itself is on a
@@ -308,7 +308,7 @@ public void logout(HttpServletRequest request, HttpServletResponse response,
308308
*/
309309
public final class SessionLogoutConfigurer {
310310

311-
private String logoutUri = "{baseScheme}://localhost{basePort}/logout/connect/back-channel/{registrationId}";
311+
private String logoutUri = "{baseUrl}/logout/connect/back-channel/{registrationId}";
312312

313313
private String cookieName = "JSESSIONID";
314314

config/src/main/java/org/springframework/security/config/web/server/ServerHttpSecurity.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import org.springframework.security.authorization.ObservationReactiveAuthorizationManager;
5959
import org.springframework.security.authorization.ReactiveAuthorizationManager;
6060
import org.springframework.security.config.Customizer;
61-
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OidcLogoutConfigurer;
6261
import org.springframework.security.core.Authentication;
6362
import org.springframework.security.core.GrantedAuthority;
6463
import org.springframework.security.core.authority.AuthorityUtils;
@@ -5536,8 +5535,7 @@ private ServerLogoutHandler logoutHandler() {
55365535
* that the scheme, server name, or port in the {@code Host} header are
55375536
* different from how you would address the same server internally.
55385537
* @param logoutUri the URI to request logout on the back-channel
5539-
* @return the {@link OidcLogoutConfigurer.BackChannelLogoutConfigurer} for
5540-
* further customizations
5538+
* @return the {@link BackChannelLogoutConfigurer} for further customizations
55415539
* @since 6.2.4
55425540
* @deprecated Please use {@link #sessionLogout} instead
55435541
*/
@@ -5610,8 +5608,7 @@ public BackChannelLogoutConfigurer logoutUri(String logoutUri) {
56105608
* </pre>
56115609
* @param sessionLogout a {@link Customizer} for configuring how to log out of
56125610
* each individual session
5613-
* @return {@link OidcLogoutConfigurer.BackChannelLogoutConfigurer} for
5614-
* further customizations
5611+
* @return {@link BackChannelLogoutConfigurer} for further customizations
56155612
* @since 6.4
56165613
*/
56175614
public BackChannelLogoutConfigurer sessionLogout(Customizer<SessionLogoutConfigurer> sessionLogout) {
@@ -5670,7 +5667,7 @@ public Mono<Void> logout(WebFilterExchange exchange, Authentication authenticati
56705667
*/
56715668
public final class SessionLogoutConfigurer {
56725669

5673-
private String logoutUri = "{baseScheme}://localhost{basePort}/logout/connect/back-channel/{registrationId}";
5670+
private String logoutUri = "{baseUrl}/logout/connect/back-channel/{registrationId}";
56745671

56755672
private String cookieName = "SESSION";
56765673

@@ -5696,9 +5693,7 @@ private SessionLogoutConfigurer() {
56965693
* different logout endpoint, like the Spring Security logout endpoint:
56975694
* {@code {baseScheme}://localhost{basePort}/logout}.
56985695
* @param uri the URI to invoke to log out specific sessions
5699-
* @return the
5700-
* {@link OidcLogoutConfigurer.BackChannelLogoutConfigurer.SessionLogoutConfigurer}
5701-
* for further customizations
5696+
* @return the {@link SessionLogoutConfigurer} for further customizations
57025697
*/
57035698
public SessionLogoutConfigurer uri(String uri) {
57045699
this.logoutUri = uri;
@@ -5715,9 +5710,7 @@ public SessionLogoutConfigurer uri(String uri) {
57155710
* <p>
57165711
* When using Spring Session, you may need to set this to {@code SESSION}
57175712
* @param cookieName the cookie name to use
5718-
* @return the
5719-
* {@link OidcLogoutConfigurer.BackChannelLogoutConfigurer.SessionLogoutConfigurer}
5720-
* for further customizations
5713+
* @return the {@link SessionLogoutConfigurer} for further customizations
57215714
*/
57225715
public SessionLogoutConfigurer cookieName(String cookieName) {
57235716
this.cookieName = cookieName;

0 commit comments

Comments
 (0)