Class State

  • All Implemented Interfaces:
    Serializable, Comparable<Identifier>, net.minidev.json.JSONAware

    public final class State
    extends Identifier
    Opaque value used to maintain state between a request and a callback. Also serves as a protection against XSRF attacks, among other uses.
    See Also:
    Serialized Form
    • Constructor Detail

      • State

        public State​(String value)
        Creates a new state with the specified value.
        value - The state value. Must not be null or empty string.
      • State

        public State​(int byteLength)
        Creates a new state with a randomly generated value of the specified byte length, Base64URL-encoded.
        byteLength - The byte length of the value to generate. Must be greater than one.
      • State

        public State()
        Creates a new state with a randomly generated 256-bit (32-byte) value, Base64URL-encoded.
    • Method Detail

      • parse

        public static State parse​(String s)
        Parses a state from the specified string.
        s - The string to parse, null or empty if no state is specified.
        The state, null if the parsed string was null or empty.