public class PasswordUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static PasswordUtils |
getInstance() |
String |
readPassword(String passwordProperty,
String defaultPassword)
Reading the password belong to the given password property
|
String |
readPasswordFromFile(String filePath,
String defaultPassword)
Reading password from the given password file
|
String |
readPasswordFromStore(String aliasStr,
Configuration configuration)
Reading the password from Credential Store for the given alias
|
public static PasswordUtils getInstance()
public String readPassword(String passwordProperty, String defaultPassword)
passwordProperty - this is either the Credential Store alias or the password file name
you want to read the password for/fromdefaultPassword - the default password this function returns in case the given
passwordProperty is passwordProperty belongs to a Credential Store
alias this function returns the password of the given Credential
Store alias or null (if the given alias is
blank or there is no password found in CS); otherwise
either the password found in the given password file is returned or
defaultPassword if the given path is blank
or cannot be read for any reasonRuntimeException - if any error occurred while reading the password filepublic String readPasswordFromFile(String filePath, String defaultPassword)
filePath - the path of the file to read the password fromdefaultPassword - the default password this function returns in case the given
filePath is blank or the password file
cannot be read for any reasondefaultPassword if the given path is blank
or cannot be read for any reasonRuntimeException - when any error occurred while reading the password filepublic String readPasswordFromStore(String aliasStr, Configuration configuration)
aliasStr - the Credential Store alias you want to read the password forconfiguration - with configured master key:
masterKeyLocation
the master key location file
isMasterKeyPersisted
a flag indicating whether the master key is persisted
masterKeyStoreLocation
the master key-store location fileblank and
there is password stored for this alias in Credential Store;
null otherwiseCopyright © 2022 Apache Software Foundation. All rights reserved.