Skip to content

Conversation

@stevevls
Copy link
Contributor

@stevevls stevevls commented Mar 1, 2019

This PR picks up the work on the inactive PR #134 in order to drive it to conclusion.

chlunde and others added 2 commits March 1, 2019 09:12
Initial contribution that provides a skeleton for SASL support.

For more information about the authentication sequence, please see
https://kafka.apache.org/protocol#sasl_handshake
Also ensured that adding support for new mechanisms in the future is
as straightforward as possible.
@stevevls stevevls mentioned this pull request Mar 1, 2019
Copy link
Contributor

@achille-roussel achille-roussel left a comment

Choose a reason for hiding this comment

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

This looks great 👍 Thanks for taking care of it!


// HashFunction determines the hash function used by SCRAM to protect the user's
// credentials.
type HashFunction int
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reasons not to make this an interface with implementations for the SHA256 and SHA512 hash functions instead of an enum type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did have reasons...the most important of which was to make sure we didn't export anything 3rd party libraries (e.g. in case we swap out scram providers later). But I think that can also be done with an interface. I just pushed up what I would see as the interface version...let me know which you prefer!

//
// SCRAM-SHA-256 and SCRAM-SHA-512 were added to Kafka in 0.10.2.0. These
// mechanisms will not work with older versions.
func Mechanism(algo Algorithm, username, password string) (*mechanism, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Exposing an unexported type in the return value here is a bit weird, was this intended?

Steve van Loben Sels added 2 commits March 18, 2019 12:04
* moved Mechanism -> sasl.Mechanism
* moved common test code -> testing package
* return sasl.Mechanism in scram constructor instead of *mechanism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants