HTTP Basic Authentication
To support invoking of REST APIs secured with Basic Authentication, use the BASIC_AUTH
managed security policy. You can customize the security policy as needed for a connection definition.
Overview
With HTTP basic authentication, the client sends HTTP requests with the
Authorization header that contains the word Basic followed by a space and a
Base64 encoded string that contains a user name and password in the following
format: username:password
.
To add the HTTP Basic Authentication policy to your document, use the available authentication scheme template. See Implement a New Connection Definition.
Note:
Some applications use different names forusername
, such as accountId
. You can modify the managed policy to override the default name of a property.
Security Properties
A connection definition that uses this
security policy defines the following properties in the
securityProperties
section. See Connection Properties and Sample Code.
The values in the name
,
displayName
,
shortDescription
, and
description
columns list the default values
that appear when you insert a security policy into an adapter
definition document. You can update these values if needed.
name | displayName | shortDescription | description | Data type | Required |
---|---|---|---|---|---|
|
|
|
|
String |
Yes |
|
|
|
|
Password |
Yes |
Sample Code: Basic Authentication
The following code sample shows the default configuration for HTTP basic authentication within a connection in the adapter definition document.
"securityPolicies": [
{
"type": "managed",
"policy": "BASIC_AUTH",
"description": "HTTP Basic Authentication",
"displayName": "HTTP Basic Authentication",
"scope": "ACTION",
"securityProperties": [
{
"name": "username",
"displayName": "Username",
"description": "Registered username.",
"shortDescription": "Example: AC1234",
"hidden": false,
"required": true
},
{
"name": "password",
"displayName": "Password",
"description": "Password for the registered user.",
"shortDescription": "Example: <password for the user>",
"hidden": false,
"required": true
}
]
}
]