SSPIJNIClient (jTDS API)
Date: 2013-06-08

net.sourceforge.jtds.util

## Class SSPIJNIClient

- java.lang.Object
- - net.sourceforge.jtds.util.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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `initialized` SSPI client initialized flag.
    `private static boolean` | `libraryLoaded` SSPI native library loaded flag.
    `private static SSPIJNIClient` | `thisInstance` Singleton instance.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `SSPIJNIClient()` Private constructor for singleton.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### thisInstance

          private static SSPIJNIClient thisInstance

      Singleton instance.

    - #### libraryLoaded

          private static boolean libraryLoaded

      SSPI native library loaded flag.

    - #### initialized

          private boolean initialized

      SSPI client initialized flag.

  - ### Constructor Detail

    - #### SSPIJNIClient

          private SSPIJNIClient()

      Private constructor for singleton.

  - ### Method Detail

    - #### 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 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

    - #### getInstance

          public static SSPIJNIClient getInstance()
                                           throws java.lang.Exception

      Returns the singleton `SSPIJNIClient` instance.
      Throws:
        `java.sql.SQLException` - if an error occurs during initialization
        `java.lang.Exception`

    - #### 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

          public byte[] invokePrepareSSORequest()
                                         throws java.lang.Exception

      Calls `#prepareSSORequest()` to prepare the NTLM TYPE-1 message.
      Throws:
        `java.lang.Exception` - if an error occurs during the call or the SSPI client is uninitialized

    - #### invokePrepareSSOSubmit

          public byte[] invokePrepareSSOSubmit(byte[] buf)
                                        throws java.lang.Exception

      Calls `#prepareSSOSubmit(byte[], long)` to prepare the NTLM TYPE-3 message.
      Throws:
        `java.lang.Exception` - if an error occurs during the call or the SSPI client is uninitialized

Generated on June 8 2013