This commit is contained in:
Marco Lettere 2021-06-04 09:36:27 +02:00
parent 88c3429082
commit 4e2d074d60
2 changed files with 99 additions and 99 deletions

View File

@ -61,5 +61,5 @@
"body" : "${retrieve_member_role.output.body}" "body" : "${retrieve_member_role.output.body}"
} }
} }
]
} }

View File

@ -8,105 +8,105 @@
"inputParameters" : ["client_id", "first", "max"], "inputParameters" : ["client_id", "first", "max"],
"tasks" : [ "tasks" : [
{ {
"name": "LAMBDA_TASK", "name": "LAMBDA_TASK",
"taskReferenceName": "init", "taskReferenceName": "init",
"type": "LAMBDA", "type": "LAMBDA",
"inputParameters": { "inputParameters": {
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}", "keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
"keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}", "keycloak_admin" : "{{ keycloak_admin }}/{{ keycloak_realm }}",
"scriptExpression": "1 == 1" "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",
"name" : "pyrest", "taskReferenceName" : "authorize",
"taskReferenceName" : "create_client", "type" : "SIMPLE",
"type" : "SIMPLE", "inputParameters" : {
"inputParameters" : { "url" : "{{ keycloak }}/master/protocol/openid-connect/token",
"url" : "${init.input.keycloak_admin}/clients", "method" : "POST",
"body" : { "headers" : {
"clientId": "${workflow.input.client_id}", "Accept" : "application/json"
"name": "${workflow.input.client_id}", },
"description": "${workflow.input.client_id}", "body" : {
"rootUrl": "", "client_id" : "orchestrator",
"enabled": true, "client_secret" : "{{ keycloak_auth_master }}",
"serviceAccountsEnabled": true, "grant_type" : "client_credentials"
"standardFlowEnabled": true, }
"authorizationServicesEnabled": false,
"publicClient": false,
"fullScopeAllowed" : true,
"protocol": "openid-connect"
},
"method" : "POST",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}",
"Content-Type" : "application/json"
}
}
},
{
"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}"
}
},
{
"name" : "pyrest",
"taskReferenceName" : "get_all_contexts",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak_admin}/clients?clientId=%252F&search=true&first=${workflow.input.first}&max=${workflow.input.max}",
"method" : "GET",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}",
"Accept" : "application/json"
} }
} },
}, {
{ "name" : "pyrest",
"name": "LAMBDA_TASK", "taskReferenceName" : "create_client",
"taskReferenceName": "build_member_roles_assignment_tasks", "type" : "SIMPLE",
"type": "LAMBDA", "inputParameters" : {
"inputParameters": { "url" : "${init.input.keycloak_admin}/clients",
"contexts" : "${get_all_contexts.body}", "body" : {
"id" : "${extract_client_id.output.result.client_id}", "clientId": "${workflow.input.client_id}",
"scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.contexts.length;i++)c=$.contexts[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'call_add_all_member_roles_'+i, subWorkflowParam:{ name:'add_all_member_roles'}}),inputs['add_all_member_roles_'+i]={context:c, client:$.id};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};" "name": "${workflow.input.client_id}",
} "description": "${workflow.input.client_id}",
}, "rootUrl": "",
{ "enabled": true,
"name" : "fork_dynamic", "serviceAccountsEnabled": true,
"type" : "FORK_JOIN_DYNAMIC", "standardFlowEnabled": true,
"taskReferenceName" : "parallel_build_member_roles_assignment_tasks", "authorizationServicesEnabled": false,
"inputParameters" : { "publicClient": false,
"tasks" : "${build_member_roles_assignment_tasks.output.result.tasks}", "fullScopeAllowed" : true,
"inputs" : "${build_member_roles_assignment_tasks.output.result.inputs}" "protocol": "openid-connect"
}, },
"dynamicForkTasksParam": "tasks", "method" : "POST",
"dynamicForkTasksInputParamName": "inputs" "headers" : {
}, "Authorization" : "Bearer ${authorize.output.body.access_token}",
{ "Content-Type" : "application/json"
"name" : "join", }
"type" : "JOIN", }
"taskReferenceName" : "parallel_build_member_roles_assignment_tasks" },
} {
"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}"
}
},
{
"name" : "pyrest",
"taskReferenceName" : "get_all_contexts",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${init.input.keycloak_admin}/clients?clientId=%252F&search=true&first=${workflow.input.first}&max=${workflow.input.max}",
"method" : "GET",
"headers" : {
"Authorization" : "Bearer ${authorize.output.body.access_token}",
"Accept" : "application/json"
}
}
},
{
"name": "LAMBDA_TASK",
"taskReferenceName": "build_member_roles_assignment_tasks",
"type": "LAMBDA",
"inputParameters": {
"contexts" : "${get_all_contexts.body}",
"id" : "${extract_client_id.output.result.client_id}",
"scriptExpression": "inputs={},tasks=[];for(var i=0;i<$.contexts.length;i++)c=$.contexts[i],tasks.push({name:'sub_workflow_task',type:'SUB_WORKFLOW',taskReferenceName:'call_add_all_member_roles_'+i, subWorkflowParam:{ name:'add_all_member_roles'}}),inputs['add_all_member_roles_'+i]={context:c, client:$.id};return {tasks:Java.to(tasks,'java.util.Map[]'),inputs:inputs};"
}
},
{
"name" : "fork_dynamic",
"type" : "FORK_JOIN_DYNAMIC",
"taskReferenceName" : "parallel_build_member_roles_assignment_tasks",
"inputParameters" : {
"tasks" : "${build_member_roles_assignment_tasks.output.result.tasks}",
"inputs" : "${build_member_roles_assignment_tasks.output.result.inputs}"
},
"dynamicForkTasksParam": "tasks",
"dynamicForkTasksInputParamName": "inputs"
},
{
"name" : "join",
"type" : "JOIN",
"taskReferenceName" : "join_parallel_build_member_roles_assignment_tasks"
}
] ]
} }