com.linar.jintegra
Class AuthInfo

java.lang.Object
  extended by com.linar.jintegra.AuthInfo

public class AuthInfo
extends java.lang.Object

This class represents information used to authenticate a user. Set the authentication to be used throughout by all threads in the JVM using AuthInfo.setDefault(...) and for the current thread using AuthInfo.setThreadDefault(...); Note that passwords are not stored in instances of this class.

You can also use this class to find out the NT Domain/User of COM clients invoking methods in your Java objects.

For more information, please see Configuring DCOM for Remote Access.


Field Summary
static int IMP_LEVEL_DELEGATE
          Delegate level impersonation.
static int IMP_LEVEL_IDENTIFY
          Identify level impersonation.
static int IMP_LEVEL_IMPERSONATE
          Impersonate level impersonation.
 
Constructor Summary
AuthInfo(java.lang.String domain, java.lang.String user, java.lang.String password)
          Constructs an AuthInfo instance representing the specified domain, user, and password.
AuthInfo(java.lang.String domain, java.lang.String user, java.lang.String password, int impLevel)
          Constructs an AuthInfo instance representing the specified domain, user, password, and authentication level.
 
Method Summary
 void disableLmResponse()
          Disables the sending of Lan Manager(LM) Challenge response when using this AuthInfo instance to connect to a remote COM Component.
 boolean equals(java.lang.Object obj)
           
static java.lang.String getCallerDomain()
          Returns the NT Domain of the COM client that initiated the current call into a Java object.
static java.lang.String getCallerUser()
          Returns the NT User name of the COM client that initiated the current call into a Java object.
 int hashCode()
           
static boolean isCallerAuthenticated()
          Indicates whether J-Integra® was able to authenticate the domain/username of the COM client that is invoking a method in a Java object.
static void setDefault(AuthInfo authInfo)
          Sets the authentification to be used by default if none is specified when creating or using a COM component.
static void setDefault(java.lang.String domain, java.lang.String user, java.lang.String password)
          Sets the authentification to be used by default if none is specified when creating or using a COM component.
static void setDefaultImpLevel(int impLevel)
          Sets the default impersonation level to be used.
static void setThreadDefault(AuthInfo authInfo)
          Sets the authentification to be used by default if none is specified when creating or using a COM component from this thread.
static void setThreadDefault(java.lang.String domain, java.lang.String user, java.lang.String password)
          Sets the authentification to be used by default if none is specified when creating or using a COM component from this thread.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

IMP_LEVEL_IDENTIFY

public static final int IMP_LEVEL_IDENTIFY
Identify level impersonation. Servers can identify clients that connect using this level of authentication

See Also:
Constant Field Values

IMP_LEVEL_IMPERSONATE

public static final int IMP_LEVEL_IMPERSONATE
Impersonate level impersonation. Servers can impersonate clients that connect using this level of authentication

See Also:
Constant Field Values

IMP_LEVEL_DELEGATE

public static final int IMP_LEVEL_DELEGATE
Delegate level impersonation. Servers can allow others to impersonate clients that connect using this level of authentication

See Also:
Constant Field Values
Constructor Detail

AuthInfo

public AuthInfo(java.lang.String domain,
                java.lang.String user,
                java.lang.String password)
Constructs an AuthInfo instance representing the specified domain, user, and password. IMP_LEVEL_IDENTIFY impersonation will be used.

Parameters:
domain - the domain to be used when authenticating using this AuthInfo instance
user - the user to be used when authenticating using this AuthInfo instance
password - the password to be used when authenticating using this AuthInfo instance

AuthInfo

public AuthInfo(java.lang.String domain,
                java.lang.String user,
                java.lang.String password,
                int impLevel)
         throws java.lang.RuntimeException
Constructs an AuthInfo instance representing the specified domain, user, password, and authentication level.

Parameters:
domain - the domain to be used when authenticating using this AuthInfo instance
user - the user to be used when authenticating using this AuthInfo instance
password - the password to be used when authenticating using this AuthInfo instance
impLevel - the impersonation level to be used when authenticating using this AuthInfo instance
Throws:
java.lang.RuntimeException - if an instance of AuthInfo is created in Native Mode
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

disableLmResponse

public void disableLmResponse()
Disables the sending of Lan Manager(LM) Challenge response when using this AuthInfo instance to connect to a remote COM Component. Only the NT Challenge response will be sent.

Use this method if you are concerned about weaknesses of the LM Challenge response mechanism, and if you are sure that the AuthInfo instance will only be used to connect to hosts that support NT Challenge Response (such as Windows NT). Windows 95 does not support NT challenge response, so do not call this method if making authenticated connections to servers running under Windows 95.


setDefault

public static void setDefault(AuthInfo authInfo)
Sets the authentification to be used by default if none is specified when creating or using a COM component.

Parameters:
authInfo - the authentication to be used.

setThreadDefault

public static void setThreadDefault(AuthInfo authInfo)
Sets the authentification to be used by default if none is specified when creating or using a COM component from this thread.

Parameters:
authInfo - the authentication to be used.

getCallerDomain

public static java.lang.String getCallerDomain()
Returns the NT Domain of the COM client that initiated the current call into a Java object.

Returns:
the domain name, or null if this information could not be ascertained

getCallerUser

public static java.lang.String getCallerUser()
Returns the NT User name of the COM client that initiated the current call into a Java object.

Returns:
the user name, or null if this information could not be ascertained

isCallerAuthenticated

public static boolean isCallerAuthenticated()
Indicates whether J-Integra® was able to authenticate the domain/username of the COM client that is invoking a method in a Java object. In order for J-Integra® to attempt to perform such authentication, you must set the JINTEGRA_NTAUTH_HOST property to the IP name of a NT machine that J-Integra® can authenticate against.

Returns:
true if the domain/user were authenticated, false otherwise.

setDefaultImpLevel

public static void setDefaultImpLevel(int impLevel)
Sets the default impersonation level to be used.

Parameters:
impLevel - the impersonation level to be used by default

setDefault

public static void setDefault(java.lang.String domain,
                              java.lang.String user,
                              java.lang.String password)
Sets the authentification to be used by default if none is specified when creating or using a COM component. IMP_LEVEL_IDENTIFY impersonation will be used.

Parameters:
domain - the domain to be used when authenticating using default authentification
user - the user to be used when authenticating using default authentification
password - the password to be used when authenticating using default authentification

setThreadDefault

public static void setThreadDefault(java.lang.String domain,
                                    java.lang.String user,
                                    java.lang.String password)
Sets the authentification to be used by default if none is specified when creating or using a COM component from this thread. IMP_LEVEL_IDENTIFY impersonation will be used.

Parameters:
domain - the domain to be used when authenticating using default authentification
user - the user to be used when authenticating using default authentification
password - the password to be used when authenticating using default authentification

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object