Class Prompt

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Prompt.Type>, Collection<Prompt.Type>, Set<Prompt.Type>

@NotThreadSafe public class Prompt extends LinkedHashSet<Prompt.Type>
Prompts for end-user re-authentication and consent.

Related specifications:

  • OpenID Connect Core 1.0, section 3.1.2.1.
  • Initiating User Registration via OpenID Connect 1.0
See Also:
  • Constructor Details

    • Prompt

      public Prompt()
      Creates a new empty prompt.
    • Prompt

      public Prompt(Prompt.Type... type)
      Creates a new prompt with the specified types.
      Parameters:
      type - The prompt types.
    • Prompt

      public Prompt(String... values)
      Creates a new prompt with the specified type values.
      Parameters:
      values - The prompt type values.
      Throws:
      IllegalArgumentException - If the type value is invalid.
  • Method Details

    • isValid

      public boolean isValid()
      Checks if the prompt is valid. This is done by examining the prompt for a conflicting Prompt.Type.NONE value.
      Returns:
      true if this prompt if valid, else false.
    • toStringList

      Returns the string list representation of this prompt.
      Returns:
      The string list representation.
    • toString

      public String toString()
      Returns the string representation of this prompt. The values are delimited by space.

      Example:

       login consent
       
      Overrides:
      toString in class AbstractCollection<Prompt.Type>
      Returns:
      The string representation.
    • parse

      public static Prompt parse(Collection<String> collection) throws ParseException
      Parses a prompt from the specified string list.
      Parameters:
      collection - The string list to parse, with one or more non-conflicting prompt types. May be null.
      Returns:
      The prompt, null if the parsed string list was null or empty.
      Throws:
      ParseException - If the string list couldn't be parsed to a valid prompt.
    • parse

      public static Prompt parse(String s) throws ParseException
      Parses a prompt from the specified string.
      Parameters:
      s - The string to parse, with one or more non-conflicting space delimited prompt types. May be null.
      Returns:
      The prompt, null if the parsed string was null or empty.
      Throws:
      ParseException - If the string couldn't be parsed to a valid prompt.