Enum ResponseType

  • All Implemented Interfaces:
    Serializable, Comparable<ResponseType>

    public enum ResponseType
    extends Enum<ResponseType>
    Values for response_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 parameter id_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 a redirect_uri is supplied, the User Agent SHOULD be redirected there after granting or denying access. The request MAY include a state 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 a redirect_uri is supplied, the User Agent SHOULD be redirected there after granting or denying access. The request MAY include a state 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 an id_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 an id_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, an id_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 Detail

      • NONE

        public static final ResponseType NONE
        "none" (0), a response_type to request no access credentials.
      • CODE

        public static final ResponseType CODE
        "code" (1), a response_type to request an authorization code.
      • TOKEN

        public static final ResponseType TOKEN
        "token" (2), a response_type to request an access token.
      • ID_TOKEN

        public static final ResponseType ID_TOKEN
        "id_token" (3), a response_type to request an ID token.
      • CODE_TOKEN

        public static final ResponseType CODE_TOKEN
        "code token" (4), a response_type to request an authorization code and an access token.
      • CODE_ID_TOKEN

        public static final ResponseType CODE_ID_TOKEN
        "code id_token" (5), a response_type to request an authorization code and an ID token.
      • ID_TOKEN_TOKEN

        public static final ResponseType ID_TOKEN_TOKEN
        "id_token token" (6), a response_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), a response_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 name
        NullPointerException - 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
      • 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.
      • 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-separated response_type values.
        Parameters:
        responseType - A response type. For example, "code id_token".
        Returns:
        ResponseType instance, or null.
      • toArray

        public static ResponseType[] toArray​(int bits)