Package com.authlete.common.types
Enum ResponseMode
- java.lang.Object
-
- java.lang.Enum<ResponseMode>
-
- com.authlete.common.types.ResponseMode
-
- All Implemented Interfaces:
Serializable
,Comparable<ResponseMode>
public enum ResponseMode extends Enum<ResponseMode>
Values forresponse_mode
.From OAuth 2.0 Multiple Response Type Encoding Practices, 2.1. Response Modes
query
-
In this mode, Authorization Response parameters are encoded in
the query string added to the
redirect_uri
when redirecting back to the Client.
fragment
-
In this mode, Authorization Response parameters are encoded in
the fragment added to the
redirect_uri
when redirecting back to the Client.
From OAuth 2.0 Form Post Response Mode
form_post
-
In this mode, Authorization Response parameters are encoded as HTML
form values that are auto-submitted in the User Agent, and thus are
transmitted via the HTTP
POST
method to the Client, with the result parameters being encoded in the body using theapplication/x-www-form-urlencoded
format. The action attribute of the form MUST be the Client's Redirection URI. The method of the form attribute MUST bePOST
.
Any technique supported by the User Agent MAY be used to cause the submission of the form, and any form content necessary to support this MAY be included, such as submit controls and client-side scripting commands. However, the Client MUST be able to process the message without regard for the mechanism by which the form submission was initiated.
From Financial-grade API: JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)
jwt
- In this mode, Authorization Response parameters are packed into a JWT and the resultant JWT is embedded in the default place (the query part of the redirect URI, the fragment part of the redirect URI, or the HTML form in the response body).
query.jwt
- In this mode, Authorization Response parameters are packed into a JWT and the resultant JWT is embedded in the query part of the redirect URI.
fragment.jwt
- In this mode, Authorization Response parameters are packed into a JWT and the resultant JWT is embedded in the fragment part of the redirect URI.
form_post.jwt
- In this mode, Authorization Response parameters are packed into a JWT and the resultant JWT is embedded in the HTML form in the response body.
- Author:
- Takahiko Kawasaki
- See Also:
- OAuth 2.0 Form Post Response Mode, Financial-grade API: JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FORM_POST
"form_post"
(3);response_mode
to request authorization response parameters be encoded as HTML form values.FORM_POST_JWT
"form_post.jwt"
(7);response_mode
to request authorization response parameters be encoded as JWT and embedded in the HTML form in the response body.FRAGMENT
"fragment"
(2);response_mode
to request authorization response parameters be encoded in the fragment.FRAGMENT_JWT
"fragment.jwt"
(6);response_mode
to request authorization response parameters be encoded as JWT and embedded in the fragment part of the redirect URI.JWT
"jwt"
(4);response_mode
to request authorization response parameters be encoded as JWT and embedded in the default part.QUERY
"query"
(1);response_mode
to request authorization response parameters be encoded in the query string.QUERY_JWT
"query.jwt"
(5);response_mode
to request authorization response parameters be encoded as JWT and embedded in the query part of the redirect URI.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ResponseMode
getByValue(short value)
Find an instance of this enum by a value.short
getValue()
Get the integer representation of this enum instance.boolean
isFormPostRequired()
Check whether this response mode requires response parameters be embedded in the HTML form in the response body.boolean
isFragmentRequired()
Check whether this response mode requires response parameters be embedded in the fragment part of the redirect URI.boolean
isJwtRequired()
Check whether this response mode requires response parameters be packed into a JWT.boolean
isQueryRequired()
Check whether this response mode requires response parameters be embedded in the query part of the redirect URI.static ResponseMode
parse(String responseMode)
ConvertString
toResponseMode
.static ResponseMode[]
toArray(int bits)
static int
toBits(EnumSet<ResponseMode> set)
static EnumSet<ResponseMode>
toSet(int bits)
static EnumSet<ResponseMode>
toSet(ResponseMode[] array)
String
toString()
static ResponseMode
valueOf(String name)
Returns the enum constant of this type with the specified name.static ResponseMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.ResponseMode
withJwt()
Get theResponseMode
instance corresponding to this instance that requires JWT.ResponseMode
withoutJwt()
Get theResponseMode
instance corresponding to this instance that does not require JWT.
-
-
-
Enum Constant Detail
-
QUERY
public static final ResponseMode QUERY
"query"
(1);response_mode
to request authorization response parameters be encoded in the query string.
-
FRAGMENT
public static final ResponseMode FRAGMENT
"fragment"
(2);response_mode
to request authorization response parameters be encoded in the fragment.
-
FORM_POST
public static final ResponseMode FORM_POST
"form_post"
(3);response_mode
to request authorization response parameters be encoded as HTML form values.
-
JWT
public static final ResponseMode JWT
"jwt"
(4);response_mode
to request authorization response parameters be encoded as JWT and embedded in the default part. This is a shortcut of"{default}.jwt"
.- Since:
- 2.27
-
QUERY_JWT
public static final ResponseMode QUERY_JWT
"query.jwt"
(5);response_mode
to request authorization response parameters be encoded as JWT and embedded in the query part of the redirect URI.- Since:
- 2.27
-
FRAGMENT_JWT
public static final ResponseMode FRAGMENT_JWT
"fragment.jwt"
(6);response_mode
to request authorization response parameters be encoded as JWT and embedded in the fragment part of the redirect URI.- Since:
- 2.27
-
FORM_POST_JWT
public static final ResponseMode FORM_POST_JWT
"form_post.jwt"
(7);response_mode
to request authorization response parameters be encoded as JWT and embedded in the HTML form in the response body.- Since:
- 2.27
-
-
Method Detail
-
values
public static ResponseMode[] 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 (ResponseMode c : ResponseMode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ResponseMode 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.
-
toString
public String toString()
- Overrides:
toString
in classEnum<ResponseMode>
-
getByValue
public static ResponseMode 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.
-
isJwtRequired
public boolean isJwtRequired()
Check whether this response mode requires response parameters be packed into a JWT.- Returns:
true
if this response mode is one ofJWT
,QUERY_JWT
,FRAGMENT_JWT
andFORM_POST_JWT
.- Since:
- 2.27
-
isQueryRequired
public boolean isQueryRequired()
Check whether this response mode requires response parameters be embedded in the query part of the redirect URI.
-
isFragmentRequired
public boolean isFragmentRequired()
Check whether this response mode requires response parameters be embedded in the fragment part of the redirect URI.- Returns:
true
if this response mode is eitherFRAGMENT
orFRAGMENT_JWT
. Otherwise,false
.- Since:
- 2.27
-
isFormPostRequired
public boolean isFormPostRequired()
Check whether this response mode requires response parameters be embedded in the HTML form in the response body.- Returns:
true
if this response mode is eitherFORM_POST
orFORM_POST_JWT
.- Since:
- 2.27
-
withJwt
public ResponseMode withJwt()
Get theResponseMode
instance corresponding to this instance that requires JWT.this
instancereturned instance QUERY
QUERY_JWT
FRAGMENT
FRAGMENT_JWT
FORM_POST
FORM_POST_JWT
JWT
JWT
QUERY_JWT
QUERY_JWT
FRAGMENT_JWT
FRAGMENT_JWT
FORM_POST_JWT
FORM_POST_JWT
- Returns:
- The
ResponseMode
instance corresponding to this instance that requires JWT. - Since:
- 2.28
-
withoutJwt
public ResponseMode withoutJwt()
Get theResponseMode
instance corresponding to this instance that does not require JWT. Note that if this instance isJWT
, this method returnsnull
.this
instancereturned instance QUERY
QUERY
FRAGMENT
FRAGMENT
FORM_POST
FORM_POST
JWT
null
QUERY_JWT
QUERY
FRAGMENT_JWT
FRAGMENT
FORM_POST_JWT
FORM_POST
- Returns:
- The
ResponseMode
instance corresponding to this instance that does not require JWT. - Since:
- 2.28
-
parse
public static ResponseMode parse(String responseMode)
ConvertString
toResponseMode
.- Parameters:
responseMode
- A response mode. For example,"query"
.- Returns:
ResponseMode
instance, ornull
.
-
toBits
public static int toBits(EnumSet<ResponseMode> set)
-
toArray
public static ResponseMode[] toArray(int bits)
-
toSet
public static EnumSet<ResponseMode> toSet(int bits)
-
toSet
public static EnumSet<ResponseMode> toSet(ResponseMode[] array)
-
-