-
Notifications
You must be signed in to change notification settings - Fork 15k
KAFKA-6750: Add listener name to authentication context (KIP-282) #4829
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
Changes from all commits
9c519d7
70bd84e
bada354
d069e0a
4dd4203
132d4df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ | |
| import org.apache.kafka.common.security.auth.KafkaPrincipalBuilder; | ||
| import org.apache.kafka.common.security.auth.PlaintextAuthenticationContext; | ||
| import org.apache.kafka.common.security.auth.PrincipalBuilder; | ||
| import org.apache.kafka.common.security.auth.SecurityProtocol; | ||
| import org.easymock.EasyMock; | ||
| import org.junit.Test; | ||
|
|
||
|
|
@@ -38,7 +39,6 @@ | |
| public class ChannelBuildersTest { | ||
|
|
||
| @Test | ||
| @SuppressWarnings("deprecation") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we remove this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test does not use any deprecated classes, so it's unecessary
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, |
||
| public void testCreateOldPrincipalBuilder() throws Exception { | ||
| TransportLayer transportLayer = EasyMock.mock(TransportLayer.class); | ||
| Authenticator authenticator = EasyMock.mock(Authenticator.class); | ||
|
|
@@ -51,7 +51,7 @@ public void testCreateOldPrincipalBuilder() throws Exception { | |
| assertTrue(OldPrincipalBuilder.configured); | ||
|
|
||
| // test delegation | ||
| KafkaPrincipal principal = builder.build(new PlaintextAuthenticationContext(InetAddress.getLocalHost())); | ||
| KafkaPrincipal principal = builder.build(new PlaintextAuthenticationContext(InetAddress.getLocalHost(), SecurityProtocol.PLAINTEXT.name())); | ||
| assertEquals(OldPrincipalBuilder.PRINCIPAL_NAME, principal.getName()); | ||
| assertEquals(KafkaPrincipal.USER_TYPE, principal.getPrincipalType()); | ||
| } | ||
|
|
||
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.
Can this be
null? Maybe we should returnOptional<String>. We would need to update the KIP too in that case.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.
AuthenticationContextis only used on the server-side, so listener name should never be null.