Class AuthenticatingFilter

java.lang.Object
org.apache.shiro.web.servlet.ServletContextSupport
org.apache.shiro.web.servlet.AbstractFilter
org.apache.shiro.web.servlet.NameableFilter
org.apache.shiro.web.servlet.OncePerRequestFilter
org.apache.shiro.web.servlet.AdviceFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.apache.shiro.lang.util.Nameable
Direct Known Subclasses:
AnonymousFilter, BasicHttpAuthenticationFilter, CasFilter, FormAuthenticationFilter

public abstract class AuthenticatingFilter extends AuthenticationFilter
An AuthenticationFilter that is capable of automatically performing an authentication attempt based on the incoming request.
Since:
0.4.0
  • Constructor Details

  • Method Details

    • executeLogin

      protected boolean executeLogin(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws Exception
      Throws:
      Exception
    • createToken

      protected abstract org.apache.shiro.authc.AuthenticationToken createToken(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws Exception
      Throws:
      Exception
    • createToken

      protected org.apache.shiro.authc.AuthenticationToken createToken(String username, String password, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response)
    • createToken

      protected org.apache.shiro.authc.AuthenticationToken createToken(String username, String password, boolean rememberMe, String host)
    • onLoginSuccess

      protected boolean onLoginSuccess(org.apache.shiro.authc.AuthenticationToken token, org.apache.shiro.subject.Subject subject, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws Exception
      Throws:
      Exception
    • onLoginFailure

      protected boolean onLoginFailure(org.apache.shiro.authc.AuthenticationToken token, org.apache.shiro.authc.AuthenticationException e, jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response)
    • getHost

      protected String getHost(jakarta.servlet.ServletRequest request)
      Returns the host name or IP associated with the current subject. This method is primarily provided for use during construction of an AuthenticationToken.

      The default implementation merely returns ServletRequest.getRemoteHost().

      Parameters:
      request - the incoming ServletRequest
      Returns:
      the InetAddress to associate with the login attempt.
    • isRememberMe

      protected boolean isRememberMe(jakarta.servlet.ServletRequest request)
      Returns true if "rememberMe" should be enabled for the login attempt associated with the current request, false otherwise.

      This implementation always returns false and is provided as a template hook to subclasses that support rememberMe logins and wish to determine rememberMe in a custom mannner based on the current request.

      Parameters:
      request - the incoming ServletRequest
      Returns:
      true if "rememberMe" should be enabled for the login attempt associated with the current request, false otherwise.