Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[receiver/solace]: Update the auth validation step #36386

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wildum
Copy link
Contributor

@wildum wildum commented Nov 15, 2024

Description

The validation step should not allow configuring several auth methods when only one will be considered (the first one that's not nil in this order plain > xauth2 > external).

(this is a breaking change because some users might have several auth methods configured)

Testing

One test with multiple auth methods was added.

@wildum wildum requested review from djaglowski and a team as code owners November 15, 2024 09:51
if cfg.Auth.XAuth2 != nil {
authMethod++
}
if authMethod != 1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if authMethod is 2 or 3, you probably want a different error message.

cfg.Auth.PlainText = &SaslPlainTextConfig{"Username", "Password"}
cfg.Auth.XAuth2 = &SaslXAuth2Config{"Username", "Bearer"}
err := component.ValidateConfig(cfg)
assert.Equal(t, errMissingAuthDetails, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert.Equal(t, errMissingAuthDetails, err)
assert.Equal(t, errTooManyAuthDetails, err)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants