Module jcifs

Class NtlmAuthenticator

java.lang.Object
org.codelibs.jcifs.smb.impl.NtlmAuthenticator

public abstract class NtlmAuthenticator extends Object
An abstract class for NTLM authentication. 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
    • getDefault

      public static NtlmAuthenticator getDefault()
      Gets the default NTLM authenticator.
      Returns:
      the default authentication credentials provider
    • 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 NtlmPasswordAuthenticator 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
    • requestNtlmPasswordAuthentication

      public static NtlmPasswordAuthenticator requestNtlmPasswordAuthentication(NtlmAuthenticator a, String url, SmbAuthException sae)
      Requests NTLM password authentication using the specified authenticator.
      Parameters:
      a - the authenticator to use for retrieving credentials
      url - the URL that requires authentication
      sae - the authentication exception that was thrown
      Returns:
      credentials returned by prompt
    • getNtlmPasswordAuthentication

      protected NtlmPasswordAuthenticator 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