Module jcifs

Class NtlmAuthenticator

java.lang.Object
org.codelibs.jcifs.smb1.NtlmAuthenticator

public abstract class NtlmAuthenticator extends Object
An abstract class for NTLM authentication in SMB1 protocol. Provides a callback mechanism for retrieving user credentials when authentication is required.
  • Constructor Details

    • NtlmAuthenticator

      protected NtlmAuthenticator()
      Default constructor.
  • Method Details

    • setDefault

      public static void setDefault(NtlmAuthenticator a)
      Set the default NtlmAuthenticator. Once the default authenticator is set it cannot be changed. Calling this metho again will have no effect.
      Parameters:
      a - the authenticator to set as default
    • getRequestingURL

      protected final String getRequestingURL()
      Gets the URL that is requesting authentication.
      Returns:
      the URL requiring authentication
    • getRequestingException

      protected final SmbAuthException getRequestingException()
      Gets the authentication exception that triggered this request.
      Returns:
      the authentication exception
    • requestNtlmPasswordAuthentication

      public static NtlmPasswordAuthentication requestNtlmPasswordAuthentication(String url, SmbAuthException sae)
      Used internally by jCIFS when an SmbAuthException is trapped to retrieve new user credentials.
      Parameters:
      url - the URL that requires authentication
      sae - the authentication exception that was thrown
      Returns:
      credentials returned by prompt or null if none available
    • getNtlmPasswordAuthentication

      protected NtlmPasswordAuthentication getNtlmPasswordAuthentication()
      An application extending this class must provide an implementation for this method that returns new user credentials try try when accessing SMB resources described by the getRequestingURL and getRequestingException methods. If this method returns null the SmbAuthException that triggered the authenticator check will simply be rethrown. The default implementation returns null.
      Returns:
      the authentication credentials or null if none available