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
public class HashedField extends Field
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.- Since:
- 7.2 R2
- See Also:
Field,HashedTextFieldDescriptor,FieldList.getFields(),FieldList.getField(String),FieldList.getFields(),FieldList.getField(String), Serialized Form
-
-
Field Summary
-
Fields inherited from class org.sourceid.saml20.adapter.conf.Field
DEFAULT_NUM_VAL
-
-
Constructor Summary
Constructors Constructor Description HashedField(String name, String hashedValue, String plainTextValue)Create a new HashedField with the specified name, hashed value and plaintext value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckSecret(String plaintext)Checks the specified plaintext against the hash of this field.StringgetHashedValue()Gets the secure salted hash value of this field.StringgetPlainTextValue()Gets the new plaintext value of this field.StringgetValue()Gets the secure salted hash value of this field.voidsetPlainTextValue(String plaintext)Sets the new plaintext value of this field.StringtoString()-
Methods inherited from class org.sourceid.saml20.adapter.conf.Field
getFileValueAsByteArray, getFileValueAsString, getLabel, getName, getValueAsBoolean, getValueAsDouble, getValueAsFloat, getValueAsInt, getValueAsLong, setLabel
-
-
-
-
Constructor Detail
-
HashedField
public HashedField(String name, String hashedValue, String plainTextValue)
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 Detail
-
getPlainTextValue
public String 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
public void setPlainTextValue(String plaintext)
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
public String getHashedValue()
Gets the secure salted hash value of this field.- Returns:
- The hash value which may be null.
-
getValue
public String getValue()
Gets the secure salted hash value of this field. This is the same asgetHashedValue()
-
checkSecret
public boolean checkSecret(String plaintext)
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.
-
-