+func installSecurity(rapp Rapp) error {
+ var url string
+ var params string
+ role := rapp.Roles[0].Role
+ grants := rapp.Roles[0].Grants[0]
+ realm := rapp.Realm
+ client := rapp.Client
+ authenticator := rapp.Authenticator
+
+ if !rapp.SecurityEnabled {
+ return nil
+ }
+ // Different security requirements depending on the rapp type
+ if rapp.Type == "provider" {
+ // keycloak client setup
+ fmt.Println("Setting up keycloak")
+ url = "http://rapps-keycloak-mgr.default/create?"
+ params = "realm=" + realm + "&name=" + client + "&role=" + role + "&authType=" + authenticator
+ url += params
+ _, err := http.Get(url)
+ if err != nil {
+ return err
+ } else {
+ fmt.Println("Setting up istio")
+ url = "http://rapps-istio-mgr.default/create-policy?"
+ params = "name=" + chartName + "&realm=" + realm + "&role=" + role + "&method=" + grants
+ url += params
+
+ _, err := http.Get(url)
+ if err != nil {
+ return err
+ }
+ }
+ } else {
+ fmt.Println("Setting up istio")
+ url = "http://rapps-istio-mgr.default/create-filter?"
+ params = "name=" + chartName + "&realm=" + realm + "&client=" + client + "&authType=" + authenticator
+ url += params
+ _, err := http.Get(url)
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+
+}
+