Package oracle.kv
Class PasswordCredentials
- java.lang.Object
-
- oracle.kv.PasswordCredentials
-
- All Implemented Interfaces:
Serializable
,oracle.kv.impl.util.FastExternalizable
,LoginCredentials
public class PasswordCredentials extends Object implements LoginCredentials, Serializable
Username/password credentials. This class provides the standard mechanism for an application to authenticate as a particular user when accessing a KVStore instance. The object contains sensitive information and should be kept private. When no longer needed the user should call clear() to erase the internal password information.- Since:
- 3.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PasswordCredentials(String username, char[] password)
Creates a username/password credential set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Wipes out the password storage to ensure it does not hang around in the Java VM memory space.char[]
getPassword()
Gets the password.String
getUsername()
Identifies the user owning the credentials.
-
-
-
Constructor Detail
-
PasswordCredentials
public PasswordCredentials(String username, char[] password) throws IllegalArgumentException
Creates a username/password credential set. The password passed in is copied internal to the object. For maximum security, it is recommended that you call theclear()
method when you are done with the object to avoid have the password being present in the Java memory heap.- Parameters:
username
- the name of the userpassword
- the password of the user- Throws:
IllegalArgumentException
- if either username or password have null values.
-
-
Method Detail
-
getUsername
public String getUsername()
Description copied from interface:LoginCredentials
Identifies the user owning the credentials.- Specified by:
getUsername
in interfaceLoginCredentials
- Returns:
- the name of the user for which the credentials belong.
- See Also:
LoginCredentials.getUsername()
-
getPassword
public char[] getPassword()
Gets the password. This returns a copy of the password. The caller should clear the returned memory when the value is no longer needed.- Returns:
- The password for the user.
-
clear
public void clear()
Wipes out the password storage to ensure it does not hang around in the Java VM memory space.
-
-