Package com.nimbusds.oauth2.sdk
Class ResponseType
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<ResponseType.Value>
,Collection<ResponseType.Value>
,Set<ResponseType.Value>
Authorisation response type.
Example response type implying an authorisation code flow:
ResponseType rt = ResponseType.CODE;
Example response type from OpenID Connect specifying an ID token and an access token (implies implicit flow):
ResponseType rt = ResponseType.IDTOKEN_TOKEN);
The following helper methods can be used to find out the implied OAuth 2.0 protocol flow for a response type:
Related specifications:
- OAuth 2.0 (RFC 6749), sections 3.1.1 and 4.1.1.
- OAuth 2.0 Multiple Response Type Encoding Practices.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Authorisation response type value. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ResponseType
Constant forresponse_type=code
.static final ResponseType
Constant forresponse_type=code id_token
.static final ResponseType
Constant forresponse_type=code id_token token
.static final ResponseType
Constant forresponse_type=code token
.static final ResponseType
Constant forresponse_type=id_token
.static final ResponseType
Constant forresponse_type=id_token token
.static final ResponseType
Constant forresponse_type=token
. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty response type.ResponseType
(ResponseType.Value... values) Creates a new response type with the specified values.ResponseType
(String... values) Creates a new response type with the specified string values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(ResponseType.Value value) boolean
addAll
(Collection<? extends ResponseType.Value> c) void
clear()
boolean
Checks if this response type contains the specified string value.static ResponseType
Gets the default response type.boolean
Returnstrue
if this response type implies an authorisation code flow.boolean
Returnstrue
if this response type implies an OpenID Connect hybrid flow.boolean
Returnstrue
if this response type implies an implicit flow.static ResponseType
Parses a set of authorisation response types.boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) toString()
Returns the string representation of this authorisation response type.Methods inherited from class java.util.HashSet
clone, contains, isEmpty, iterator, size, spliterator, toArray, toArray
Methods inherited from class java.util.AbstractSet
equals, hashCode
Methods inherited from class java.util.AbstractCollection
containsAll
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
Methods inherited from interface java.util.Set
containsAll, equals, hashCode
-
Field Details
-
CODE
Constant forresponse_type=code
. -
TOKEN
Constant forresponse_type=token
. -
IDTOKEN_TOKEN
Constant forresponse_type=id_token token
. -
IDTOKEN
Constant forresponse_type=id_token
. -
CODE_IDTOKEN
Constant forresponse_type=code id_token
. -
CODE_TOKEN
Constant forresponse_type=code token
. -
CODE_IDTOKEN_TOKEN
Constant forresponse_type=code id_token token
.
-
-
Constructor Details
-
ResponseType
public ResponseType()Creates a new empty response type. -
ResponseType
Creates a new response type with the specified string values.- Parameters:
values
- The string values. Must not benull
.
-
ResponseType
Creates a new response type with the specified values.- Parameters:
values
- The values. Must not benull
.
-
-
Method Details
-
getDefault
Gets the default response type.- Returns:
- The default response type, consisting of the value
ResponseType.Value.CODE
.
-
parse
Parses a set of authorisation response types.- Parameters:
s
- Space-delimited list of one or more authorisation response types.- Returns:
- The authorisation response types set.
- Throws:
ParseException
- If the parsed string isnull
or empty.
-
impliesCodeFlow
Returnstrue
if this response type implies an authorisation code flow.Code flow response_type values: code
- Returns:
true
if a code flow is implied, elsefalse
.
-
impliesImplicitFlow
Returnstrue
if this response type implies an implicit flow.Implicit flow response_type values: token, id_token token, id_token
- Returns:
true
if an implicit flow is implied, elsefalse
.
-
impliesHybridFlow
Returnstrue
if this response type implies an OpenID Connect hybrid flow.Hybrid flow response_type values: code id_token, code token, code id_token token
- Returns:
true
if a hybrid flow is implied, elsefalse
.
-
contains
Checks if this response type contains the specified string value.- Parameters:
value
- The string value. Must not benull
.- Returns:
true
if the value is contained, elsefalse
.
-
toString
Returns the string representation of this authorisation response type.Example serialised response types:
code token id_token id_token token code token code id_token code id_token token
- Overrides:
toString
in classAbstractCollection<ResponseType.Value>
- Returns:
- Space delimited string representing the authorisation response type.
-
add
- Specified by:
add
in interfaceCollection<ResponseType.Value>
- Specified by:
add
in interfaceSet<ResponseType.Value>
- Overrides:
add
in classHashSet<ResponseType.Value>
-
remove
- Specified by:
remove
in interfaceCollection<ResponseType.Value>
- Specified by:
remove
in interfaceSet<ResponseType.Value>
- Overrides:
remove
in classHashSet<ResponseType.Value>
-
clear
- Specified by:
clear
in interfaceCollection<ResponseType.Value>
- Specified by:
clear
in interfaceSet<ResponseType.Value>
- Overrides:
clear
in classHashSet<ResponseType.Value>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<ResponseType.Value>
- Specified by:
removeAll
in interfaceSet<ResponseType.Value>
- Overrides:
removeAll
in classAbstractSet<ResponseType.Value>
-
addAll
- Specified by:
addAll
in interfaceCollection<ResponseType.Value>
- Specified by:
addAll
in interfaceSet<ResponseType.Value>
- Overrides:
addAll
in classAbstractCollection<ResponseType.Value>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<ResponseType.Value>
- Specified by:
retainAll
in interfaceSet<ResponseType.Value>
- Overrides:
retainAll
in classAbstractCollection<ResponseType.Value>
-