public class KettleTwoWayPasswordEncoder extends Object implements TwoWayPasswordEncoderInterface
Modifier and Type | Field and Description |
---|---|
static String |
PASSWORD_ENCRYPTED_PREFIX
The word that is put before a password to indicate an encrypted form.
|
Constructor and Description |
---|
KettleTwoWayPasswordEncoder() |
Modifier and Type | Method and Description |
---|---|
String |
decode(String encodedPassword)
Decode a password which does NOT have a prefix attached.
|
String |
decode(String encodedPassword,
boolean optionallyEncrypted)
Decode a password.
|
static String |
decryptPassword(String encrypted) |
static String |
decryptPasswordOptionallyEncrypted(String password)
Decrypts a password if it contains the prefix "Encrypted "
|
String |
encode(String rawPassword)
Encode the raw password, include a prefix indicating the type of encryption used.
|
String |
encode(String rawPassword,
boolean includePrefix)
Encode a password.
|
static String |
encryptPassword(String password) |
static String |
encryptPasswordIfNotUsingVariables(String password)
Encrypt the password, but only if the password doesn't contain any variables.
|
String[] |
getPrefixes() |
void |
init()
Initialize the password encoder by loading key details from the environment (kettle.properties or system settings).
|
public static final String PASSWORD_ENCRYPTED_PREFIX
public void init() throws KettleException
TwoWayPasswordEncoderInterface
init
in interface TwoWayPasswordEncoderInterface
KettleException
public String encode(String rawPassword)
TwoWayPasswordEncoderInterface
encode
in interface TwoWayPasswordEncoderInterface
rawPassword
- The password to encodepublic String encode(String rawPassword, boolean includePrefix)
TwoWayPasswordEncoderInterface
encode
in interface TwoWayPasswordEncoderInterface
rawPassword
- The password to encodeincludePrefix
- True if a prefix needs to be encodedpublic String decode(String encodedPassword)
TwoWayPasswordEncoderInterface
decode
in interface TwoWayPasswordEncoderInterface
encodedPassword
- The encoded password without a prefixpublic String decode(String encodedPassword, boolean optionallyEncrypted)
TwoWayPasswordEncoderInterface
decode
in interface TwoWayPasswordEncoderInterface
encodedPassword
- The encoded password with or without a prefixoptionallyEncrypted
- Set to true if the password is optionally encrypted (indicated by a prefix).public String[] getPrefixes()
getPrefixes
in interface TwoWayPasswordEncoderInterface
public static final String encryptPasswordIfNotUsingVariables(String password)
password
- The password to encryptpublic static final String decryptPasswordOptionallyEncrypted(String password)
password
- The encrypted password