Skip to content

Commit ffe5e0e

Browse files
fix(go): prevent disabling basic auth if deployed by operator; (#3561)
1 parent 39ea1ed commit ffe5e0e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

logic/settings.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func UpsertServerSettings(s models.ServerSettings) error {
3333
if s.ClientSecret == Mask() {
3434
s.ClientSecret = currSettings.ClientSecret
3535
}
36+
37+
if servercfg.DeployedByOperator() {
38+
s.BasicAuth = true
39+
}
40+
3641
data, err := json.Marshal(s)
3742
if err != nil {
3843
return err
@@ -317,6 +322,10 @@ func GetManageDNS() bool {
317322

318323
// IsBasicAuthEnabled - checks if basic auth has been configured to be turned off
319324
func IsBasicAuthEnabled() bool {
325+
if servercfg.DeployedByOperator() {
326+
return true
327+
}
328+
320329
return GetServerSettings().BasicAuth
321330
}
322331

servercfg/serverconf.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,10 @@ func GetEmqxRestEndpoint() string {
721721

722722
// IsBasicAuthEnabled - checks if basic auth has been configured to be turned off
723723
func IsBasicAuthEnabled() bool {
724+
if DeployedByOperator() {
725+
return true
726+
}
727+
724728
var enabled = true //default
725729
if os.Getenv("BASIC_AUTH") != "" {
726730
enabled = os.Getenv("BASIC_AUTH") == "yes"

0 commit comments

Comments
 (0)