Package com.unboundid.ldap.sdk
Class ReadFromFilePasswordProvider
- java.lang.Object
-
- com.unboundid.ldap.sdk.PasswordProvider
-
- com.unboundid.ldap.sdk.ReadFromFilePasswordProvider
-
- All Implemented Interfaces:
java.io.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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ReadFromFilePasswordProvider(java.io.File passwordFile)
Creates a new instance of this password provider that will read passwords from the specified file.ReadFromFilePasswordProvider(java.lang.String passwordFile)
Creates a new instance of this password provider that will read passwords from the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getPasswordBytes()
Retrieves a password in a newly-created byte array.
-
-
-
Constructor Detail
-
ReadFromFilePasswordProvider
public ReadFromFilePasswordProvider(java.lang.String passwordFile)
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
public ReadFromFilePasswordProvider(java.io.File passwordFile)
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 Detail
-
getPasswordBytes
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 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.
-
-