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 classAuthorisation response type value. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ResponseTypeConstant forresponse_type=code.static final ResponseTypeConstant forresponse_type=code id_token.static final ResponseTypeConstant forresponse_type=code id_token token.static final ResponseTypeConstant forresponse_type=code token.static final ResponseTypeConstant forresponse_type=id_token.static final ResponseTypeConstant forresponse_type=id_token token.static final ResponseTypeConstant 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 TypeMethodDescriptionbooleanadd(ResponseType.Value value) booleanaddAll(Collection<? extends ResponseType.Value> c) voidclear()booleanChecks if this response type contains the specified string value.static ResponseTypeGets the default response type.booleanReturnstrueif this response type implies an authorisation code flow.booleanReturnstrueif this response type implies an OpenID Connect hybrid flow.booleanReturnstrueif this response type implies an implicit flow.static ResponseTypeParses a set of authorisation response types.booleanbooleanremoveAll(Collection<?> c) booleanretainAll(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, toArrayMethods inherited from class java.util.AbstractSet
equals, hashCodeMethods inherited from class java.util.AbstractCollection
containsAllMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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 isnullor empty.
-
impliesCodeFlow
Returnstrueif this response type implies an authorisation code flow.Code flow response_type values: code
- Returns:
trueif a code flow is implied, elsefalse.
-
impliesImplicitFlow
Returnstrueif this response type implies an implicit flow.Implicit flow response_type values: token, id_token token, id_token
- Returns:
trueif an implicit flow is implied, elsefalse.
-
impliesHybridFlow
Returnstrueif this response type implies an OpenID Connect hybrid flow.Hybrid flow response_type values: code id_token, code token, code id_token token
- Returns:
trueif 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:
trueif 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:
toStringin classAbstractCollection<ResponseType.Value>- Returns:
- Space delimited string representing the authorisation response type.
-
add
- Specified by:
addin interfaceCollection<ResponseType.Value>- Specified by:
addin interfaceSet<ResponseType.Value>- Overrides:
addin classHashSet<ResponseType.Value>
-
remove
- Specified by:
removein interfaceCollection<ResponseType.Value>- Specified by:
removein interfaceSet<ResponseType.Value>- Overrides:
removein classHashSet<ResponseType.Value>
-
clear
- Specified by:
clearin interfaceCollection<ResponseType.Value>- Specified by:
clearin interfaceSet<ResponseType.Value>- Overrides:
clearin classHashSet<ResponseType.Value>
-
removeAll
- Specified by:
removeAllin interfaceCollection<ResponseType.Value>- Specified by:
removeAllin interfaceSet<ResponseType.Value>- Overrides:
removeAllin classAbstractSet<ResponseType.Value>
-
addAll
- Specified by:
addAllin interfaceCollection<ResponseType.Value>- Specified by:
addAllin interfaceSet<ResponseType.Value>- Overrides:
addAllin classAbstractCollection<ResponseType.Value>
-
retainAll
- Specified by:
retainAllin interfaceCollection<ResponseType.Value>- Specified by:
retainAllin interfaceSet<ResponseType.Value>- Overrides:
retainAllin classAbstractCollection<ResponseType.Value>
-