Package org.sourceid.saml20.adapter.conf
Class HashedField
java.lang.Object
org.sourceid.saml20.adapter.conf.Field
org.sourceid.saml20.adapter.conf.HashedField
- All Implemented Interfaces:
Serializable
This class holds the name, the secure salted hash of the current value and the new user-entered plaintext value of a GUI-rendered configuration
field.
-
Field Summary
Fields inherited from class org.sourceid.saml20.adapter.conf.Field
DEFAULT_NUM_VAL -
Constructor Summary
ConstructorsConstructorDescriptionHashedField(String name, String hashedValue, String plainTextValue) Create a new HashedField with the specified name, hashed value and plaintext value. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckSecret(String plaintext) Checks the specified plaintext against the hash of this field.Gets the secure salted hash value of this field.Gets the new plaintext value of this field.getValue()Gets the secure salted hash value of this field.voidsetPlainTextValue(String plaintext) Sets the new plaintext value of this field.toString()Methods inherited from class org.sourceid.saml20.adapter.conf.Field
getFileValueAsByteArray, getFileValueAsString, getLabel, getName, getValueAsBoolean, getValueAsDouble, getValueAsFloat, getValueAsInt, getValueAsLong, setLabel
-
Constructor Details
-
HashedField
Create a new HashedField with the specified name, hashed value and plaintext value. The name of the field is the same as the name of HashedTextFieldDescriptor that was used to render the field on the GUI. The value will be the secure salted hash of the value that was originally entered by the admin/user in the GUI. The plaintext value is the new value that will be hashed to replace the current hash once this field is saved.- Parameters:
name- The name of this field.hashedValue- The hashed value for this field.plainTextValue- The plaintext value for this field. Can be null if the field has not changed.
-
-
Method Details
-
getPlainTextValue
Gets the new plaintext value of this field. The value is only set if admin/user is creating this field for the first time, or wants to change the existing value.- Returns:
- The plaintext value which may be null if the user doesn't want to change the value.
-
setPlainTextValue
Sets the new plaintext value of this field. The plaintext will be hashed once the field is saved.- Parameters:
plaintext- The plaintext value of the field.
-
getHashedValue
Gets the secure salted hash value of this field.- Returns:
- The hash value which may be null.
-
getValue
Gets the secure salted hash value of this field. This is the same asgetHashedValue() -
toString
-
checkSecret
Checks the specified plaintext against the hash of this field.- Parameters:
plaintext- The plaintext to check.- Returns:
- True if the plaintext matches the hash, false otherwise.
-