2021-06-04 09:26:00 +02:00
|
|
|
{
|
|
|
|
"ownerApp" : "Orchestrator",
|
2021-06-04 09:50:14 +02:00
|
|
|
"name" : "create_system_service",
|
2021-06-04 09:26:00 +02:00
|
|
|
"createBy" : "Marco Lettere",
|
|
|
|
"description": "Create a confidential client for software procedures that need to be members of each VO and VRE",
|
|
|
|
"version" : 1,
|
|
|
|
"ownerEmail" : "marco.lettere@nubisware.com",
|
2021-10-07 14:02:16 +02:00
|
|
|
"inputParameters" : ["client_id", "client_secret", "description"],
|
2021-06-04 09:26:00 +02:00
|
|
|
"tasks" : [
|
|
|
|
{
|
2021-06-04 09:36:27 +02:00
|
|
|
"name": "LAMBDA_TASK",
|
|
|
|
"taskReferenceName": "init",
|
|
|
|
"type": "LAMBDA",
|
|
|
|
"inputParameters": {
|
|
|
|
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
|
|
|
|
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
|
2021-10-07 14:02:16 +02:00
|
|
|
"id" : "${workflow.input.client_id}",
|
|
|
|
"secret" : "${workflow.input.client_secret}",
|
|
|
|
"description" : "${workflow.input.description}",
|
2021-10-14 10:39:27 +02:00
|
|
|
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.id)) throw('Client ID must not be empty'); return { client : { clientId : $.id, description : ($.description ? $.description : $.id), secret : ($.secret ? $.secret : Java.type('java.util.UUID').randomUUID().toString()), rootUrl : '', enabled : true, serviceAccountsEnabled : true, standardFlowEnabled : true, authorizationServicesEnabled : false, publicClient : false, fullScopeAllowed : true, protocol : 'openid-connect'} }"
|
2021-06-04 09:26:00 +02:00
|
|
|
}
|
2021-06-04 09:36:27 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"name" : "pyrest",
|
|
|
|
"taskReferenceName" : "authorize",
|
|
|
|
"type" : "SIMPLE",
|
|
|
|
"inputParameters" : {
|
2021-10-07 11:56:41 +02:00
|
|
|
"url" : "${init.input.keycloak}/protocol/openid-connect/token",
|
2021-06-04 09:36:27 +02:00
|
|
|
"method" : "POST",
|
|
|
|
"headers" : {
|
|
|
|
"Accept" : "application/json"
|
|
|
|
},
|
|
|
|
"body" : {
|
|
|
|
"client_id" : "orchestrator",
|
2021-10-07 11:56:41 +02:00
|
|
|
"client_secret" : "{{ keycloak_auth }}",
|
2021-06-04 09:36:27 +02:00
|
|
|
"grant_type" : "client_credentials"
|
|
|
|
}
|
2021-06-04 09:26:00 +02:00
|
|
|
}
|
2021-10-07 11:56:41 +02:00
|
|
|
},
|
2021-06-04 09:36:27 +02:00
|
|
|
{
|
|
|
|
"name" : "pyrest",
|
|
|
|
"taskReferenceName" : "create_client",
|
|
|
|
"type" : "SIMPLE",
|
|
|
|
"inputParameters" : {
|
|
|
|
"url" : "${init.input.keycloak_admin}/clients",
|
2021-10-07 14:02:16 +02:00
|
|
|
"body" : "${init.output.result.client}",
|
2021-06-04 09:36:27 +02:00
|
|
|
"method" : "POST",
|
|
|
|
"headers" : {
|
|
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
|
|
"Content-Type" : "application/json"
|
2021-06-04 12:01:50 +02:00
|
|
|
}
|
2021-06-04 09:36:27 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "LAMBDA_TASK",
|
|
|
|
"taskReferenceName": "extract_client_id",
|
|
|
|
"type": "LAMBDA",
|
|
|
|
"inputParameters": {
|
|
|
|
"client_location" : "${create_client.output.headers.location}",
|
|
|
|
"scriptExpression": "var client_id = $.client_location.split('/').pop(); return {'client_id' : client_id}"
|
|
|
|
}
|
|
|
|
},
|
2021-06-04 10:12:14 +02:00
|
|
|
{
|
|
|
|
"name" : "pyrest",
|
|
|
|
"taskReferenceName" : "get_service_account_user",
|
|
|
|
"type" : "SIMPLE",
|
|
|
|
"inputParameters" : {
|
|
|
|
"url" : "${init.input.keycloak_admin}/clients/${extract_client_id.output.result.client_id}/service-account-user",
|
|
|
|
"method" : "GET",
|
|
|
|
"headers" : {
|
|
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
|
|
"Accept" : "application/json"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2021-06-04 09:36:27 +02:00
|
|
|
{
|
|
|
|
"name" : "pyrest",
|
2021-10-07 11:13:08 +02:00
|
|
|
"type" : "SIMPLE",
|
2021-11-02 10:30:37 +01:00
|
|
|
"taskReferenceName": "retrieve_infra_member_role",
|
2021-10-07 11:13:08 +02:00
|
|
|
"inputParameters" : {
|
2021-11-02 10:30:37 +01:00
|
|
|
"url" : "${init.input.keycloak_admin}/roles/Infrastructure-Member",
|
2021-10-07 11:13:08 +02:00
|
|
|
"method" :"GET",
|
2021-06-04 09:36:27 +02:00
|
|
|
"headers" : {
|
|
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
|
|
"Accept" : "application/json"
|
2021-10-07 11:13:08 +02:00
|
|
|
}
|
|
|
|
}
|
2021-06-04 09:36:27 +02:00
|
|
|
},
|
|
|
|
{
|
2021-10-07 11:13:08 +02:00
|
|
|
"name": "jq_1",
|
|
|
|
"taskReferenceName": "to_array",
|
|
|
|
"type": "JSON_JQ_TRANSFORM",
|
|
|
|
"inputParameters": {
|
2021-11-02 10:32:31 +01:00
|
|
|
"role": "${retrieve_infra_member_role.output.body}",
|
2021-10-07 11:13:08 +02:00
|
|
|
"queryExpression" : ".role"
|
|
|
|
}
|
|
|
|
},
|
2021-06-04 09:36:27 +02:00
|
|
|
{
|
2021-10-07 11:13:08 +02:00
|
|
|
"name" : "pyrest",
|
|
|
|
"type" : "SIMPLE",
|
2021-11-02 10:30:37 +01:00
|
|
|
"taskReferenceName": "assign_infra_member_role",
|
2021-10-07 11:13:08 +02:00
|
|
|
"inputParameters" : {
|
2021-10-07 12:09:11 +02:00
|
|
|
"url" : "${init.input.keycloak_admin}/users/${get_service_account_user.output.body.id}/role-mappings/realm",
|
2021-10-07 11:13:08 +02:00
|
|
|
"method" :"POST",
|
|
|
|
"headers" : {
|
|
|
|
"Authorization" : "Bearer ${authorize.output.body.access_token}",
|
|
|
|
"Content-Type" : "application/json",
|
|
|
|
"Accept":"application/json"
|
|
|
|
},
|
|
|
|
"body" : "${to_array.output.resultList}"
|
|
|
|
}
|
2021-06-04 09:36:27 +02:00
|
|
|
}
|
2021-06-04 09:26:00 +02:00
|
|
|
]
|
|
|
|
}
|