Package oracle.kv

Class 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 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 the clear() 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 user
        password - the password of the user
        Throws:
        IllegalArgumentException - if either username or password have null values.
    • Method Detail

      • 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.