In this blog, I will try to make you feel comfortable in understanding how you can manage transformations with graphical and JSON text editor. Are you interested in knowing how to map between Source & Target attributes ?
How to Manage Transformations
-
Access the Identity Provisioning administration console.
-
From the UI home page, choose a tile: Source Systems, Target Systems or Proxy Systems.
-
Select a system from the left panel and go to the Transformations tab.
The graphical editor is displayed by default. You can switch to the JSON editor by choosing the code-bracket icon.
-
Choose Edit. You need to work in edit mode to add, modify and delete entities and their configurations.
-
Working with the JSON editor allows you to type changes and perform operations like select, cut, copy and paste the transformation code.
-
Working with the graphical editor allows you to graphically model your changes.
-
-
Save your changes.
Understanding of Transformations in Source & Target
The source path attribute addresses in the internal representation and the target path attribute addresses in the target system are displayed vertically – one below the other.
The transformation expressions and functions are listed in individual lines below the respective sourcePath and targetPath attribute they are applicable for.
Syntax coloring and syntax validation are enabled by default. |
Breaking down Transformations with help of JSON Path
JSONPath is a path expression language for JSON. It is used to query data from JSON datasets and it is similar to XPath query language for XML documents.
JsonPath uses special notation to represent nodes and their connections to adjacent nodes in a JsonPath path.
A mapping configuration is a name-value pair (that is, a transformation expression and its value)
As the name implies JSONPath is heavily inspired by XPath and offers similar syntax and querying capabilities
Let’s take a look at all of the available operators and some examples:
JSON filter | Description |
---|---|
$ | the root object/element |
@ | the current object/element |
. or [] | child operator |
.. | recursive descent. JSONPath borrows this syntax from E4X. |
* | wildcard. All objects/elements regardless their names. |
[] | subscript operator. XPath uses it to iterate over element collections and for predicates. In Javascript and JSON it is the native array operator. |
[,] | Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set. |
[start:end:step] | array slice operator borrowed from ES4. |
?() | applies a filter (script) expression. |
() | script expression, using the underlying script engine. |
We now have a good understanding of the JsonPath functionality. So, let’s look at an example.
Example – JSON Payload from SAP IAS for Individual user
{
"id": "aafea146-1d35-476c-a694-d8cdf7de31f8",
"meta": {
"created": "2022-07-18T13:01:06Z",
"lastModified": "2022-07-18T13:01:06Z",
"location": "https://<iastenant>.accounts.ondemand.com/scim/Users/aafea146-1d35-476c-a694-d8cdf7de31f8",
"version": "2118f009-97bb-4b3e-9b57-48ac3c62b833",
"resourceType": "User"
},
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:extension:sap:2.0:User"
],
"userName": "yoga",
"name": {
"familyName": "Muthaiah",
"givenName": "Yogananda"
},
"active": true,
"emails": [
{
"value": "abc@domain.com",
"primary": true
}
],
"urn:ietf:params:scim:schemas:extension:sap:2.0:User": {
"emails": [
{
"value": "abc@domain.com",
"primary": true
}
],
"userUuid": "aafea146-1d35-476c-a694-d8cdf7de31f8",
"mailVerified": false,
"userId": "P000042",
"status": "active"
}
}
Go to JSON Path – Insert your JSON Payload to get JSON Schema Path for mapping this into your Transformation
Example for Schemas
Example to filter if email is a Primary
Example for filtering userName field