net.sourceforge.jtds.util

Class SSPIJNIClient


public class SSPIJNIClient
extends java.lang.Object

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

private boolean
initialized
SSPI client initialized flag.
private static boolean
libraryLoaded
SSPI native library loaded flag.
private static SSPIJNIClient
thisInstance
Singleton instance.

Constructor Summary

SSPIJNIClient()
Private constructor for singleton.

Method Summary

static SSPIJNIClient
getInstance()
Returns the singleton SSPIJNIClient instance.
private void
initialize()
Initializes the SSPI client.
void
invokeInitialize()
Calls #initialize() if the SSPI client is not already inited.
byte[]
invokePrepareSSORequest()
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
invokeUnInitialize()
Calls #unInitialize() if the SSPI client is inited.
private byte[]
prepareSSORequest()
Prepares the NTLM TYPE-1 message and returns it as a byte[].
private byte[]
prepareSSOSubmit(byte[] buf, long size)
Prepares the NTLM TYPE-3 message using the current user's credentials.
private void
unInitialize()
Uninitializes the SSPI client.

Field Details

initialized

private boolean initialized
SSPI client initialized flag.

libraryLoaded

private static boolean libraryLoaded
SSPI native library loaded flag.

thisInstance

private static SSPIJNIClient thisInstance
Singleton instance.

Constructor Details

SSPIJNIClient

private SSPIJNIClient()
Private constructor for singleton.

Method Details

getInstance

public static SSPIJNIClient getInstance()
            throws Exception
Returns the singleton SSPIJNIClient instance.

initialize

private void initialize()
Initializes the SSPI client.

invokeInitialize

public void invokeInitialize()
Calls #initialize() if the SSPI client is not already inited.

invokePrepareSSORequest

public byte[] invokePrepareSSORequest()
            throws Exception
Calls #prepareSSORequest() to prepare the NTLM TYPE-1 message.

invokePrepareSSOSubmit

public byte[] invokePrepareSSOSubmit(byte[] buf)
            throws Exception
Calls #prepareSSOSubmit(byte[], long) to prepare the NTLM TYPE-3 message.

invokeUnInitialize

public void invokeUnInitialize()
Calls #unInitialize() if the SSPI client is inited.

prepareSSORequest

private byte[] prepareSSORequest()
Prepares the NTLM TYPE-1 message and returns it as a byte[].

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 BLOB
size - challenge BLOB size
Returns:
NTLM TYPE-3 message

unInitialize

private void unInitialize()
Uninitializes the SSPI client.

Generated on September 18 2009