From 5974fe8cd4cb032bfeda1adbcd003c28b4d3f4fe Mon Sep 17 00:00:00 2001 From: Pierre-Olivier Mercier Date: Sat, 23 Mar 2024 18:51:53 +0100 Subject: [PATCH] admin: Generate Vouch-Proxy config --- admin/api/password.go | 30 +++++++++++++++--------------- admin/static/js/app.js | 3 +-- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/admin/api/password.go b/admin/api/password.go index 311a53ce..759f8eb9 100644 --- a/admin/api/password.go +++ b/admin/api/password.go @@ -280,24 +280,24 @@ vouch: document_root: /challenge_access cookie: - domain: {{ .Issuer }} + domain: {{ .Domain }} - oauth: - provider: oidc - client_id: {{ .ClientId }} - client_secret: {{ .ClientSecret }} - callback_urls: - - https://{{ .Issuer }}/challenge_access/auth - auth_url: https://{{ .Issuer }}/auth - token_url: http://127.0.0.1:5556/token - user_info_url: http://127.0.0.1:5556/userinfo - scopes: - - openid - - email +oauth: + provider: oidc + client_id: {{ .ClientId }} + client_secret: {{ .ClientSecret }} + callback_urls: + - https://{{ .Domain }}/challenge_access/auth + auth_url: https://{{ .Domain }}/auth + token_url: http://127.0.0.1:5556/token + user_info_url: http://127.0.0.1:5556/userinfo + scopes: + - openid + - email ` type vouchProxyConfig struct { - Issuer string + Domain string ClientId string ClientSecret string } @@ -312,7 +312,7 @@ func genVouchProxyConfig() ([]byte, error) { if vouchTmpl, err := template.New("vouchcfg").Parse(vouchcfgtpl); err != nil { return nil, fmt.Errorf("Cannot create template: %w", err) } else if err = vouchTmpl.Execute(b, vouchProxyConfig{ - Issuer: "https://" + OidcIssuer, + Domain: OidcIssuer, ClientId: OidcClientId, ClientSecret: OidcSecret, }); err != nil { diff --git a/admin/static/js/app.js b/admin/static/js/app.js index ae400578..39948f65 100644 --- a/admin/static/js/app.js +++ b/admin/static/js/app.js @@ -2396,12 +2396,11 @@ angular.module("FICApp") }, function(response) { $scope.addToast('danger', 'An error occurs when generating dex config:', response.data.errmsg); }); - $http.post("api/vouch.yaml").then(function() { + $http.post("api/vouch-proxy.yaml").then(function() { $scope.addToast('success', 'VouchProxy config refreshed.', "Don't forget to reload/reboot frontend host."); }, function(response) { $scope.addToast('danger', 'An error occurs when generating VouchProxy config:', response.data.errmsg); }); - }); } $scope.desactiveTeams = function() { $http.post("api/disableinactiveteams").then(function() {