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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    PasswordCredentials(String username, char[] password)
    Creates a username/password credential set.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Wipes out the password storage to ensure it does not hang around in the Java VM memory space.
    char[]
    Gets the password.
    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 Details

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

    • getUsername

      public String getUsername()
      Description copied from interface: LoginCredentials
      Identifies the user owning the credentials.
      Specified by:
      getUsername in interface LoginCredentials
      Returns:
      the name of the user for which the credentials belong.
      See Also:
    • 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.