KAFKA-3617: Unit tests for SASL authenticator#1273
Closed
rajinisivaram wants to merge 4 commits into
Closed
Conversation
732ee44 to
2f8234a
Compare
| String serverHost = InetAddress.getLocalHost().getHostAddress(); | ||
| server = new SslEchoServer(sslServerConfigs, serverHost); | ||
| server = new NioEchoServer(SecurityProtocol.SSL, sslServerConfigs, serverHost); | ||
| server.start(); |
Member
There was a problem hiding this comment.
Should we use createEchoServer here as well.
Contributor
Author
There was a problem hiding this comment.
This one overrides the host address to test that endpoint identification can be disabled.
| TestJaasConfig jaasConfig = configureMechanisms("PLAIN", Arrays.asList("PLAIN")); | ||
| jaasConfig.setPlainClientOptions("myuser", "invalidpassword"); | ||
| saslClientConfigs.put(SaslConfigs.SASL_MECHANISM, "PLAIN"); | ||
| saslServerConfigs.put(SaslConfigs.SASL_ENABLED_MECHANISMS, Arrays.asList("PLAIN")); |
Member
There was a problem hiding this comment.
Doesn't configureMechanisms do this already?
2f8234a to
8d205fb
Compare
Contributor
Author
|
@ijuma Thank you for the reviews. I have addressed most of them (all the easy ones :-)) and left comments for the others. |
| def kafkaSaslProperties(clientSaslMechanism: String, serverSaslMechanisms: Option[Seq[String]] = None) = { | ||
| val props = new Properties | ||
| props.put(SaslConfigs.SASL_MECHANISM, clientSaslMechanism) | ||
| serverSaslMechanisms match { |
Member
There was a problem hiding this comment.
You can use foreach instead of pattern matching here.
Member
|
Thank you @rajinisivaram, left some more comments. It seems like we're close. |
| val props = new Properties | ||
| props.put(SaslConfigs.SASL_MECHANISM, clientSaslMechanism) | ||
| serverSaslMechanisms.foreach { | ||
| case serverMechanisms => |
Member
There was a problem hiding this comment.
Nit: case is not needed and this should be on the previous line:
serverSaslMechanisms.foreach { serverMechanism =>
props...
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unit tests for SASL authenticator, tests for SASL/PLAIN and multiple mechanisms, authorization test for SASL/PLAIN