Class SamlEnforcedLoginFilter

java.lang.Object
org.exoplatform.container.web.AbstractFilter
org.gatein.sso.agent.filter.api.AbstractSSOInterceptor
org.exoplatform.addons.saml.extensions.SamlEnforcedLoginFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.gatein.sso.agent.filter.api.SSOInterceptor

public class SamlEnforcedLoginFilter extends org.gatein.sso.agent.filter.api.AbstractSSOInterceptor
When the portal login page is kept next to the SAML login (see SamlLoginParamsExtension), this filter enforces the SAML login for the clients whose IP address is listed in gatein.sso.saml.login.enforced.ips. It only acts on anonymous requests of those clients:
  • a request to a route of the portal login handler that takes a local password (/login, /doLogin, and /dologin/ which is not the constrained URL of the SAML valve) is redirected to the SSO URL, as when the portal login page is not kept;
  • on any other request but the logout, the remember-me cookie of a local login is hidden from the portal web application, so that the portal's remember-me filter does not sign the client in without SAML.
The client address is ServletRequest.getRemoteAddr(). The X-Forwarded-For header is never read here because a client can forge it: behind a reverse proxy, configure the Tomcat RemoteIpValve so that the remote address is the real client one, and trust only your proxies (internalProxies). An address that cannot be parsed is enforced.

Not covered, because they are other web applications or other login modules that read the raw request: the HTTP Basic and Digest authentication of the REST and WebDAV web applications (which also give a portal session through Tomcat's single sign-on valve, and in which the JAAS remember-me login module still honours a remember-me cookie sent with any password), and the remember-me cookie on the REST endpoints of the Spring-based web applications.

  • Field Summary

    Fields inherited from class org.gatein.sso.agent.filter.api.AbstractSSOInterceptor

    PORTAL_CONTAINER_SUBSTITUTION_PATTERN

    Fields inherited from class org.exoplatform.container.web.AbstractFilter

    config, servletContextName
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    doFilter(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, jakarta.servlet.FilterChain filterChain)
     
    protected void
     
    protected boolean
    isEnforced(jakarta.servlet.http.HttpServletRequest request)
     

    Methods inherited from class org.gatein.sso.agent.filter.api.AbstractSSOInterceptor

    afterInit, getExoContainer, getInitParameter, initWithParams

    Methods inherited from class org.exoplatform.container.web.AbstractFilter

    getContainer, getServletContext, init, requirePortalEnvironment

    Methods inherited from class Object

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

    Methods inherited from interface jakarta.servlet.Filter

    init
  • Constructor Details

    • SamlEnforcedLoginFilter

      public SamlEnforcedLoginFilter()
  • Method Details

    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest servletRequest, jakarta.servlet.ServletResponse servletResponse, jakarta.servlet.FilterChain filterChain) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • destroy

      public void destroy()
    • initImpl

      protected void initImpl()
      Specified by:
      initImpl in class org.gatein.sso.agent.filter.api.AbstractSSOInterceptor
    • isEnforced

      protected boolean isEnforced(jakarta.servlet.http.HttpServletRequest request)