You can use the basic-authentication
policy to manage basic authentication headers sent in API calls. The policy compares the user and password sent in the basic authentication header to an APIM user to determine if the user credentials are valid.
To use the policy in an API, you need to:
-
configure an LDAP, inline or http resource for your API plan, which specifies where the APIM users are stored
-
configure a basic authentication policy for the API flows
Note
|
LDAP, inline and http resources are not part of the default APIM configuration, so you must configure an LDAP, inline or http resource for APIM first, as described in the Developer Guide. |
Plugin version | APIM version |
---|---|
1.4.x and upper |
3.15.x to latest |
Up to 1.x |
Up to 3.14.x |
After successful authentication, connected username is stored in context attributes, accessible with context.attributes['user']
expression language.
In order to display the connected username in API logging, you can enable the environment setting Gateway > API logging > Display end user on API Logging
.
This adds a user
column in the logs table.