-
Notifications
You must be signed in to change notification settings - Fork 882
OAuth Azure IMDS Kafka example #2526
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR adds support for OAuth Azure Instance Metadata Service (IMDS) authentication to the Confluent Kafka client library. It introduces a new metadata-based authentication type for OAUTHBEARER/OIDC that allows authentication using Azure IMDS endpoints with managed identities.
- Added new
SaslOauthbearerMetadataAuthenticationType
enum withAzureIMDS
option - Updated configuration generation to support the new Azure IMDS authentication type
- Added a complete example demonstrating OAuth OIDC authentication with Azure IMDS
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/Confluent.Kafka/Config_gen.cs | Auto-generated configuration file with new enum and property for Azure IMDS authentication |
src/ConfigGen/Program.cs | Added mapping for azure_imds to AzureIMDS in configuration generation |
examples/OAuthOIDCAzureIMDS/Program.cs | New example demonstrating OAuth OIDC authentication using Azure IMDS |
examples/OAuthOIDCAzureIMDS/OAuthOIDCAzureIMDS.csproj | Project file for the new Azure IMDS example |
CHANGELOG.md | Added changelog entry documenting the new OAuth OIDC Azure IMDS feature |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if (args.Length != 2) | ||
{ | ||
Console.WriteLine("Usage: .. brokerList"); | ||
return; | ||
} | ||
var bootstrapServers = args[1]; |
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.
Array index mismatch - the code checks for 2 arguments but accesses index 1 when the usage message suggests only one argument (brokerList). This should be args[0]
if expecting one argument, or the argument count check should be updated.
if (args.Length != 2) | |
{ | |
Console.WriteLine("Usage: .. brokerList"); | |
return; | |
} | |
var bootstrapServers = args[1]; | |
if (args.Length != 1) | |
{ | |
Console.WriteLine("Usage: .. brokerList"); | |
return; | |
} | |
var bootstrapServers = args[0]; |
Copilot uses AI. Check for mistakes.
} | ||
} | ||
|
||
private static void createTopic(ClientConfig config, String topicName) |
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.
Use string
instead of String
- the lowercase alias is preferred in C# code.
private static void createTopic(ClientConfig config, String topicName) | |
private static void createTopic(ClientConfig config, string topicName) |
Copilot uses AI. Check for mistakes.
using (var adminClient = new AdminClientBuilder(config).Build()) | ||
{ | ||
adminClient.CreateTopicsAsync(new TopicSpecification[] { | ||
new TopicSpecification { Name = topicName, ReplicationFactor = 3, NumPartitions = 1 } }).Wait(); ; |
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.
Double semicolon at the end of the line should be a single semicolon.
new TopicSpecification { Name = topicName, ReplicationFactor = 3, NumPartitions = 1 } }).Wait(); ; | |
new TopicSpecification { Name = topicName, ReplicationFactor = 3, NumPartitions = 1 } }).Wait(); |
Copilot uses AI. Check for mistakes.
<ItemGroup> | ||
<PackageReference Include="NJsonSchema" Version="10.8.0" /> | ||
</ItemGroup> |
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.
The NJsonSchema package reference appears unused in the example code. Consider removing this dependency if it's not needed.
<ItemGroup> | |
<PackageReference Include="NJsonSchema" Version="10.8.0" /> | |
</ItemGroup> | |
<!-- Removed unused NJsonSchema package reference --> |
Copilot uses AI. Check for mistakes.
8b772df
to
8d757ab
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
… value mapping and Copilot comments
What
Checklist
References
JIRA:
Test & Review
Open questions / Follow-ups