-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[sasl] use a SCRAM client for each connection #1349
Conversation
d8ed0fb
to
f87f2e8
Compare
Hi ! I just signed the CLA, thx |
f87f2e8
to
687e680
Compare
config.go
Outdated
@@ -503,8 +503,8 @@ func (c *Config) Validate() error { | |||
if c.Net.SASL.Password == "" { | |||
return ConfigurationError("Net.SASL.Password must not be empty when SASL is enabled") | |||
} | |||
if c.Net.SASL.SCRAMClient == nil { | |||
return ConfigurationError("A SCRAMClient instance must be provided to Net.SASL.SCRAMClient") | |||
if c.Net.SASL.SCRAMClientGenerator == nil || c.Net.SASL.SCRAMClientGenerator() == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need to check both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kinda protecting the user against himself but it doesn't hurt IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the second test as it is not very useful
687e680
to
8745624
Compare
config_test.go
Outdated
cfg.Net.SASL.User = "user" | ||
cfg.Net.SASL.Password = "stong_password" | ||
}, | ||
"A SCRAMClient instance must be provided to Net.SASL.SCRAMClient"}, | ||
"A SCRAMClientGenerator closure must be provided to Net.SASL.SCRAMClientGenerator"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest changing closure
to function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
config.go
Outdated
// client used to perform the SCRAM exchange with the server. | ||
SCRAMClient SCRAMClient | ||
SCRAMClientGenerator func() SCRAMClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SCRAMClientGeneratorFunc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
8745624
to
5722d69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates, looks good now. 👍
Hello guys ! A dot release with this code would be awesome. I am happy to help if needed. |
As sarama can connect to multiple brokers as the same time, the scram client must be different for each connection as it uses steps to connect via sasl. This avoids the auth mechanism to use the same scram client on connection that have different states.
Symptoms example:
2019/03/29 09:24:18 kafka: error while consuming *****/6: kafka server: Request is not valid given the current SASL state.