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 booleanSSPI client initialized flag.private static booleanSSPI native library loaded flag.private static SSPIJNIClientSingleton instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SSPIJNIClientReturns the singletonSSPIJNIClientinstance.private voidInitializes the SSPI client.voidCalls#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.voidCalls#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 voidUninitializes 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 singletonSSPIJNIClientinstance.- 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
-