Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify OIDC Back-Channel Logout DSL (Closes gh-15817) #16698

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alswp006
Copy link

@alswp006 alswp006 commented Mar 6, 2025

Currently, OIDC Back-Channel Logout is configured with a nested DSL: This nested structure makes the DSL less navigable. To improve clarity and consistency with other logout DSLs (such as logout() and saml2Logout()), we introduce a new top-level DSL method:

Changes in this PR

  • HttpSecurity Modification:
    A new method oidcBackChannelLogout(Customizer<OidcLogoutConfigurer>) has been added to HttpSecurity. This method internally creates an OidcLogoutConfigurer and applies the default back-channel configuration, thereby simplifying the DSL.
  • OidcLogoutConfigurer Modification:
    The existing backChannel(Customizer) method is now marked as deprecated with: Its JavaDoc has been updated to recommend using the new DSL method oidcBackChannelLogout(Customizer.withDefaults()) instead.
  • Testing:
    A new test method, oidcBackChannelLogoutWhenDefaultsThenRemotelyInvalidatesSessions(), has been added to verify that when using the new DSL, the OIDC Back-Channel Logout filter is properly registered and that sessions are invalidated as expected.

Related

Closes gh-15817

- Introduced a new HttpSecurity method: oidcBackChannelLogout(Customizer.withDefaults())
  to simplify OIDC Back-Channel Logout configuration.
- Modified OidcLogoutConfigurer: marked backChannel(Customizer<...>) as deprecated
  (since 6.2, forRemoval = true) and updated its JavaDoc to recommend using
  the new DSL method.
- Added tests (oidcBackChannelLogoutWhenDefaultsThenRemotelyInvalidatesSessions) to verify
  that the new DSL correctly registers OidcBackChannelLogoutFilter and invalidates sessions.

Closes spring-projectsgh-15817
Signed-off-by: Minje Kim <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 6, 2025
Copy link
Contributor

@jzheaux jzheaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @alswp006! In addition to my inline feedback, will you please update the OIDC logout documentation to use the new method?

When you are ready, please squash your commitz and have its message look similar to this:

Add oidcBackChannelLogout

Closes gh-15817

import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave the import statements as-is.

@@ -2870,6 +2844,14 @@ public HttpSecurity oidcLogout(Customizer<OidcLogoutConfigurer<HttpSecurity>> oi
return HttpSecurity.this;
}

public HttpSecurity oidcBackChannelLogout(Customizer<OidcLogoutConfigurer<HttpSecurity>> oidcBackChannelLogoutCustomizer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add JavaDoc so folks can read how to use the method. Please make sure the JavaDoc includes @since 6.5.

*/
@Deprecated(since = "6.2", forRemoval = true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the since value to 6.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider removing one level of the OIDC Backchannel Logout DSL
3 participants