Package oracle.kv

Class PasswordCredentials

  • All Implemented Interfaces:
    java.io.Serializable, oracle.kv.impl.util.FastExternalizable, LoginCredentials

    public class PasswordCredentials
    extends java.lang.Object
    implements LoginCredentials, java.io.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​(java.lang.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.
      java.lang.String getUsername()
      Identifies the user owning the credentials.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface oracle.kv.impl.util.FastExternalizable

        deserializedForm
    • Constructor Detail

      • PasswordCredentials

        public PasswordCredentials​(java.lang.String username,
                                   char[] password)
                            throws java.lang.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:
        java.lang.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.