SCIM module - save extended form value
SCIM module was added in CzechIdM 8.1.0.
We want to create user (~IdM identity) with an extended attribute (~IdM form value).
Extended attributes are defined as extended schema, which can be added to resources implementing FormableResource interface (available resources with their schemas can be found from schema endpoint).
What do you need before you start
- We need to install CzechIdM 8.1.0 (and higher). We have CzechIdM installed for this tutorial on server
http://localhost:8080/idm. - We need to install Scim module into CzechIdM.
- Create identity, which will have permission to create and read reports. We are using demo
admin:adminidentity.
Note: Swagger can be used for try this examples.
01 Read form definition
The first thing ee need to now, which extended attributes are available for given resources. We'll use FormDefinition resource ⇒ form definition can be found by type (~definition's entity type owner. IdM entity name has to be used, extended attributes are CzechIdM specific) and code (~definition name):
curl -X GET --header 'Accept: application/json' --header 'Authorization: Basic YWRtaW46YWRtaW4=' 'http://localhost:8080/idm/api/v1/scim/FormDefinitions?filter=type%2520eq%2520%2522eu.bcvsolutions.idm.core.model.entity.IdmIdentity%2522%2520and%2520code%2520eq%2520%2522default%2522&sortOrder=ascending&startIndex=1&count=10'
02 Save form values
Form definition response contains available attributes and their persistent type (~data type). We need to set value attribute by defined persistent type. In this example attribute extAttr has type SHORTTEXT and that is the reason, why shortTextValue attribute has to be filled:
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic YWRtaW46YWRtaW4=' -d '{ "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:CzechIdM:1.0:Form" ], "userName": "scimTwo", "urn:ietf:params:scim:schemas:CzechIdM:1.0:Form": { "forms" : [{ "code": "default", "attributes": [{ "code": "extAttr", "values": [{ "shortTextValue": "test" }] } ] } ]} }' 'http://localhost:8080/idm/api/v1/scim/Users'