*** This class provides Binary Compatibility only, not Source Compatibility ***
Package com.sas.services.connection
Class PasswordCredential
java.lang.Object
com.sas.services.connection.Credential
com.sas.services.connection.PasswordCredential
- All Implemented Interfaces:
Serializable,Cloneable
Login credentials for an IOM server.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPasswordCredential(String domain) Constructor used by thenewInstance()methods and subclasses.PasswordCredential(String userName, String password) Construct login credentials.PasswordCredential(String userName, String password, String domain) Construct login credentials. -
Method Summary
Modifier and TypeMethodDescriptionbooleanequals(Object that) StringGet the password.char[]Get the password as a character array.com.sas.net.crypto.SealedStringGet the password as aSealedStringobject.StringGet the user name.inthashCode()static PasswordCredentialnewInstance(String userName, char[] passwordAsChars, String domain) Create a new instance of this class using a character array for the password.static PasswordCredentialnewInstance(String userName, com.sas.net.crypto.SealedString passwordAsSealedString, String domain) Create a new instance of this class using aSealedStringfor the password.voidsetPassword(String password) Set the password.voidsetPasswordAsChars(char[] passwordAsChars) Set the password as a character array.voidsetPasswordAsSealedString(com.sas.net.crypto.SealedString passwordAsSealedString) Set the password as aSealedStringobject.voidsetUserName(String userName) Set the user name.StringtoString()Methods inherited from class com.sas.services.connection.Credential
clone, getDomain, getLocale, setDomain, setLocaleMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
PasswordCredential
public PasswordCredential(String userName, String password, String domain) Construct login credentials. This is not the preferred way of constructing an instance of this class. If possible, use one of thenewInstance()methods instead for improved security.- Parameters:
userName- the user namepassword- the passworddomain- the authentication domain. The authentication domain indicates the context in which this user name and password are valid. Servers that require user name and password also have domains, and this domain must match the server's domain if this login is valid on the server.nulland empty ("") domains are equivalent.
-
PasswordCredential
public PasswordCredential(String userName, String password) Construct login credentials. The authentication domain will be "" (empty string). This is not the preferred way of constructing an instance of this class. If possible, use one of thenewInstance()methods instead for improved security.- Parameters:
userName- the user namepassword- the password
-
PasswordCredential
protected PasswordCredential(String domain) Constructor used by thenewInstance()methods and subclasses. Callers MUST call or overridesetUserName()and one ofsetPassword(),setPasswordAsSealedString(), orsetPasswordAsChars()immediately after calling this constructor. Otherwise, the object will be in a bad state.- Parameters:
domain- the authentication domain
-
-
Method Details
-
newInstance
public static PasswordCredential newInstance(String userName, com.sas.net.crypto.SealedString passwordAsSealedString, String domain) Create a new instance of this class using aSealedStringfor the password. The password must be encapsulated in aSealedStringobject for improved security.- Parameters:
userName- the user namepasswordAsSealedString- the passworddomain- the authentication domain. Can benull.- Returns:
- a new password credential
-
newInstance
public static PasswordCredential newInstance(String userName, char[] passwordAsChars, String domain) Create a new instance of this class using a character array for the password. The character array containing the password should be cleared after calling this method for improved security. The password will be stored internally as aSealedStringobject.- Parameters:
userName- the user namepasswordAsChars- the passworddomain- the authentication domain. Can benull.- Returns:
- a new password credential
-
setUserName
public void setUserName(String userName) Set the user name.- Parameters:
userName- the user name
-
getUserName
public String getUserName()Get the user name.- Returns:
- the user name
-
setPassword
public void setPassword(String password) Set the password. This is not the preferred way of setting the password. If possible, usesetPasswordAsSealedString(), orsetPasswordAsChars()for improved security.- Parameters:
password- the password
-
setPasswordAsSealedString
public void setPasswordAsSealedString(com.sas.net.crypto.SealedString passwordAsSealedString) Set the password as aSealedStringobject. The password must be encapsulated in aSealedStringobject for improved security.- Parameters:
passwordAsSealedString- the password
-
setPasswordAsChars
public void setPasswordAsChars(char[] passwordAsChars) Set the password as a character array. The character array containing the password should be cleared after calling this method for improved security. The password will be stored internally as aSealedStringobject.- Parameters:
passwordAsChars- the password
-
getPassword
public String getPassword()Get the password. This is not the preferred way of getting the password. If possible, usegetPasswordAsSealedString(), orgetPasswordAsChars()for improved security.- Returns:
- the password
-
getPasswordAsSealedString
public com.sas.net.crypto.SealedString getPasswordAsSealedString()Get the password as aSealedStringobject. The password will be encapsulated in aSealedStringobject for improved security.- Returns:
- the password
-
getPasswordAsChars
public char[] getPasswordAsChars()Get the password as a character array. The caller should clear the character array containing the password when it is no longer needed for improved security.- Returns:
- the password
-
equals
public boolean equals(Object that) - Overrides:
equalsin classCredential
-
hashCode
public int hashCode()- Overrides:
hashCodein classCredential
-
toString
public String toString()- Overrides:
toStringin classObject
-