ansible-role-conductor-work.../templates/add_all_member_roles.json.j2

76 lines
2.1 KiB
Plaintext
Raw Normal View History

{
"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"
}
}
},
2021-06-04 10:49:24 +02:00
{
"name": "jq_1",
"taskReferenceName": "to_array",
"type": "JSON_JQ_TRANSFORM",
"inputParameters": {
2021-06-04 10:52:26 +02:00
"role": "${retrieve_member_role.output.body}",
2021-06-04 12:01:50 +02:00
"queryExpression" : ".role"
2021-06-04 10:49:24 +02:00
}
},
{
"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}",
2021-06-04 12:01:50 +02:00
"Content-Type" : "application/json",
2021-06-04 11:15:35 +02:00
"Accept":"application/json"
},
2021-06-04 12:01:50 +02:00
"body" : "${to_array.output.resultList}"
}
}
2021-06-04 09:36:27 +02:00
]
}