Class SamlVaadinLogoutSuccessHandler

java.lang.Object
io.jmix.saml.logout.SamlVaadinLogoutSuccessHandler
All Implemented Interfaces:
org.springframework.security.web.authentication.logout.LogoutSuccessHandler

@NullMarked public class SamlVaadinLogoutSuccessHandler extends Object implements org.springframework.security.web.authentication.logout.LogoutSuccessHandler
A LogoutSuccessHandler that issues a SAML 2.0 LogoutRequest to the asserting party and is aware of Vaadin UIDL requests. It is used instead of Saml2RelyingPartyInitiatedLogoutSuccessHandler because:
  • Vaadin AuthenticationContext.logout() invokes the logout success handler within a UIDL (XHR) request where a plain HTTP redirect does not navigate the browser. This handler uses UidlRedirectStrategy which performs a client-side page location change for UIDL requests and falls back to a regular redirect otherwise.
  • Saml2LogoutResponseFilter invokes the logout success handler with null authentication after processing the LogoutResponse from the asserting party. This handler redirects to logoutSuccessUrl in that case instead of responding with 401.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository
     
    protected final org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver
     
    protected String
     
    protected org.springframework.security.web.RedirectStrategy
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SamlVaadinLogoutSuccessHandler(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver logoutRequestResolver)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    createSamlPostRequestFormData(String location, String saml, @Nullable String relayState)
    Renders the same auto-submitting form as Saml2RelyingPartyInitiatedLogoutSuccessHandler does for the POST binding.
    protected void
    doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest)
     
    protected void
    doRedirect(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest)
     
    protected boolean
    isUidlRequest(jakarta.servlet.http.HttpServletRequest request)
     
    void
    onLogoutSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @Nullable org.springframework.security.core.Authentication authentication)
     
    void
    setLogoutRequestRepository(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository logoutRequestRepository)
    Sets the Saml2LogoutRequestRepository for saving the SAML LogoutRequest.
    void
    setLogoutSuccessUrl(String logoutSuccessUrl)
    Sets the URL to redirect to when the SAML LogoutRequest cannot be generated or the single logout has completed.
    void
    setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logoutRequestResolver

      protected final org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver logoutRequestResolver
    • logoutRequestRepository

      protected org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository logoutRequestRepository
    • redirectStrategy

      protected org.springframework.security.web.RedirectStrategy redirectStrategy
    • logoutSuccessUrl

      protected String logoutSuccessUrl
  • Constructor Details

    • SamlVaadinLogoutSuccessHandler

      public SamlVaadinLogoutSuccessHandler(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestResolver logoutRequestResolver)
  • Method Details

    • onLogoutSuccess

      public void onLogoutSuccess(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @Nullable org.springframework.security.core.Authentication authentication) throws IOException
      Specified by:
      onLogoutSuccess in interface org.springframework.security.web.authentication.logout.LogoutSuccessHandler
      Throws:
      IOException
    • setLogoutSuccessUrl

      public void setLogoutSuccessUrl(String logoutSuccessUrl)
      Sets the URL to redirect to when the SAML LogoutRequest cannot be generated or the single logout has completed. The URL is resolved against the servlet context path for regular requests; for UIDL requests it is passed to the browser as is, so use an absolute URL if the application is deployed under a non-root context path.
    • setLogoutRequestRepository

      public void setLogoutRequestRepository(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2LogoutRequestRepository logoutRequestRepository)
      Sets the Saml2LogoutRequestRepository for saving the SAML LogoutRequest. It must match the repository used by Saml2LogoutResponseFilter to validate the LogoutResponse.
    • setRedirectStrategy

      public void setRedirectStrategy(org.springframework.security.web.RedirectStrategy redirectStrategy)
    • doRedirect

      protected void doRedirect(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest) throws IOException
      Throws:
      IOException
    • doPost

      protected void doPost(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.saml2.provider.service.authentication.logout.Saml2LogoutRequest logoutRequest) throws IOException
      Throws:
      IOException
    • isUidlRequest

      protected boolean isUidlRequest(jakarta.servlet.http.HttpServletRequest request)
    • createSamlPostRequestFormData

      protected String createSamlPostRequestFormData(String location, String saml, @Nullable String relayState)
      Renders the same auto-submitting form as Saml2RelyingPartyInitiatedLogoutSuccessHandler does for the POST binding.