This topic describes the basic authentication plug-in provided by API Gateway. For more information about HTTP authentication, see HTTP authentication.
Configure a basic authentication plug-in
You can configure a basic authentication plug-in in JSON or YAML format. The two formats have the same schema and can be converted to each other by using a conversion tool. The following code provides a template in YAML format:
---
users:
- username: alice
password: 123456
- username: bob
password: 666666
- username: charlie
password: 888888
- username: dave
password: 111111
Use a basic authentication plug-in in combination with a plug-in dataset
Create a plug-in dataset
Log on to the API Gateway console. In the left-side navigation pane, choose Open API > Plug-ins. On the page that appears, click the Custom Dataset tab.
Click Create Dataset in the upper-right corner. In the dialog box that appears, specify a name for the dataset, select BASIC_AUTH_ACCESS from the Type drop-down list, and then click Confirm.
Click the created dataset. On the page that appears, click Create Dataset Entry. In the Create Dataset Entry dialog box, specify the parameters. Username, Password, and Validity Period are required.
Example
---
users:
- username: alice
password: 123456
usersDatasetId: 42f224a17a3e4bd9b098XXXXXXXX3f # The dataset ID.
Basic authentication plug-ins support the following special characters: @, !, <, >, #, $, %, and *.
For more information about plug-in datasets, see Plug-in dataset.