Class AuthenticationFilter

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
org.tynamo.security.shiro.AccessControlFilter
org.tynamo.security.shiro.authc.AuthenticationFilter
All Implemented Interfaces:
jakarta.servlet.Filter, org.apache.shiro.lang.util.Nameable
Direct Known Subclasses:
AuthenticatingFilter

public abstract class AuthenticationFilter extends AccessControlFilter
Base class for all Filters that require the current user to be authenticated. This class encapsulates the logic of checking whether a user is already authenticated in the system while subclasses are required to perform specific logic for unauthenticated requests.
Since:
0.9
  • Constructor Details

  • Method Details

    • isAccessAllowed

      protected boolean isAccessAllowed(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, Object mappedValue)
      Determines whether the current subject is authenticated.

      The default implementation acquires the currently executing Subject and then returns subject.isAuthenticated();

      Specified by:
      isAccessAllowed in class AccessControlFilter
      Parameters:
      request - the incoming ServletRequest
      response - the outgoing ServletResponse
      mappedValue - the filter-specific config value mapped to this filter in the URL rules mappings.
      Returns:
      true if the subject is authenticated; false if the subject is unauthenticated
    • issueSuccessRedirect

      protected void issueSuccessRedirect(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response) throws Exception
      Redirects to user to the previously attempted URL after a successful login. This implementation simply calls WebUtils.WebUtils.redirectToSavedRequest(ServletRequest, ServletResponse, String) redirectToSavedRequest} using the successUrl as the fallbackUrl argument to that call.
      Parameters:
      request - the incoming request
      response - the outgoing response
      Throws:
      Exception - if there is a problem redirecting.