Skip to content

Commit

Permalink
Skip usr/pwd validation if IAM mechanism is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
xavirg authored Jan 22, 2025
1 parent 64ac675 commit 9ba8333
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions exporter/kafkaexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,13 @@ func validateSASLConfig(c *kafka.SASLConfig) error {
return nil
}

if c.Username == "" {
return fmt.Errorf("auth.sasl.username is required")
}

if c.Password == "" {
return fmt.Errorf("auth.sasl.password is required")
if c.Mechanism != "AWS_MSK_IAM" && c.Mechanism != "AWS_MSK_IAM_OAUTHBEARER" {
if c.Username == "" {
return fmt.Errorf("auth.sasl.username is required")
}
if c.Password == "" {
return fmt.Errorf("auth.sasl.password is required")
}
}

switch c.Mechanism {
Expand Down

0 comments on commit 9ba8333

Please sign in to comment.