Class State

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

    @Immutable
    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.
        Parameters:
        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.
        Parameters:
        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.
        Parameters:
        s - The string to parse, null or empty if no state is specified.
        Returns:
        The state, null if the parsed string was null or empty.