mirror of https://github.com/portainer/portainer
feat(api): filter LDAP password from settings response (#2488)
parent
17d63ae3ca
commit
d510bbbcfd
|
@ -9,6 +9,10 @@ import (
|
||||||
"github.com/portainer/portainer/http/security"
|
"github.com/portainer/portainer/http/security"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func hideFields(settings *portainer.Settings) {
|
||||||
|
settings.LDAPSettings.Password = ""
|
||||||
|
}
|
||||||
|
|
||||||
// Handler is the HTTP handler used to handle settings operations.
|
// Handler is the HTTP handler used to handle settings operations.
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
*mux.Router
|
*mux.Router
|
||||||
|
|
|
@ -14,5 +14,6 @@ func (handler *Handler) settingsInspect(w http.ResponseWriter, r *http.Request)
|
||||||
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve the settings from the database", err}
|
return &httperror.HandlerError{http.StatusInternalServerError, "Unable to retrieve the settings from the database", err}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideFields(settings)
|
||||||
return response.JSON(w, settings)
|
return response.JSON(w, settings)
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ type (
|
||||||
// LDAPSettings represents the settings used to connect to a LDAP server
|
// LDAPSettings represents the settings used to connect to a LDAP server
|
||||||
LDAPSettings struct {
|
LDAPSettings struct {
|
||||||
ReaderDN string `json:"ReaderDN"`
|
ReaderDN string `json:"ReaderDN"`
|
||||||
Password string `json:"Password"`
|
Password string `json:"Password,omitempty"`
|
||||||
URL string `json:"URL"`
|
URL string `json:"URL"`
|
||||||
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
TLSConfig TLSConfiguration `json:"TLSConfig"`
|
||||||
StartTLS bool `json:"StartTLS"`
|
StartTLS bool `json:"StartTLS"`
|
||||||
|
|
Loading…
Reference in New Issue