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:
  • Constructor Details

    • 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 Details

    • 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 as getHashedValue()
      Overrides:
      getValue in class Field
      Returns:
      The hash value which may be null.
    • toString

      public String toString()
      Overrides:
      toString in class Field
    • 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.