Package com.nimbusds.openid.connect.sdk
Class Prompt
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- java.util.HashSet<E>
-
- java.util.LinkedHashSet<Prompt.Type>
-
- com.nimbusds.openid.connect.sdk.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 (draft 03)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Prompt.Type
Enumeration of the prompt types.
-
Constructor Summary
Constructors Constructor Description Prompt()
Creates a new empty prompt.Prompt(Prompt.Type... type)
Creates a new prompt with the specified types.Prompt(String... values)
Creates a new prompt with the specified type values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isValid()
Checks if the prompt is valid.static Prompt
parse(String s)
Parses a prompt from the specified string.static Prompt
parse(Collection<String> collection)
Parses a prompt from the specified string list.String
toString()
Returns the string representation of this prompt.List<String>
toStringList()
Returns the string list representation of this prompt.-
Methods inherited from class java.util.LinkedHashSet
spliterator
-
Methods inherited from class java.util.HashSet
add, clear, clone, contains, isEmpty, iterator, remove, size
-
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
-
-
-
Constructor Detail
-
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 Detail
-
isValid
public boolean isValid()
Checks if the prompt is valid. This is done by examining the prompt for a conflictingPrompt.Type.NONE
value.- Returns:
true
if this prompt if valid, elsefalse
.
-
toStringList
public List<String> 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 classAbstractCollection<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 benull
.- Returns:
- The prompt,
null
if the parsed string list wasnull
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 benull
.- Returns:
- The prompt,
null
if the parsed string wasnull
or empty. - Throws:
ParseException
- If the string couldn't be parsed to a valid prompt.
-
-