General Information
Policy Type
Endpoints
List Policies
Add Policy
Update Policy
Delete Policy
List Policies
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
Response
Success Response (200 OK)
cURL Example
Add Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example - PasswordText
Full JSON Body Example - PasswordDigest
Full JSON Body Example - Minimal Configuration
Request Body Fields
operationMetadata
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| targetScope | string | Yes | - | Policy scope: ALL or ENDPOINT |
| targetEndpoint | string | No* | - | Endpoint path (required if targetScope=ENDPOINT) |
| targetEndpointHTTPMethod | string | No* | - | HTTP method (required if targetScope=ENDPOINT) |
| targetPipeline | string | Yes | - | Pipeline: REQUEST, RESPONSE, or ERROR |
| deploy | boolean | No | true | Whether to deploy after adding policy |
| deployTargetEnvironmentNameList | array | No | [] | List of environment names to deploy to |
| order | integer | No | null | Policy execution order (starts from 1) |
ALL- Policy applies to all endpointsENDPOINT- Policy applies only to specified endpoint
REQUEST- Executes in request pipeline (adds UsernameToken to outgoing requests)RESPONSE- Executes in response pipeline (adds UsernameToken to outgoing responses)ERROR- Executes in error pipeline
GET,POST,PUT,DELETE,PATCH,OPTIONS,HEAD
policy
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| type | string | Yes | - | Policy type: policy-ws-security-username |
| description | string | No | - | Policy description |
| active | boolean | No | true | Whether policy is active |
| mustUnderstand | boolean | No | true | WS-Security header mustUnderstand attribute |
| username | string | Yes | - | UsernameToken username |
| password | string | Yes | - | UsernameToken password |
| passwordType | string | Yes | - | UsernameToken password type. See EnumWsSecurityPasswordType |
| nonce | boolean | No | false | Add nonce to UsernameToken |
| created | boolean | No | false | Add created timestamp to UsernameToken |
EnumWsSecurityPasswordType
PasswordText- Plain text password (less secure)PasswordDigest- Password digest (hashed password, more secure, recommended)
Note
username,password, andpasswordTypeare required.nonceandcreatedadd additional security to UsernameToken.
Response
Success Response (200 OK)
cURL Example
Update Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
Delete Policy
Endpoint
Request
Headers
| Header | Value |
|---|---|
| Authorization | Bearer {token} |
| Content-Type | application/json |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| projectName | string | Yes | Project name |
| apiProxyName | string | Yes | API Proxy name |
| policyName | string | Yes | Policy name |
Request Body
Full JSON Body Example
Response
Success Response (200 OK)
Notes and Warnings
-
Password Types:
PasswordText- Plain text password (less secure, not recommended for production)PasswordDigest- Hashed password (more secure, recommended)
-
Nonce and Created:
nonce: true- Adds random nonce to prevent replay attackscreated: true- Adds timestamp to UsernameToken- Both enhance security and are recommended
-
Security:
- Password digest uses SHA-1 hash with nonce and timestamp
- More secure than plain text password
- Recommended for production use
- Performance: UsernameToken adds minimal overhead. Use for necessary authentication.
-
Pipeline:
REQUESTpipeline adds UsernameToken to outgoing requestsRESPONSEpipeline adds UsernameToken to outgoing responses
- Error Handling: Invalid username/password configuration causes policy to fail
-
Deployment: Policy changes require deployment to take effect. Set
deploy: trueor deploy manually.
Related Documentation
- List Policies - List all policies
- Add Policy - General policy addition guide
- Update Policy - General policy update guide
- Delete Policy - General policy deletion guide
- WS Security To Target Policy - Complete WS-Security configuration

