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
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 {

View File

@ -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() {