Create a consumer

更新时间:
复制 MD 格式

AI Gateway uses consumers to enable authentication for routes and APIs. This topic shows you how to manage consumers in the AI Gateway console.

Procedure

  1. Log on to the AI Gateway console.

  2. In the navigation pane on the left, choose Consumers. In the top menu bar, select a region.

  3. In the upper-left corner of the Consumers page, click Create a consumer.

  4. On the Create a consumer page, enter a consumer name, select an authentication method, and click Create.

    JWT authentication

    Parameter

    Description

    Consumer Name

    Enter a custom name for the consumer.

    Status

    Specifies the status of the consumer. Valid values are Enabled and Disabled. After you create the consumer, you can manually enable or disable it.

    Description

    Enter a description for the consumer.

    Authentication Method

    Specifies the authentication method for the consumer. Supported methods are JWT authentication and API key authentication.

    Key Type

    • Symmetric Key: AI Gateway generates a default JSON Web Key Set (JWKS) configuration. This configuration is unique for each consumer and contains the key used to encrypt or decrypt the token.

    • Asymmetric Key: You must enter a complete JWKS configuration. Use a private key to encrypt the token. The gateway uses the public key configured in the JWKS for decryption.

    JWKS

    For more information about the JWKS specification, see JSON Web Key (JWK).

    JWKS Token Configuration

    • Type: Specifies the type of the token parameter. The default value is header.

    • Key: The name of the token parameter.

    • Prefix: Specifies the prefix for the token parameter. By default, the token is placed in the Authorization header with the Bearer prefix, for example, Authorization: Bearer <token>.

    • Enable Passthrough: Select this option to pass the token parameter to the backend service.

    Consumer Identity in JWKS Payload

    Specify a key-value pair from the JWKS payload to identify the consumer. By default, AI Gateway provides a key-value pair where the key is uid and the value is a random string. You can modify this pair as needed.

    The following code shows a sample payload configuration:

    {
      "uid": "11215ac069234abcb8944232b79ae711"
    }

    API key authentication

    Parameter

    Description

    Consumer Name

    Enter a custom name for the consumer.

    Status

    Specifies the status of the consumer. Valid values are Enabled and Disabled. After you create the consumer, you can manually enable or disable it.

    Description

    Enter a description for the consumer.

    Authentication Method

    Specifies the authentication method for the consumer. Supported methods are JWT authentication and API key authentication.

    Generation Method

    • System-generated: The system automatically generates an API key credential.

    • Custom: Specify a custom API key credential and its credential source.

    Voucher

    Specify the custom API key credential.

    Credential Source

    Specifies the location and name in the request from which the gateway extracts the credential. The following sources are supported:

    • Authorization: Bearer <token>

    • Custom HTTP header

    • Custom query parameter