java.lang.Object
org.codelibs.jcifs.smb1.SmbSession
The SmbSession class represents an SMB session established with a server.
It provides methods for authentication and session management.
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Retrieves the NTLM challenge from the specified domain controller.static byte[]getChallenge(UniAddress dc, int port) Retrieves the NTLM challenge from the specified domain controller using the specified port.static NtlmChallengeRetrieves an NTLM challenge from a domain controller for the configured domain.static voidlogon(UniAddress dc, int port, NtlmPasswordAuthentication auth) Authenticate arbitrary credentials against the specified domain controller using the specified port.static voidlogon(UniAddress dc, NtlmPasswordAuthentication auth) Authenticate arbitrary credentials represented by theNtlmPasswordAuthenticationobject against the domain controller specified by theUniAddressparameter.toString()
-
Method Details
-
getChallengeForDomain
Retrieves an NTLM challenge from a domain controller for the configured domain.- Returns:
- the NTLM challenge from the domain controller
- Throws:
SmbException- if an SMB error occursUnknownHostException- if the domain controller cannot be resolved
-
getChallenge
Retrieves the NTLM challenge from the specified domain controller.- Parameters:
dc- the domain controller address- Returns:
- the NTLM challenge bytes
- Throws:
SmbException- if an SMB error occursUnknownHostException- if the host cannot be resolved
-
getChallenge
public static byte[] getChallenge(UniAddress dc, int port) throws SmbException, UnknownHostException Retrieves the NTLM challenge from the specified domain controller using the specified port.- Parameters:
dc- the domain controller addressport- the port to connect to- Returns:
- the NTLM challenge bytes
- Throws:
SmbException- if an SMB error occursUnknownHostException- if the host cannot be resolved
-
logon
Authenticate arbitrary credentials represented by theNtlmPasswordAuthenticationobject against the domain controller specified by theUniAddressparameter. If the credentials are not accepted, anSmbAuthExceptionwill be thrown. If an error occurs anSmbExceptionwill be thrown. If the credentials are valid, the method will return without throwing an exception. See the last FAQ question.See also the
org.codelibs.jcifs.smb1.smb1.client.logonShareproperty.- Parameters:
dc- the domain controller to authenticate againstauth- the authentication credentials- Throws:
SmbException- if authentication fails or an SMB error occurs
-
logon
public static void logon(UniAddress dc, int port, NtlmPasswordAuthentication auth) throws SmbException Authenticate arbitrary credentials against the specified domain controller using the specified port.- Parameters:
dc- the domain controller to authenticate againstport- the port to connect toauth- the authentication credentials- Throws:
SmbException- if authentication fails or an SMB error occurs
-
toString
-