@NotThreadSafe public class ResponseType extends HashSet<ResponseType.Value>
The following helper methods can be used to find out the OAuth 2.0 protocol flow that a particular response type implies:
Example response type implying an authorisation code flow:
ResponseType() rt = new ResponseType(); rt.add(ResponseType.Value.CODE);
Example response type from OpenID Connect specifying an ID token and an access token (implies implicit flow):
ResponseType() rt = new ResponseType(); rt.add(OIDCResponseTypeValue.ID_TOKEN); rt.add(ResponseType.Value.TOKEN);
Related specifications:
Modifier and Type | Class and Description |
---|---|
static class |
ResponseType.Value
Authorisation response type value.
|
Constructor and Description |
---|
ResponseType()
Creates 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.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(String value)
Checks if this response type contains the specified string value.
|
static ResponseType |
getDefault()
Gets the default response type.
|
boolean |
impliesCodeFlow()
Returns
true if this response type implies a code flow. |
boolean |
impliesImplicitFlow()
Returns
true if this response type implies an implicit flow. |
static ResponseType |
parse(String s)
Parses a set of authorisation response types.
|
String |
toString()
Returns the string representation of this authorisation response
type.
|
add, clear, clone, contains, isEmpty, iterator, remove, size
equals, hashCode, removeAll
addAll, containsAll, retainAll, toArray, toArray
public ResponseType()
public ResponseType(String... values)
values
- The string values. Must not be null
.public ResponseType(ResponseType.Value... values)
values
- The values. Must not be null
.public static ResponseType getDefault()
ResponseType.Value.CODE
.public static ResponseType parse(String s) throws ParseException
Example serialised response type sets:
code token id_token id_token token code token code id_token code id_token token
s
- Space-delimited list of one or more authorisation response
types.ParseException
- If the parsed string is null
or
empty.public boolean impliesCodeFlow()
true
if this response type implies a code flow. This
is determined by the presence of a code
value.true
if a code flow is implied, else false
.public boolean impliesImplicitFlow()
true
if this response type implies an implicit flow.
This is determined by the absence of a code
value.true
if an implicit flow is implied, else
false
.public boolean contains(String value)
value
- The string value. Must not be null
.true
if the value is contained, else false
.public String toString()
Example serialised response types:
code token id_token id_token token code token code id_token code id_token token
toString
in class AbstractCollection<ResponseType.Value>
Copyright © 2015 Connect2id Ltd.. All Rights Reserved.