76 lines
2.1 KiB
Django/Jinja
76 lines
2.1 KiB
Django/Jinja
{
|
|
"ownerApp" : "Orchestrator",
|
|
"name" : "add_all_member_roles",
|
|
"createBy" : "Marco Lettere",
|
|
"description": "Add all member roles of every context to the KC system service client identified by client",
|
|
"version" : 1,
|
|
"ownerEmail" : "marco.lettere@nubisware.com",
|
|
"inputParameters" : ["context","client"],
|
|
"tasks" : [
|
|
{
|
|
"name": "LAMBDA_TASK",
|
|
"taskReferenceName": "init",
|
|
"type": "LAMBDA",
|
|
"inputParameters": {
|
|
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
|
|
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
|
|
"scriptExpression": "1 == 1"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"taskReferenceName" : "authorize",
|
|
"type" : "SIMPLE",
|
|
"inputParameters" : {
|
|
"url" : "{{ keycloak }}/master/protocol/openid-connect/token",
|
|
"method" : "POST",
|
|
"headers" : {
|
|
"Accept" : "application/json"
|
|
},
|
|
"body" : {
|
|
"client_id" : "orchestrator",
|
|
"client_secret" : "{{ keycloak_auth_master }}",
|
|
"grant_type" : "client_credentials"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"type" : "SIMPLE",
|
|
"taskReferenceName": "retrieve_member_role",
|
|
"inputParameters" : {
|
|
"url" : "${init.input.keycloak_admin}/clients/${workflow.input.context.id}/roles/Member",
|
|
"method" :"GET",
|
|
"headers" : {
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
"Accept" : "application/json"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "jq_1",
|
|
"taskReferenceName": "to_array",
|
|
"type": "JSON_JQ_TRANSFORM",
|
|
"inputParameters": {
|
|
"role": "${retrieve_member_role.output.body}",
|
|
"queryExpression" : ".role"
|
|
}
|
|
},
|
|
{
|
|
"name" : "pyrest",
|
|
"type" : "SIMPLE",
|
|
"taskReferenceName": "assign_member_role",
|
|
"inputParameters" : {
|
|
"url" : "${init.input.keycloak_admin}/users/${workflow.input.client}/role-mappings/clients/${retrieve_member_role.output.body.containerId}",
|
|
"method" :"POST",
|
|
"headers" : {
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
"Content-Type" : "application/json",
|
|
"Accept":"application/json"
|
|
},
|
|
"body" : "${to_array.output.resultList}"
|
|
}
|
|
}
|
|
]
|
|
}
|