java.lang.Object
org.codelibs.jcifs.smb.impl.NtlmAuthenticator
An abstract class for NTLM authentication.
Provides a callback mechanism for retrieving user credentials when authentication is required.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NtlmAuthenticatorGets the default NTLM authenticator.protected NtlmPasswordAuthenticatorAn application extending this class must provide an implementation for this method that returns new user credentials try try when accessing SMB resources described by thegetRequestingURLandgetRequestingExceptionmethods.protected final SmbAuthExceptionGets the authentication exception that triggered this request.protected final StringGets the URL that is requesting authentication.static NtlmPasswordAuthenticatorUsed internally by jCIFS when anSmbAuthExceptionis trapped to retrieve new user credentials.static NtlmPasswordAuthenticatorRequests NTLM password authentication using the specified authenticator.static voidSet the defaultNtlmAuthenticator.
-
Constructor Details
-
NtlmAuthenticator
protected NtlmAuthenticator()Default constructor.
-
-
Method Details
-
setDefault
Set the defaultNtlmAuthenticator. 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
Gets the default NTLM authenticator.- Returns:
- the default authentication credentials provider
-
getRequestingURL
Gets the URL that is requesting authentication.- Returns:
- the URL requiring authentication
-
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 anSmbAuthExceptionis trapped to retrieve new user credentials.- Parameters:
url- the URL that requires authenticationsae- 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 credentialsurl- the URL that requires authenticationsae- the authentication exception that was thrown- Returns:
- credentials returned by prompt
-
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 thegetRequestingURLandgetRequestingExceptionmethods. If this method returnsnulltheSmbAuthExceptionthat triggered the authenticator check will simply be rethrown. The default implementation returnsnull.- Returns:
- the authentication credentials or null if none available
-