AI Gateway uses consumers to enable authentication for routes and APIs. You can manage consumers in the AI Gateway console.
Procedure
Log on to the AI Gateway console.
In the navigation pane on the left, choose Consumers. In the top menu bar, select a region.
-
In the upper-left corner of the Consumers page, click Create a consumer.
-
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
The status of the consumer. Valid values: Enabled and Disabled. After you create the consumer, you can manually enable or disable it.
Description
Enter a description for the consumer.
Authentication Method
The authentication method for the consumer. Supported methods: 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: The type of the token parameter. Default value: header.
-
Key: The name of the token parameter.
-
Prefix: 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 forward 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 pair where the key is uid and the value is a random string. You can modify this pair as needed.
Sample payload:
{ "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: Enabled and Disabled. After you create the consumer, you can manually enable or disable it.
Description
Enter a description for the consumer.
Authentication Method
The authentication method for the consumer. Supported methods: 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
The location and name in the request from which the gateway extracts the credential. Supported sources:
-
Authorization: Bearer <token>
-
Custom HTTP header
-
Custom query parameter
-