Skip to content

Commit 8a99a3e

Browse files
authored
Merge commit from fork
Signed-off-by: Andrei Aaron <[email protected]>
1 parent af4a46b commit 8a99a3e

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

pkg/api/config/config.go

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,36 @@ func (c *Config) Sanitize() *Config {
331331
panic(err)
332332
}
333333

334-
if c.HTTP.Auth != nil && c.HTTP.Auth.LDAP != nil && c.HTTP.Auth.LDAP.bindPassword != "" {
335-
sanitizedConfig.HTTP.Auth.LDAP = &LDAPConfig{}
334+
// Sanitize HTTP config
335+
if c.HTTP.Auth != nil {
336+
// Sanitize LDAP bind password
337+
if c.HTTP.Auth.LDAP != nil && c.HTTP.Auth.LDAP.bindPassword != "" {
338+
sanitizedConfig.HTTP.Auth.LDAP = &LDAPConfig{}
336339

337-
if err := DeepCopy(c.HTTP.Auth.LDAP, sanitizedConfig.HTTP.Auth.LDAP); err != nil {
338-
panic(err)
340+
if err := DeepCopy(c.HTTP.Auth.LDAP, sanitizedConfig.HTTP.Auth.LDAP); err != nil {
341+
panic(err)
342+
}
343+
344+
sanitizedConfig.HTTP.Auth.LDAP.bindPassword = "******"
339345
}
340346

341-
sanitizedConfig.HTTP.Auth.LDAP.bindPassword = "******"
347+
// Sanitize OpenID client secrets
348+
if c.HTTP.Auth.OpenID != nil {
349+
sanitizedConfig.HTTP.Auth.OpenID = &OpenIDConfig{
350+
Providers: make(map[string]OpenIDProviderConfig),
351+
}
352+
353+
for provider, config := range c.HTTP.Auth.OpenID.Providers {
354+
sanitizedConfig.HTTP.Auth.OpenID.Providers[provider] = OpenIDProviderConfig{
355+
Name: config.Name,
356+
ClientID: config.ClientID,
357+
ClientSecret: "******",
358+
KeyPath: config.KeyPath,
359+
Issuer: config.Issuer,
360+
Scopes: config.Scopes,
361+
}
362+
}
363+
}
342364
}
343365

344366
if c.IsEventRecorderEnabled() {

0 commit comments

Comments
 (0)