Module jcifs

Class NtlmHttpFilter

java.lang.Object
org.codelibs.jcifs.smb1.http.NtlmHttpFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class NtlmHttpFilter extends Object implements jakarta.servlet.Filter
An HTTP servlet filter that provides NTLM authentication support for SMB1 protocol. This filter allows web applications to authenticate users via NTLM/Windows authentication.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
    This method simply calls negotiate( req, resp, false ) and then chain.doFilter.
    jakarta.servlet.FilterConfig
    Gets the filter configuration.
    void
    init(jakarta.servlet.FilterConfig filterConfig)
     
    negotiate(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp, boolean skipAuthentication)
    Negotiate password hashes with MSIE clients using NTLM SSP
    void
    setFilterConfig(jakarta.servlet.FilterConfig f)
    Sets the filter configuration for WebLogic 6.1 compatibility.

    Methods inherited from class java.lang.Object

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

    • NtlmHttpFilter

      public NtlmHttpFilter()
      Default constructor.
  • Method Details

    • init

      public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Filter
      Throws:
      jakarta.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter
    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
      This method simply calls negotiate( req, resp, false ) and then chain.doFilter. You can override and call negotiate manually to achive a variety of different behavior.
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Throws:
      IOException
      jakarta.servlet.ServletException
    • negotiate

      protected NtlmPasswordAuthentication negotiate(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp, boolean skipAuthentication) throws IOException, jakarta.servlet.ServletException
      Negotiate password hashes with MSIE clients using NTLM SSP
      Parameters:
      req - The servlet request
      resp - The servlet response
      skipAuthentication - If true the negotiation is only done if it is initiated by the client (MSIE post requests after successful NTLM SSP authentication). If false and the user has not been authenticated yet the client will be forced to send an authentication (server sends HttpServletResponse.SC_UNAUTHORIZED).
      Returns:
      True if the negotiation is complete, otherwise false
      Throws:
      IOException - if an I/O error occurs
      jakarta.servlet.ServletException - if a servlet error occurs
    • setFilterConfig

      public void setFilterConfig(jakarta.servlet.FilterConfig f)
      Sets the filter configuration for WebLogic 6.1 compatibility.
      Parameters:
      f - the filter configuration to set
    • getFilterConfig

      public jakarta.servlet.FilterConfig getFilterConfig()
      Gets the filter configuration.
      Returns:
      the filter configuration or null