inserted validations

master
Marco Lettere 2 years ago
parent ad7db3f8ef
commit 7c6f28ea62

@ -14,7 +14,7 @@ workflows:
# - add_role_policy_permission # - add_role_policy_permission
# - add_all_member_roles # - add_all_member_roles
- create_system_service - create_system_service
# - delete_system_service - delete_system_service
# - add_all_system_services_to_vre # - add_all_system_services_to_vre
keycloak_host: "https://accounts.dev.d4science.org/auth" keycloak_host: "https://accounts.dev.d4science.org/auth"
keycloak: "{{ keycloak_host }}/realms" keycloak: "{{ keycloak_host }}/realms"

@ -17,7 +17,7 @@
"id" : "${workflow.input.client_id}", "id" : "${workflow.input.client_id}",
"secret" : "${workflow.input.client_secret}", "secret" : "${workflow.input.client_secret}",
"description" : "${workflow.input.description}", "description" : "${workflow.input.description}",
"scriptExpression": "function e(v){ return (v.trim && (v.trim() === '')) && v == null}; 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'} }" "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'} }"
} }
}, },
{ {

@ -14,7 +14,8 @@
"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" "id" : "${workflow.input.client_id}",
"scriptExpression" : "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.id)) throw('Client ID must not be empty');"
} }
}, },
{ {
@ -48,6 +49,15 @@
} }
} }
}, },
{
"name": "LAMBDA_TASK",
"taskReferenceName": "check",
"type": "LAMBDA",
"inputParameters": {
"list" : "${lookup_client.output.body}",
"scriptExpression" : "if($.list.length === 0 || $.list.length > 1) throw('No client found with client_id or ambiguous query returned multiple clients.')"
}
},
{ {
"name" : "pyrest", "name" : "pyrest",
"taskReferenceName" : "delete_client", "taskReferenceName" : "delete_client",

Loading…
Cancel
Save