Client-Side Authentication
Authentication is used only if a password is supplied when creating a session to the server.
The only supported client authentication mechanism is nSaslMechanism.PLAIN regardless of whether the client sets the mechanism explicity or not. PLAIN transmits the user password in plain text, so it is recommended to use it only over an SSL connection. You can explicity set the PLAIN mechanism by using the nSessionAttributes class, which creates a session as follows:
nSessionAttributes:
public void setSASLMechPrefs(nSaslMechanism[] mechPrefs)
Note that this method is unavailable to clients using a reactive session. In this case, you
can specify the authentication mechanism only by setting the environment variable
Nirvana.sasl.client.mechanism
to PLAIN
.
Setting the preferred authentication mechanism via API
In order to supply credentials to the API, Universal Messaging offers a number of additions to the standard constructors and factory methods. Either the username and password can be supplied independently as a String and a SecureString (inbuilt in .NET in System.Security), respectively, or in some cases both can be supplied together inside a NetworkCredentials object (inbuilt in .NET in System.Net).
Thus you have the following API additions:
Client Sessions:
public static nSession create(nSessionAttributes sAttr,
String username, SecureString password)
public static nSession create(nSessionAttributes sAttr,
NetworkCredentials creds)
public static nSession create(nSessionAttributes sAttr,
nReconnectHandler handler, String username, SecureString password)
public static nSession create(nSessionAttributes sAttr,
nReconnectHandler handler, NetworkCredentials creds)
public static nSession createMultiplexed(nSessionAttributes sAttr,
String username, SecureString password)
public static nSession createMultiplexed(nSessionAttributes sAttr,
NetworkCredentials creds)
public static nSession createMultiplexed(nSession session,
String username, SecureString password)
public static nSession createMultiplexed(nSession session,
NetworkCredentials creds)
Reactive Sessions:
string Username { get; set; }
SecureString Password { get; set; }
NetworkCredentials Credentials { get; set; }