Class HybridSAML2LogoutFilter

java.lang.Object
org.picketlink.identity.federation.web.filters.SPFilter
org.gatein.sso.saml.plugin.filter.SAML2LogoutFilter
org.exoplatform.addons.saml.extensions.HybridSAML2LogoutFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.gatein.sso.agent.filter.api.SSOInterceptor

public class HybridSAML2LogoutFilter extends org.gatein.sso.saml.plugin.filter.SAML2LogoutFilter
A SAML2LogoutFilter that only starts the SAML logout (redirection to the IDP) for users that were authenticated through SAML.

When the portal login page is kept next to the SAML login (see SamlLoginParamsExtension), some users sign in with a local password: they have no session at the IDP, so the SAML logout workflow would end on a blank page and leave the session half logged out. Those users get the regular portal logout instead.

A session counts as a SAML one through the marker the SAML workflow writes in the portal session, or through the SamlPrincipal of the user when the valve of the add-on (SamlServiceProviderAuthenticator) is configured. Known limit without that valve: when the portal session expires while the user keeps a session in another web application (REST, WebDAV), Tomcat's single sign-on valve signs the user back in to a new portal session that has no marker: that user then gets the regular portal logout, and the session at the IDP stays open, so the next SAML login needs no password.

Configure it with gatein.sso.filter.logout.class=org.exoplatform.addons.saml.extensions.HybridSAML2LogoutFilter

  • Field Summary

    Fields inherited from class org.gatein.sso.saml.plugin.filter.SAML2LogoutFilter

    config, COOKIE_NAME, OAUTH_COOKIE_NAME, SAML_LOGOUT_ATTRIBUTE, servletContextName

    Fields inherited from class org.picketlink.identity.federation.web.filters.SPFilter

    auditHelper, canonicalizationMethod, chainLock, CHARACTER_ENCODING, configFile, configProvider, CONFIGURATION_PROVIDER, DESIRED_IDP, identityURL, idpMetadata, ignoreSignatures, ISSUER_ID, issuerID, logger, picketLinkConfiguration, SAML_HANDLER_CHAIN_CLASS, samlHandlerChainClass, serviceURL, spConfiguration
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    delegateToSamlLogout(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, jakarta.servlet.FilterChain filterChain)
    The SAML logout workflow of the parent filter (redirection to the IDP).
    void
    doFilter(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, jakarta.servlet.FilterChain filterChain)
     
    static boolean
    isSamlSession(jakarta.servlet.http.HttpServletRequest request)
     

    Methods inherited from class org.gatein.sso.saml.plugin.filter.SAML2LogoutFilter

    getInitParameter, getServletContext, init, initImpl, initWithParams, isPortalLogoutInProgress, isSAMLLogoutInProgress, requirePortalEnvironment

    Methods inherited from class org.picketlink.identity.federation.web.filters.SPFilter

    destroy, doSupportSignature, getBinding, getIdentityURL, getIdpMetadataFromFile, getIDPSSODescriptor, handleMetadata, handleMetadata, handleSAML11UnsolicitedResponse, initializeHandlerChain, initKeyProvider, isHttpPostBinding, localAuthentication, populateChainConfig, processConfiguration, sendHttpPostBindingRequest, sendHttpRedirectRequest, sendRequestToIDP, sendToDestination, sendToLogoutPage, validate

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface jakarta.servlet.Filter

    destroy
  • Constructor Details

    • HybridSAML2LogoutFilter

      public HybridSAML2LogoutFilter()
  • Method Details

    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, jakarta.servlet.FilterChain filterChain) throws IOException, jakarta.servlet.ServletException
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Overrides:
      doFilter in class org.gatein.sso.saml.plugin.filter.SAML2LogoutFilter
      Throws:
      IOException
      jakarta.servlet.ServletException
    • delegateToSamlLogout

      protected void delegateToSamlLogout(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, jakarta.servlet.FilterChain filterChain) throws IOException, jakarta.servlet.ServletException
      The SAML logout workflow of the parent filter (redirection to the IDP). Also called for the requests that are not a logout, which it passes on.
      Parameters:
      servletRequest - current request
      servletResponse - current response
      filterChain - the filter chain
      Throws:
      IOException - on an I/O error
      jakarta.servlet.ServletException - on a servlet error
    • isSamlSession

      public static boolean isSamlSession(jakarta.servlet.http.HttpServletRequest request)
      Parameters:
      request - current request
      Returns:
      true when the user signed in through the SAML workflow (the principal is a SamlPrincipal, or the session was opened by the workflow), or when its SAML logout is already in progress