From 12fa36bdd29dcc4475b0870baa39e60b00d9f3b6 Mon Sep 17 00:00:00 2001
From: Mark <mark@openappstack.net>
Date: Wed, 18 Dec 2019 15:46:39 +0100
Subject: [PATCH] Add possibility of multiple grant  and response types

---
 .../templates/job-create-oauth-clients.yaml               | 8 ++++----
 helmchart/single-sign-on/values.yaml                      | 8 +++++---
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/helmchart/single-sign-on/templates/job-create-oauth-clients.yaml b/helmchart/single-sign-on/templates/job-create-oauth-clients.yaml
index 8ca434e..fbde038 100644
--- a/helmchart/single-sign-on/templates/job-create-oauth-clients.yaml
+++ b/helmchart/single-sign-on/templates/job-create-oauth-clients.yaml
@@ -46,9 +46,9 @@ spec:
         - name: TOKEN_ENDPOINT_AUTH_METHOD
           value: {{ .tokenEndpointAuthMethod | quote }}
         - name: RESPONSE_TYPES
-          value: {{ .responseTypes | quote }}
+          value: "{{- range .responseTypes }}\"{{ . }}\",{{- end }}"
         - name: GRANT_TYPES
-          value: {{ .grantTypes | quote }}
+          value: "{{- range .grantTypes }}\"{{ . }}\",{{- end }}"
         command: ["/bin/bash", "-c"]
         args:
         - >
@@ -62,8 +62,8 @@ spec:
                         \"logo_uri\": \"$CLIENT_LOGO_URI\",
                         \"redirect_uris\": [\"$REDIRECT_URI\"],
                         \"scope\": \"$SCOPES\",
-                        \"grant_types\": [\"$GRANT_TYPES\"],
-                        \"response_types\": [\"$RESPONSE_TYPES\"],
+                        \"grant_types\": [$GRANT_TYPES\"\"],
+                        \"response_types\": [$RESPONSE_TYPES\"\"],
                         \"token_endpoint_auth_method\": \"client_secret_post\"}" \
                http://{{ $.Release.Name }}-hydra-admin:4445/clients
       {{- end }}
diff --git a/helmchart/single-sign-on/values.yaml b/helmchart/single-sign-on/values.yaml
index 6a8af6a..86c2906 100644
--- a/helmchart/single-sign-on/values.yaml
+++ b/helmchart/single-sign-on/values.yaml
@@ -16,7 +16,7 @@ loginProviderImage:
 singleSignOnHost: &SSO_HOST sso.oas.example.net
 
 userpanel:
-  # userpanel.applicationName is the name of the application. This is a duplicate of 
+  # userpanel.applicationName is the name of the application. This is a duplicate of
   # userbackend.applications[0].name but helm < 3.0 doesn't supprt direct references to
   # list items in template files so we need to keep it for now
   applicationName: &USER_PANEL user-panel
@@ -129,8 +129,10 @@ oAuthClients:
   tokenEndpointAuthMethod: "client_secret_basic"
   # oAuthClients[].responseTypes specifies the type of ressource an oAuth client uses to perform
   # authentication and userinfo requests
-  responseTypes: "token"
+  responseTypes:
+    - "token"
   # oAuthClients[].grantTypes specifies the way in which the client retrieves an access token
   # from the oAuth server
-  grantTypes: "implicit"
+  grantTypes:
+    - "implicit"
 
-- 
GitLab