com.nimbusds.oauth2.sdk
Class ResponseType

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet<ResponseType.Value>
              extended by com.nimbusds.oauth2.sdk.ResponseType
All Implemented Interfaces:
Serializable, Cloneable, Iterable<ResponseType.Value>, Collection<ResponseType.Value>, Set<ResponseType.Value>

@NotThreadSafe
public class ResponseType
extends HashSet<ResponseType.Value>

Authorisation response type. Can be single-valued or multiple-valued. This class is not thread-safe.

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:

Author:
Vladimir Dzhuvinov
See Also:
Serialized Form

Nested Class Summary
static class ResponseType.Value
          Authorisation response type value.
 
Constructor Summary
ResponseType()
          Creates a new empty response type.
 
Method Summary
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.
 
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.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

ResponseType

public ResponseType()
Creates a new empty response type.

Method Detail

getDefault

public static ResponseType getDefault()
Gets the default response type.

Returns:
The default response type, consisting of the value ResponseType.Value.CODE.

parse

public static ResponseType parse(String s)
                          throws ParseException
Parses a set of authorisation response types.

Example serialised response type sets:

 code
 token
 id_token
 id_token token
 code token
 code id_token
 code id_token token
 

Parameters:
s - Space-delimited list of one or more authorisation response types.
Returns:
The authorisation response types set.
Throws:
ParseException - If the parsed string is null or empty.

impliesCodeFlow

public boolean impliesCodeFlow()
Returns true if this response type implies a code flow. This is determined by the presence of a code value.

Returns:
true if a code flow is implied, else false.

impliesImplicitFlow

public boolean impliesImplicitFlow()
Returns true if this response type implies an implicit flow. This is determined by the absence of a code value.

Returns:
true if an implicit flow is implied, else false.

toString

public String 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 class AbstractCollection<ResponseType.Value>
Returns:
Space delimited string representing the authorisation response type.


Copyright © 2013 NimbusDS. All Rights Reserved.