Record Class SelectorVerifierToken

java.lang.Object
java.lang.Record
com.svenruppert.jsentinel.credential.token.SelectorVerifierToken

public record SelectorVerifierToken(String selector, SecretValue verifier) extends Record
Two-part token used for password-reset, email-verification and remember-me flows.

The selector is a non-secret lookup key persisted next to the digest of the verifier; it lets the store find the right record in O(1) without scanning. The verifier is the secret half — exposed only on the wire while the user clicks the link and held in a SecretValue otherwise so toString() can never leak it (CWE-522 / CWE-209).

The wire format is selector.verifier (both Base64URL without padding). TokenDigestService.parse(String) performs the inverse.

  • Constructor Details

    • SelectorVerifierToken

      public SelectorVerifierToken(String selector, SecretValue verifier)
      Creates an instance of a SelectorVerifierToken record class.
      Parameters:
      selector - the value for the selector record component
      verifier - the value for the verifier record component
  • Method Details

    • encode

      public String encode()
      Returns the wire form selector.verifier. The caller is responsible for zeroing the returned CharSequence-derived string after use.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • selector

      public String selector()
      Returns the value of the selector record component.
      Returns:
      the value of the selector record component
    • verifier

      public SecretValue verifier()
      Returns the value of the verifier record component.
      Returns:
      the value of the verifier record component