Configuring attributes with custom functions
Use the following procedure and cURL commands to configure custom functions to attributes.
Procedure
-
Configure an API client with the Manage Attributes entitlement.
See Creating API clients.
-
Use the following client credentials to obtain an access token.
curl --location --request POST 'https://{{tenant}}/oidc/endpoint/default/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id={{client_id}}' \ --data-urlencode 'client_secret={{client_secret}}' - Copy the
access_tokenin the JSON response. - Create an attribute with the custom function.Similarly, you can update an attribute by using
PUT /v1.0/attributes/{attrId}. Notice thefunctionproperty in the following code example.curl --location --request POST 'https://{{tenant}}/v1.0/attributes' \ --header 'Authorization: Bearer {{access_token}}' \ --header 'Content-Type: application/json' \ --data-raw '{ "name": "echoedUserID", "description": " ", "scope": "tenant", "sourceType": "static", "datatype": "string", "tags": [ "sso" ], "value": "N/A", "function": { "custom": "hc.GetAsJson(\"https://postman-echo.com/get?foo1=bar1&foo2=bar2&userid=\" + user.id, { \"User-Agent\":\"Something\" }).args.userid" } }' - Go to the application and configure attribute mappings as needed.