Enum ResponseMode

  • All Implemented Interfaces:
    Serializable, Comparable<ResponseMode>

    public enum ResponseMode
    extends Enum<ResponseMode>
    Values for response_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 the application/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 be POST.

    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.
    • 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 name
        NullPointerException - if the argument is null
      • getValue

        public short getValue()
        Get the integer representation of this enum instance.
      • 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 of JWT, QUERY_JWT, FRAGMENT_JWT and FORM_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.
        Returns:
        true if this response mode is either QUERY or QUERY_JWT. Otherwise, false.
        Since:
        2.27
      • 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 either FRAGMENT or FRAGMENT_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 either FORM_POST or FORM_POST_JWT.
        Since:
        2.27
      • parse

        public static ResponseMode parse​(String responseMode)
        Convert String to ResponseMode.
        Parameters:
        responseMode - A response mode. For example, "query".
        Returns:
        ResponseMode instance, or null.
      • toArray

        public static ResponseMode[] toArray​(int bits)