admin: Generate Vouch-Proxy config

This commit is contained in:
nemunaire 2024-03-23 18:51:53 +01:00
parent 59af4103b8
commit 5974fe8cd4
2 changed files with 16 additions and 17 deletions

View File

@ -280,24 +280,24 @@ vouch:
document_root: /challenge_access document_root: /challenge_access
cookie: cookie:
domain: {{ .Issuer }} domain: {{ .Domain }}
oauth: oauth:
provider: oidc provider: oidc
client_id: {{ .ClientId }} client_id: {{ .ClientId }}
client_secret: {{ .ClientSecret }} client_secret: {{ .ClientSecret }}
callback_urls: callback_urls:
- https://{{ .Issuer }}/challenge_access/auth - https://{{ .Domain }}/challenge_access/auth
auth_url: https://{{ .Issuer }}/auth auth_url: https://{{ .Domain }}/auth
token_url: http://127.0.0.1:5556/token token_url: http://127.0.0.1:5556/token
user_info_url: http://127.0.0.1:5556/userinfo user_info_url: http://127.0.0.1:5556/userinfo
scopes: scopes:
- openid - openid
- email - email
` `
type vouchProxyConfig struct { type vouchProxyConfig struct {
Issuer string Domain string
ClientId string ClientId string
ClientSecret string ClientSecret string
} }
@ -312,7 +312,7 @@ func genVouchProxyConfig() ([]byte, error) {
if vouchTmpl, err := template.New("vouchcfg").Parse(vouchcfgtpl); err != nil { if vouchTmpl, err := template.New("vouchcfg").Parse(vouchcfgtpl); err != nil {
return nil, fmt.Errorf("Cannot create template: %w", err) return nil, fmt.Errorf("Cannot create template: %w", err)
} else if err = vouchTmpl.Execute(b, vouchProxyConfig{ } else if err = vouchTmpl.Execute(b, vouchProxyConfig{
Issuer: "https://" + OidcIssuer, Domain: OidcIssuer,
ClientId: OidcClientId, ClientId: OidcClientId,
ClientSecret: OidcSecret, ClientSecret: OidcSecret,
}); err != nil { }); err != nil {

View File

@ -2396,12 +2396,11 @@ angular.module("FICApp")
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when generating dex config:', response.data.errmsg); $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."); $scope.addToast('success', 'VouchProxy config refreshed.', "Don't forget to reload/reboot frontend host.");
}, function(response) { }, function(response) {
$scope.addToast('danger', 'An error occurs when generating VouchProxy config:', response.data.errmsg); $scope.addToast('danger', 'An error occurs when generating VouchProxy config:', response.data.errmsg);
}); });
});
} }
$scope.desactiveTeams = function() { $scope.desactiveTeams = function() {
$http.post("api/disableinactiveteams").then(function() { $http.post("api/disableinactiveteams").then(function() {