Package com.authlete.common.types
Enum ResponseType
- java.lang.Object
-
- java.lang.Enum<ResponseType>
-
- com.authlete.common.types.ResponseType
-
- All Implemented Interfaces:
Serializable
,Comparable<ResponseType>
public enum ResponseType extends Enum<ResponseType>
Values forresponse_type
.From RFC 6749 (OAuth 2.0), 3.1.1. Response Type
response_type
-
REQUIRED. The value MUST be one of
"code"
for requesting an authorization code as described by Section 4.1.1,"token"
for requesting an access token (implicit grant) as described by Section 4.2.1, or a registered extension value as described by Section 8.4.
From OAuth 2.0 Multiple Response Type Encoding Practices, 3. ID Token Response Type
id_token
-
When supplied as the
response_type
parameter in an OAuth 2.0 Authorization Request, a successful response MUST include the parameterid_token
. The Authorization Server SHOULD NOT return an OAuth 2.0 Authorization Code, Access Token, or Access Token Type in a successful response to the grant request. If aredirect_uri
is supplied, the User Agent SHOULD be redirected there after granting or denying access. The request MAY include astate
parameter, and if so, the Authorization Server MUST echo its value as a response parameter when issuing either a successful response or an error response. The default Response Mode for this Response Type is the fragment encoding and the query encoding MUST NOT be used. Both successful and error responses SHOULD be returned using the supplied Response Mode, or if none is supplied, using the default Response Mode.
From OAuth 2.0 Multiple Response Type Encoding Practices, 4. None Response Type
none
-
When supplied as the
response_type
parameter in an OAuth 2.0 Authorization Request, the Authorization Server SHOULD NOT return an OAuth 2.0 Authorization Code, Access Token, Access Token Type, or ID Token in a successful response to the grant request. If aredirect_uri
is supplied, the User Agent SHOULD be redirected there after granting or denying access. The request MAY include astate
parameter, and if so, the Authorization Server MUST echo its value as a response parameter when issuing either a successful response or an error response. The default Response Mode for this Response Type is the query encoding. Both successful and error responses SHOULD be returned using the supplied Response Mode, or if none is supplied, using the default Response Mode.
From OAuth 2.0 Multiple Response Type Encoding Practices, 5. Definitions of Multiple-Valued Response Type Combinations
code token
-
When supplied as the value for the
response_type
parameter, a successful response MUST include an Access Token, an Access Token Type, and an Authorization Code. The default Response Mode for this Response Type is the fragment encoding and the query encoding MUST NOT be used. Both successful and error responses SHOULD be returned using the supplied Response Mode, or if none is supplied, using the default Response Mode.
code id_token
-
When supplied as the value for the
response_type
parameter, a successful response MUST include both an Authorization Code and anid_token
. The default Response Mode for this Response Type is the fragment encoding and the query encoding MUST NOT be used. Both successful and error responses SHOULD be returned using the supplied Response Mode, or if none is supplied, using the default Response Mode.
id_token token
-
When supplied as the value for the
response_type
parameter, a successful response MUST include an Access Token, an Access Token Type, and anid_token
. The default Response Mode for this Response Type is the fragment encoding and the query encoding MUST NOT be used. Both successful and error responses SHOULD be returned using the supplied Response Mode, or if none is supplied, using the default Response Mode.
code id_token token
-
When supplied as the value for the
response_type
parameter, a successful response MUST include an Authorization Code, anid_token
, an Access Token, and an Access Token Type. The default Response Mode for this Response Type is the fragment encoding and the query encoding MUST NOT be used. Both successful and error responses SHOULD be returned using the supplied Response Mode, or if none is supplied, using the default Response Mode.
- Author:
- Takahiko Kawasaki
- See Also:
- RFC 6749 (OAuth 2.0), 3.1.1. Response Type, OAuth 2.0 Multiple Response Type Encoding Practices
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CODE
"code"
(1), aresponse_type
to request an authorization code.CODE_ID_TOKEN
"code id_token"
(5), aresponse_type
to request an authorization code and an ID token.CODE_ID_TOKEN_TOKEN
"code id_token token"
(7), aresponse_type
to request an authorization code, an ID token and an access token.CODE_TOKEN
"code token"
(4), aresponse_type
to request an authorization code and an access token.ID_TOKEN
"id_token"
(3), aresponse_type
to request an ID token.ID_TOKEN_TOKEN
"id_token token"
(6), aresponse_type
to request an ID token and an access token.NONE
"none"
(0), aresponse_type
to request no access credentials.TOKEN
"token"
(2), aresponse_type
to request an access token.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsCode()
Check if this response type contains a request for an authorization code.boolean
containsIdToken()
Check if this response type contains a request for an ID token.boolean
containsToken()
Check if this response type contains a request for an access token.static ResponseType
getByValue(short value)
Find an instance of this enum by a value.short
getValue()
Get the integer representation of this enum instance.Version
getVersion()
Get the Authlete version since which this response type has been supported.static ResponseType
parse(String responseType)
Parse a space-separatedresponse_type
values.boolean
requiresImplicitFlow()
Check if this response type requires the Implicit Flow.static ResponseType[]
toArray(int bits)
static int
toBits(EnumSet<ResponseType> set)
static EnumSet<ResponseType>
toSet(int bits)
static EnumSet<ResponseType>
toSet(ResponseType[] array)
String
toString()
static ResponseType
valueOf(String name)
Returns the enum constant of this type with the specified name.static ResponseType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NONE
public static final ResponseType NONE
"none"
(0), aresponse_type
to request no access credentials.
-
CODE
public static final ResponseType CODE
"code"
(1), aresponse_type
to request an authorization code.
-
TOKEN
public static final ResponseType TOKEN
"token"
(2), aresponse_type
to request an access token.
-
ID_TOKEN
public static final ResponseType ID_TOKEN
"id_token"
(3), aresponse_type
to request an ID token.
-
CODE_TOKEN
public static final ResponseType CODE_TOKEN
"code token"
(4), aresponse_type
to request an authorization code and an access token.
-
CODE_ID_TOKEN
public static final ResponseType CODE_ID_TOKEN
"code id_token"
(5), aresponse_type
to request an authorization code and an ID token.
-
ID_TOKEN_TOKEN
public static final ResponseType ID_TOKEN_TOKEN
"id_token token"
(6), aresponse_type
to request an ID token and an access token.
-
CODE_ID_TOKEN_TOKEN
public static final ResponseType CODE_ID_TOKEN_TOKEN
"code id_token token"
(7), aresponse_type
to request an authorization code, an ID token and an access token.
-
-
Method Detail
-
values
public static ResponseType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ResponseType c : ResponseType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ResponseType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getValue
public short getValue()
Get the integer representation of this enum instance.
-
getVersion
public Version getVersion()
Get the Authlete version since which this response type has been supported.- Returns:
- The Authlete version since which this response type has been supported.
- Since:
- 3.54
-
toString
public String toString()
- Overrides:
toString
in classEnum<ResponseType>
-
containsCode
public boolean containsCode()
Check if this response type contains a request for an authorization code.
-
containsIdToken
public boolean containsIdToken()
Check if this response type contains a request for an ID token.
-
containsToken
public boolean containsToken()
Check if this response type contains a request for an access token.
-
requiresImplicitFlow
public boolean requiresImplicitFlow()
Check if this response type requires the Implicit Flow. In other words, check if this response type contains eithertoken
orid_token
.- Returns:
true
if this response type requires the Implicit Flow.- See Also:
- RFC 6749 (OAuth 2.0), 1.3.2. Implicit, OpenID Connect Dynamic Client Registration, 2. Client Metadata, grant_types
-
getByValue
public static ResponseType getByValue(short value)
Find an instance of this enum by a value.- Parameters:
value
- The integer representation of the instance to find.- Returns:
- An instance of this enum, or
null
if not found.
-
parse
public static ResponseType parse(String responseType)
Parse a space-separatedresponse_type
values.- Parameters:
responseType
- A response type. For example,"code id_token"
.- Returns:
ResponseType
instance, ornull
.
-
toBits
public static int toBits(EnumSet<ResponseType> set)
-
toArray
public static ResponseType[] toArray(int bits)
-
toSet
public static EnumSet<ResponseType> toSet(int bits)
-
toSet
public static EnumSet<ResponseType> toSet(ResponseType[] array)
-
-