Package com.unboundid.ldap.sdk
Class ReadFromFilePasswordProvider
java.lang.Object
com.unboundid.ldap.sdk.PasswordProvider
com.unboundid.ldap.sdk.ReadFromFilePasswordProvider
- All Implemented Interfaces:
Serializable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public final class ReadFromFilePasswordProvider
extends PasswordProvider
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 Summary
ConstructorsConstructorDescriptionReadFromFilePasswordProvider(File passwordFile) Creates a new instance of this password provider that will read passwords from the specified file.ReadFromFilePasswordProvider(String passwordFile) Creates a new instance of this password provider that will read passwords from the specified file. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Retrieves a password in a newly-created byte array.
-
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 benull.
-
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 benull.
-
-
Method Details
-
getPasswordBytes
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:
getPasswordBytesin classPasswordProvider- Returns:
- A byte array containing the password that should be used.
- Throws:
LDAPException- If a problem is encountered while attempting to obtain the password.
-