public class PasswordPropertyType extends PropertyType<PasswordTypeVO> implements MarkerPasswordPropertyType
| Constructor Example | Comments | ||
|---|---|---|---|
Property<PasswordTypeVO> A_PROPERTY = |
Creates PasswordPropertyType using AESEncryption. AutoEncrypt is false. No password validator. | ||
Property<PasswordTypeVO> A_PROPERTY = |
Creates PasswordPropertyType using AESEncryption. AutoEncrypt is false. No password validator. | ||
Property<PasswordTypeVO> A_PROPERTY = |
Creates PasswordPropertyType using MD5Encryption. AutoEncrypt is false. No password validator. | ||
Property<PasswordTypeVO> A_PROPERTY = |
Creates PasswordPropertyType using SHA512Encryption. AutoEncrypt is false. No password validator. | ||
Property<PasswordTypeVO> A_PROPERTY = |
Creates PasswordPropertyType using MD5Encryption. AutoEncrypt is true. No password validator. | ||
Property<PasswordTypeVO> A_PROPERTY = |
Creates PasswordPropertyType using MD5Encryption. AutoEncrypt is false. Using DefaultPasswordEvaluator password validator. | ||
| Type of value(s) | Examples | Result | Comments |
| Valid | cow |
new PasswordTypeVO(new IPasswordPropertyType(),"cow") |
Validate successfully. |
| Valid | «empty string» | new PasswordTypeVO(new IPasswordPropertyType(),"") |
Validate successfully. |
| Invalid | null |
null |
Validate will throw an exception. Return null. |
PasswordEncryption,
MD5Encryption,
AESEncryption,
SHA512Encryption,
PasswordEvaluator,
Serialized FormENCRYPTION_METHOD_END_CHAR, ENCRYPTION_METHOD_START_CHAR| Constructor and Description |
|---|
PasswordPropertyType()
Constructor, the default "PasswordEncryption" is "
new AESEncryption()", there is no default value of a PasswordPropertyType. |
PasswordPropertyType(PasswordEncryption passwordEncryption)
Constructor, has to define "PasswordEncryption", there is no default value of a PasswordPropertyType.
|
PasswordPropertyType(PasswordEncryption passwordEncryption,
boolean autoEncrypt)
Constructor, there is no default value of a PasswordPropertyType.
|
PasswordPropertyType(PasswordEncryption passwordEncryption,
boolean autoEncrypt,
PasswordEvaluator evaluator)
Constructor, there is no default value of a PasswordPropertyType.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
evaluatePassword(String propertyName,
String value)
Evaluates a new password.
|
String |
getDecryptedValue(String value)
Get the decrypted value if possible, otherwise a PropertyException is thrown.
|
String |
getEncryptedValue(String value)
Get the encrypted value if possible, otherwise a PropertyException is thrown.
|
String |
getEncryptionMethod()
Gets the encryption method identification short key.
|
PasswordEncryption |
getPasswordEncryption()
Gets the PasswordEncryption implementation
|
PasswordEvaluator |
getPasswordEvaluator()
A password evaluator, that will test if a new password is strong enough.
|
List<String> |
getRestrictions()
Gets a detailed description of the PropertyType with any constraints that might influence the validation.
|
boolean |
isAutoEncrypt()
Is autoEncrypt on or off.
|
boolean |
isDecryptable()
If the encryption method is decryptable or not (without password)
|
boolean |
isEncrypted(String value)
Evaluates if the string value is encrypted or not, if fails then throwing a PropertyException.
|
boolean |
isSameKey(String password,
String inputValue)
Evaluates if the stored key (password) is the same as the inputValue, both can be encrypted or not.
|
protected String |
postGetValueProcessing(String propertyName,
String value,
boolean propertyReadonly)
Special method invoke by the Property.getValue(), to gives the
ability to post processed the loaded value.
|
void |
setAutoEncrypt(boolean autoEncrypt) |
void |
setEvaluator(PasswordEvaluator evaluator) |
void |
setPasswordEncryption(PasswordEncryption passwordEncryption) |
void |
validateConstraints(String propertyName)
A PropertyType can have some constraints here is where they are
validated.
|
PasswordTypeVO |
validateValue(String propertyName,
String value)
Converts the string representation of to a typed value.
|
equals, getDefaultValue, getDefaultValueAsString, getDefaultValueDescription, getDescription, getDescription, getInitializationPriority, getIo, getLogger, getTypeName, hasDefaultValue, isDefaultValueValid, setDefaultValue, setInitializationPriority, setIo, setTypedValue, setTypeName, toString, toType, validate, validateNullTypepublic PasswordPropertyType()
new AESEncryption()", there is no default value of a PasswordPropertyType.
Auto encrypt is false and no password evaluator.AESEncryptionpublic PasswordPropertyType(PasswordEncryption passwordEncryption)
false and no password evaluator.passwordEncryption - The implementation of the PasswordEncryption interface.PasswordEncryption,
MD5Encryption,
AESEncryption,
SHA512Encryptionpublic PasswordPropertyType(PasswordEncryption passwordEncryption, boolean autoEncrypt)
false and no password evaluator.passwordEncryption - The implementation of the PasswordEncryption interface.autoEncrypt - to auto encrypt the password on load time. The password will not be evaluated by the password evaluator at this point.PasswordEncryption,
MD5Encryption,
AESEncryption,
SHA512Encryptionpublic PasswordPropertyType(PasswordEncryption passwordEncryption, boolean autoEncrypt, PasswordEvaluator evaluator)
passwordEncryption - The implementation of the PasswordEncryption interface.autoEncrypt - to auto encrypt the password on load time. The password will not be evaluated by the password evaluator at this point.evaluator - the password evaluator instance use when setting new password.PasswordEncryption,
MD5Encryption,
AESEncryption,
SHA512Encryptionpublic final PasswordEvaluator getPasswordEvaluator()
MarkerPasswordPropertyTypenull. If its not, then it will be used in validating a new password.getPasswordEvaluator in interface MarkerPasswordPropertyTypenull.public void setEvaluator(PasswordEvaluator evaluator)
public final PasswordEncryption getPasswordEncryption()
MarkerPasswordPropertyTypegetPasswordEncryption in interface MarkerPasswordPropertyTypepublic void setPasswordEncryption(PasswordEncryption passwordEncryption)
protected final void evaluatePassword(String propertyName, String value) throws PropertyException
propertyName - the name of the property.value - the new password.PropertyException - if a PasswordEvaluator is assigned, and the new password do not conform to its rules or PasswordEvaluator is null.public final boolean isAutoEncrypt()
MarkerPasswordPropertyTypeisAutoEncrypt in interface MarkerPasswordPropertyTypetrue if auto encrypt is on, otherwise false.public final void setAutoEncrypt(boolean autoEncrypt)
public final PasswordTypeVO validateValue(String propertyName, String value) throws PropertyException
PropertyTypevalidateValue in class PropertyType<PasswordTypeVO>propertyName - the name of the property used for logging purposes. To uniquely identify the Property with validation issues.value - the string representation of the propertyPropertyException - if the conversion failed.public void validateConstraints(String propertyName) throws PropertyException
PropertyTypevalidateConstraints in class PropertyType<PasswordTypeVO>propertyName - the name of the property used for logging purposes, to
identify the unique property which PropertyType has constraint
issues.PropertyException - if the constraints have invalid/conflicting values.Property.validate()protected String postGetValueProcessing(String propertyName, String value, boolean propertyReadonly)
PropertyTypepostGetValueProcessing in class PropertyType<PasswordTypeVO>propertyName - the name of the Property used for loggingvalue - the value.propertyReadonly - if the the property is readonly or not.public final List<String> getRestrictions()
PropertyTypegetRestrictions in class PropertyType<PasswordTypeVO>public String getDecryptedValue(String value) throws PropertyException
MarkerPasswordPropertyTypegetDecryptedValue in interface EncryptiongetDecryptedValue in interface MarkerPasswordPropertyTypevalue - the string valuePropertyException - if value is null or decryption is not possible or an error during decryption as occurred.public String getEncryptedValue(String value) throws PropertyException
MarkerPasswordPropertyTypegetEncryptedValue in interface EncryptiongetEncryptedValue in interface MarkerPasswordPropertyTypevalue - the string valuePropertyException - if value is null or encryption is not possible or an error during encryption as occurred.public boolean isDecryptable()
MarkerPasswordPropertyTypeisDecryptable in interface EncryptionisDecryptable in interface MarkerPasswordPropertyTypetrue if it is decryptable, otherwise false.public boolean isEncrypted(String value) throws PropertyException
MarkerPasswordPropertyTypeisEncrypted in interface EncryptionisEncrypted in interface MarkerPasswordPropertyTypevalue - the stringtrue if the string is encrypted otherwise false, also returns false if the value is null. Determines if "[method]" is a front the string value.PropertyException - if a the password is encrypted with another method.public String getEncryptionMethod()
MarkerPasswordPropertyTypegetEncryptionMethod in interface EncryptiongetEncryptionMethod in interface MarkerPasswordPropertyTypepublic boolean isSameKey(String password, String inputValue) throws PropertyException
MarkerPasswordPropertyTypeisSameKey in interface MarkerPasswordPropertyTypeisSameKey in interface PasswordEncryptionpassword - the assumed password, which is stored in properties. This can either be encrypted or not encrypted.inputValue - the user password. This can either be encrypted or not encrypted.true if the two string values encrypted is the same, otherwise false is returned, must be able to handle that "[method]" is a front the encrypted value.PropertyException - if either password> or inputValue is null, or if password encrypted for this propertyType isnt possible.