mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-03 19:54:22 +08:00
fix(go): prevent disabling basic auth if deployed by operator; (#3561)
This commit is contained in:
parent
39ea1ed9fc
commit
ffe5e0e65a
2 changed files with 13 additions and 0 deletions
|
@ -33,6 +33,11 @@ func UpsertServerSettings(s models.ServerSettings) error {
|
|||
if s.ClientSecret == Mask() {
|
||||
s.ClientSecret = currSettings.ClientSecret
|
||||
}
|
||||
|
||||
if servercfg.DeployedByOperator() {
|
||||
s.BasicAuth = true
|
||||
}
|
||||
|
||||
data, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -317,6 +322,10 @@ func GetManageDNS() bool {
|
|||
|
||||
// IsBasicAuthEnabled - checks if basic auth has been configured to be turned off
|
||||
func IsBasicAuthEnabled() bool {
|
||||
if servercfg.DeployedByOperator() {
|
||||
return true
|
||||
}
|
||||
|
||||
return GetServerSettings().BasicAuth
|
||||
}
|
||||
|
||||
|
|
|
@ -721,6 +721,10 @@ func GetEmqxRestEndpoint() string {
|
|||
|
||||
// IsBasicAuthEnabled - checks if basic auth has been configured to be turned off
|
||||
func IsBasicAuthEnabled() bool {
|
||||
if DeployedByOperator() {
|
||||
return true
|
||||
}
|
||||
|
||||
var enabled = true //default
|
||||
if os.Getenv("BASIC_AUTH") != "" {
|
||||
enabled = os.Getenv("BASIC_AUTH") == "yes"
|
||||
|
|
Loading…
Add table
Reference in a new issue