2021-10-07 15:50:57 +02:00
{
2021-10-07 18:54:25 +02:00
"ownerApp" : "Orchestrator",
2021-10-07 15:50:57 +02:00
"name" : "delete_system_service",
"createBy" : "Marco Lettere",
"description": "Delete a system service from KC and IS",
"version" : 1,
"ownerEmail" : "marco.lettere@nubisware.com",
"inputParameters" : ["client_id"],
"tasks" : [
{
2023-10-13 09:58:38 +02:00
"name": "INLINE_TASK",
2021-10-07 15:50:57 +02:00
"taskReferenceName": "init",
2023-10-13 09:58:38 +02:00
"type": "INLINE",
2021-10-07 15:50:57 +02:00
"inputParameters": {
2023-10-13 09:58:38 +02:00
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
"id" : "${workflow.input.client_id}",
"evaluatorType" : "javascript",
"expression" : "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; function f(){if(e($.id)) throw('Client ID must not be empty');} f()"
2021-10-07 15:50:57 +02:00
}
},
{
"name" : "pyrest",
"taskReferenceName" : "authorize",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak}/protocol/openid-connect/token",
"method" : "POST",
"headers" : {
"Accept" : "application/json"
},
"body" : {
"client_id" : "orchestrator",
"client_secret" : "{{ keycloak_auth }}",
"grant_type" : "client_credentials"
}
}
},
{
"name" : "pyrest",
"taskReferenceName" : "lookup_client",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak_admin}/clients",
"params" : { "clientId" : "${workflow.input.client_id}"},
"method" : "GET",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}",
"Accept" : "application/json"
}
}
},
2021-10-14 10:39:27 +02:00
{
2023-10-13 09:58:38 +02:00
"name": "INLINE_TASK",
2021-10-14 10:39:27 +02:00
"taskReferenceName": "check",
2023-10-13 09:58:38 +02:00
"type": "INLINE",
2021-10-14 10:39:27 +02:00
"inputParameters": {
2023-10-13 09:58:38 +02:00
"list" : "${lookup_client.output.body}",
"evaluatorType" : "javascript",
"expression" : "function f(){if($.list.length === 0 || $.list.length > 1) throw('No client found with client_id or ambiguous query returned multiple clients.')} f()"
2021-10-14 10:39:27 +02:00
}
},
2021-10-07 15:50:57 +02:00
{
"name" : "pyrest",
"taskReferenceName" : "delete_client",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak_admin}/clients/${lookup_client.output.body[0].id}",
"method" : "DELETE",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}"
}
}
}
]
}