Class ReadFromFilePasswordProvider

java.lang.Object
com.unboundid.ldap.sdk.PasswordProvider
com.unboundid.ldap.sdk.ReadFromFilePasswordProvider
All Implemented Interfaces:
Serializable

This class provides an implementation of a password provider that will obtain the password from a specified file. All bytes up to (but not including) the first end-of-line character (or to the end of the file if it does not contain an end-of-line character) will be considered part of the password.
See Also:
  • Constructor Details

    • ReadFromFilePasswordProvider

      Creates a new instance of this password provider that will read passwords from the specified file.
      Parameters:
      passwordFile - The path to the file containing the password to use. It must not be null.
    • ReadFromFilePasswordProvider

      Creates a new instance of this password provider that will read passwords from the specified file.
      Parameters:
      passwordFile - The file containing the password to use. It must not be null.
  • Method Details

    • getPasswordBytes

      @NotNull public byte[] getPasswordBytes() throws LDAPException
      Retrieves a password in a newly-created byte array. Once the password is no longer required, the contents of the array will be overwritten so that the password is no longer contained in memory.
      Specified by:
      getPasswordBytes in class PasswordProvider
      Returns:
      A byte array containing the password that should be used.
      Throws:
      LDAPException - If a problem is encountered while attempting to obtain the password.