Hello Experts,
I have created a source (web service connector) for an application using custom auth and an API token. Some of the below HTTP operations I have configured (A, B & C) works fine but I need help with setting up the other operations (D, E & F) by creating before and after operations rules. See the following details regarding different endpoints and mapping/config.
HTTP Operations:
A. Operation name: Test Connection
Operation type: Test Connection
B. Operation name: Account aggregation-1
Operation type: Account aggregation
Context URL: /api/v1/users
(gets user list)
HTTP Method: GET
Headers: key (Authentication) - value (xxxxxxxx)
key (Content-Type) - value (application/json)
Body (raw): {}
Response Info: Root path: $, Success codes: 2**
Response mapping:
schema attribute: identity, attribute path: identity
schema attribute: username, attribute path: username
C. Operation name: Account aggregation-2
Operation type: Account aggregation
Context URL: /api/v1/users/$response.username$/roles
(gets assigned roles of each user)
HTTP Method: GET
Headers: same as above
Response Info: same as above
Response mapping:
schema attribute: name, attribute path: $.data[*][“roleName”]
schema attribute: username, attribute path: username
Parent endpoint name: Account aggregation-1
The above three operations works fine as expected.
D. Operation name: Create Account
Operation type: Create Account
Context URL: /api/v1/users/{username}/roles
(creates user if it doesn’t exist and assigns role to the intended user and {username} is a dynamic value from the access request payload).
HTTP Method: POST
Headers: same as above
Body (raw): `{“role”: [“roleName”]} - this would be a dynamic value (entitlement name) from the access request payload.
Response info: same as above
Response mapping:
schema attribute: identity, attribute path: identity
schema attribute: username, attribute path: username
E. Operation name: Add Entitlement
Operation type: Add Entitlement
Context URL: /api/v1/users/{username}/roles
(assigns role to the intended user and {username} is a dynamic value from the access request payload).
HTTP Method: POST
Headers: same as above
Body (raw): {"role": ["roleName"]}
- this would be a dynamic value i.e entitlement name from the access request payload.
Response info: same as above
Response mapping:
schema attribute: name - attribute path: $.data[*][“roleName”]
schema attribute: username - attribute path: username
F. Operation name: Remove Entitlement
Operation type: Remove Entitlement
Context URL: /api/v1/users/{username}/roles/{role}
(removes role from the intended user, {username} and {role} are dynamic values from the access request payload).
HTTP Method: POST
Headers: same as above
Body (raw): {“role”: [“roleName”]} - this is a dynamic value
Response info: same as above
I would appreciate if you could please;
1: Advise on the provisioningPlan rules needed for above three operations.
2: Share the code for before and after operation rules
3: How to pass these dynamic values i.e {username} in the endpoint URLs and {roleName} in the request body?
4: Do you think the following create account provisioning policy should work fine?
Thanks!
{
"name": "",
"description": null,
"usageType": "CREATE",
"fields": [
{
"name": "Name",
"transform": {
"type": "identityAttribute",
"attributes": {
"name": "username"
}
},
"attributes": {},
"isRequired": false,
"type": "string",
"isMultiValued": false
},
{
"name": "PassMain",
"transform": {
"type": "rule",
"attributes": {
"name": "Create Password"
}
},
"attributes": {},
"isRequired": false,
"type": "string",
"isMultiValued": false
},
{
"name": "username",
"transform": null,
"attributes": {},
"isRequired": false,
"type": "string",
"isMultiValued": false
}
]
}