Skip to content
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

feat(nodejs-kafka-client-lib): Added authentication to kafka client (protocol config) #39

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/nodejs-kafka-client-lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import {MLKafkaJsonProducer, MLKafkaJsonProducerOptions} from "@mojaloop/platfor
const logger: ConsoleLogger = new ConsoleLogger();

const authOptions: IRawAuthenticationOptions = {
protocol: "sasl_plaintext",
mechanism: "SCRAM-SHA-256",
username: "kafka",
password: "password"
Expand Down
1 change: 1 addition & 0 deletions packages/nodejs-kafka-client-lib/src/raw/raw_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export declare interface IRawMessageProducer {
}

export declare interface IRawAuthenticationOptions {
protocol: "plaintext" | "ssl" | "sasl_plaintext" | "sasl_ssl";
mechanism: "PLAIN" | "GSSAPI" | "SCRAM-SHA-256" | "SCRAM-SHA-512",
username: string,
password: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export class MLKafkaRawConsumer extends EventEmitter implements IRawMessageConsu

// authentication options
if(this._options.authentication != undefined) {
this._globalConfig["security.protocol"] = this._options.authentication.protocol;
this._globalConfig["sasl.mechanism"] = this._options.authentication.mechanism;
this._globalConfig["sasl.username"] = this._options.authentication.username;
this._globalConfig["sasl.password"] = this._options.authentication.password;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export class MLKafkaRawProducer extends EventEmitter implements IRawMessageProdu

// authentication options
if(this._options.authentication != undefined) {
this._globalConfig["security.protocol"] = this._options.authentication.protocol;
this._globalConfig["sasl.mechanism"] = this._options.authentication.mechanism;
this._globalConfig["sasl.username"] = this._options.authentication.username;
this._globalConfig["sasl.password"] = this._options.authentication.password;
Expand Down
Loading