Package net.sourceforge.jtds.util
Class SSPIJNIClient
java.lang.Object
net.sourceforge.jtds.util.SSPIJNIClient
A JNI client to SSPI based CPP program (DLL) that returns the user
credentials for NTLM authentication.
The DLL name is ntlmauth.dll.
- Author:
- Magendran Sathaiah (mahi@aztec.soft.net)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
SSPI client initialized flag.private static boolean
SSPI native library loaded flag.private static SSPIJNIClient
Singleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SSPIJNIClient
Returns the singletonSSPIJNIClient
instance.private void
Initializes the SSPI client.void
Calls#initialize()
if the SSPI client is not already inited.byte[]
Calls#prepareSSORequest()
to prepare the NTLM TYPE-1 message.byte[]
invokePrepareSSOSubmit
(byte[] buf) Calls#prepareSSOSubmit(byte[], long)
to prepare the NTLM TYPE-3 message.void
Calls#unInitialize()
if the SSPI client is inited.private byte[]
Prepares the NTLM TYPE-1 message and returns it as abyte[]
.private byte[]
prepareSSOSubmit
(byte[] buf, long size) Prepares the NTLM TYPE-3 message using the current user's credentials.private void
Uninitializes the SSPI client.
-
Field Details
-
thisInstance
Singleton instance. -
libraryLoaded
private static boolean libraryLoadedSSPI native library loaded flag. -
initialized
private boolean initializedSSPI client initialized flag.
-
-
Constructor Details
-
SSPIJNIClient
private SSPIJNIClient()Private constructor for singleton.
-
-
Method Details
-
initialize
private void initialize()Initializes the SSPI client. -
unInitialize
private void unInitialize()Uninitializes the SSPI client. -
prepareSSORequest
private byte[] prepareSSORequest()Prepares the NTLM TYPE-1 message and returns it as abyte[]
. -
prepareSSOSubmit
private byte[] prepareSSOSubmit(byte[] buf, long size) Prepares the NTLM TYPE-3 message using the current user's credentials.It needs the challenge BLOB and it's size as input. The challenge BLOB is nothig but the TYPE-2 message that is received from the SQL Server.
- Parameters:
buf
- challenge BLOBsize
- challenge BLOB size- Returns:
- NTLM TYPE-3 message
-
getInstance
Returns the singletonSSPIJNIClient
instance.- Throws:
SQLException
- if an error occurs during initializationException
-
invokeInitialize
public void invokeInitialize()Calls#initialize()
if the SSPI client is not already inited. -
invokeUnInitialize
public void invokeUnInitialize()Calls#unInitialize()
if the SSPI client is inited. -
invokePrepareSSORequest
Calls#prepareSSORequest()
to prepare the NTLM TYPE-1 message.- Throws:
Exception
- if an error occurs during the call or the SSPI client is uninitialized
-
invokePrepareSSOSubmit
Calls#prepareSSOSubmit(byte[], long)
to prepare the NTLM TYPE-3 message.- Throws:
Exception
- if an error occurs during the call or the SSPI client is uninitialized
-