Hello,
I’m looking for a way to update attribute statement array of custom SAML2.0 application.
Currently I only see a way to define attribute statement during app creation. What happens if I need to update only the attribute statement array part?Is there a way to do that without re-creating the whole app?
The idea is to add additional section here as a part of the app update call and not app creation: “attributeStatements”: [
{
“type”: “EXPRESSION”,
“name”: “NameFormat”,
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:uri”,
“values”: [
“urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified”
]
},
{
“type”: “EXPRESSION”,
“name”: “sn”,
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:uri”,
“values”: [
“user.lastName”
]
},
{
“type”: “EXPRESSION”,
“name”: “givenName”,
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:uri”,
“values”: [
“user.firstName”
]
}
Thank you @erik yes, it worked for me. I had to convert the response into python object, update as you mentioned, convert back onto json object and post back:
response = requests.get(url=URL+f"/{app_id}“, headers=headers)
json_result= response.json()
new_struct= {
“type”: “GROUP”,
“name”: “thenameyouassign”,
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified”,
“filterType”: “EQUALS”,
“filterValue”: “your-filter”
}
json_result[‘settings’][‘signOn’][‘attributeStatements’].append(new_struct)
response = requests.put(url=URL+f”/{app_id}", headers=headers, data=json.dumps(json_result))