Browse Source

inserted validations

master
Marco Lettere 2 months ago
parent
commit
7c6f28ea62
  1. 2
      defaults/main.yaml
  2. 2
      templates/create_system_service.json.j2
  3. 12
      templates/delete_system_service.json.j2

2
defaults/main.yaml

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

2
templates/create_system_service.json.j2

@ -17,7 +17,7 @@
"id" : "${workflow.input.client_id}",
"secret" : "${workflow.input.client_secret}",
"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'} }"
}
},
{

12
templates/delete_system_service.json.j2

@ -14,7 +14,8 @@
"inputParameters": {
"keycloak": "{{ keycloak }}/{{ 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",
"taskReferenceName" : "delete_client",

Loading…
Cancel
Save