diff --git a/CHANGELOG.md b/CHANGELOG.md index 0922b8bd..b5823789 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# confluent-kafka-javascript 1.6.0 + +v1.6.0 is a feature release. It is supported for all usage. + +### Enhancements + +1. References librdkafka v2.12.0. Refer to the [librdkafka v2.12.0 release notes](https://github.com/confluentinc/librdkafka/releases/tag/v2.12.0) for more information. +2. OAuth OIDC method example for Kafka metadata based authentication with + an Azure IMDS endpoint using an attached managed identity as principal (#377). + + # confluent-kafka-javascript 1.5.0 v1.5.0 is a feature release. It is supported for all usage. diff --git a/deps/librdkafka b/deps/librdkafka index 69b1865e..8c83a557 160000 --- a/deps/librdkafka +++ b/deps/librdkafka @@ -1 +1 @@ -Subproject commit 69b1865efdc0118cd017760d038d34e52fb3f0d0 +Subproject commit 8c83a557f0c68b62dead0e65c05e2b9b26b283c0 diff --git a/examples/kafkajs/oauthbearer_oidc_azure_imds.js b/examples/kafkajs/oauthbearer_oidc_azure_imds.js new file mode 100644 index 00000000..f5679aeb --- /dev/null +++ b/examples/kafkajs/oauthbearer_oidc_azure_imds.js @@ -0,0 +1,30 @@ +const { Kafka } = require('@confluentinc/kafka-javascript').KafkaJS; + +async function run() { + const bootstrapServers = ""; + const azureIMDSQueryParams = "api-version=&resource=&client_id="; + const kafka = new Kafka({ + 'bootstrap.servers': bootstrapServers, + 'security.protocol': 'SASL_SSL', + 'sasl.mechanisms': 'OAUTHBEARER', + 'sasl.oauthbearer.method': 'oidc', + 'sasl.oauthbearer.metadata.authentication.type': 'azure_imds', + 'sasl.oauthbearer.config': `query=${azureIMDSQueryParams}` + }); + const producer = kafka.producer(); + + await producer.connect(); + console.log("Producer connected"); + + const deliveryReport = await producer.send({ + topic: 'topic', + messages: [ + { value: 'Hello world!' }, + ], + }); + console.log("Producer sent message", deliveryReport); + + await producer.disconnect(); +} + +run().catch(console.error); \ No newline at end of file diff --git a/lib/error.js b/lib/error.js index d9d468c0..62eda948 100644 --- a/lib/error.js +++ b/lib/error.js @@ -28,7 +28,7 @@ LibrdKafkaError.wrap = errorWrap; * @constant * @memberof RdKafka */ -// ====== Generated from librdkafka 2.11.1 file src-cpp/rdkafkacpp.h ====== +// ====== Generated from librdkafka v2.12.0-RC2 file src-cpp/rdkafkacpp.h ====== LibrdKafkaError.codes = { /* Internal errors to rdkafka: */ diff --git a/package.json b/package.json index 828a8197..c5a8f302 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "@confluentinc/kafka-javascript", "version": "1.5.0", "description": "Node.js bindings for librdkafka", - "librdkafka": "2.11.1", - "librdkafka_win": "2.11.1", + "librdkafka": "v2.12.0-RC2", + "librdkafka_win": "v2.12.0-RC2", "main": "lib/index.js", "types": "types/index.d.ts", "scripts": { diff --git a/types/config.d.ts b/types/config.d.ts index 0df9d404..406cb1ac 100644 --- a/types/config.d.ts +++ b/types/config.d.ts @@ -1,4 +1,4 @@ -// ====== Generated from librdkafka 2.11.1 file CONFIGURATION.md ====== +// ====== Generated from librdkafka v2.12.0-RC2 file CONFIGURATION.md ====== // Code that generated this is a derivative work of the code from Nam Nguyen // https://gist.github.com/ntgn81/066c2c8ec5b4238f85d1e9168a04e3fb @@ -713,6 +713,13 @@ export interface GlobalConfig { */ "sasl.oauthbearer.assertion.jwt.template.file"?: string; + /** + * Type of metadata-based authentication to use for OAUTHBEARER/OIDC `azure_imds` authenticates using the Azure IMDS endpoint. Sets a default value for `sasl.oauthbearer.token.endpoint.url` if missing. Configuration values specific of chosen authentication type can be passed through `sasl.oauthbearer.config`. + * + * @default none + */ + "sasl.oauthbearer.metadata.authentication.type"?: 'none' | 'azure_imds'; + /** * List of plugin libraries to load (; separated). The library search path is platform dependent (see dlopen(3) for Unix and LoadLibrary() for Windows). If no filename extension is specified the platform-specific extension (such as .dll or .so) will be appended automatically. */ diff --git a/types/errors.d.ts b/types/errors.d.ts index fba2f51a..253a617e 100644 --- a/types/errors.d.ts +++ b/types/errors.d.ts @@ -1,4 +1,4 @@ -// ====== Generated from librdkafka 2.11.1 file src-cpp/rdkafkacpp.h ====== +// ====== Generated from librdkafka v2.12.0-RC2 file src-cpp/rdkafkacpp.h ====== export const CODES: { ERRORS: { /* Internal errors to rdkafka: */ /** Begin internal error codes (**-200**) */