New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jm18457/kafkajs-msk-iam-authentication-mechanism

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jm18457/kafkajs-msk-iam-authentication-mechanism

Authentication mechanism for AWS MSK IAM for KafkaJS.

  • 3.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22K
decreased by-30.55%
Maintainers
1
Weekly downloads
 
Created
Source

Kafka MSK IAM integration

Installation

Requires kafkajs version 2.2.0 or higher.

For more information look at https://kafka.js.org/docs/next/configuration#custom-authentication-mechanisms.

npm i @jm18457/kafkajs-msk-iam-authentication-mechanism 

Setup

const { Kafka } = require('kafkajs')
const {
  createMechanism
} = require('@jm18457/kafkajs-msk-iam-authentication-mechanism')

const kafka = new Kafka({
  brokers: ['kafka1:9092', 'kafka2:9092'],
  clientId: 'my-app',
  ssl: true,
  sasl: createMechanism({ region: 'eu-central-1' })
})

You can also use the old way of importing the library.

const { Kafka } = require('kafkajs')
const {
  Type,
  awsIamAuthenticator,
} = require('@jm18457/kafkajs-msk-iam-authentication-mechanism')


const provider = awsIamAuthenticator({
    region: 'eu-central-1'
})

const kafka = new Kafka({
  brokers: ['kafka1:9092', 'kafka2:9092'],
  clientId: 'my-app',
  ssl: true,
  sasl: {
    mechanism: Type,
    authenticationProvider: provider
  }
})

Examples

For working examples look at the examples folder.

API Reference

Type Aliases

Options

Ƭ Options: Object

Type declaration
NameTypeDescription
credentials?AwsCredentialIdentity | Provider<AwsCredentialIdentity>Default fromNodeProviderChain()
regionstringThe AWS region in which the Kafka broker exists.
ttl?stringProvides the time period, in seconds, for which the generated presigned URL is valid. Default 900
userAgent?stringIs a string passed in by the client library to describe the client. Default MSK_IAM
Defined in

create-mechanism.ts:5

Variables

TYPE

Const TYPE: "AWS_MSK_IAM"

Defined in

constants.ts:3


Type

Const Type: "AWS_MSK_IAM"

Defined in

index.ts:10

Functions

awsIamAuthenticator

awsIamAuthenticator(options): (args: AuthenticationProviderArgs) => Authenticator

Parameters
NameType
optionsOptions
Returns

fn

▸ (args): Authenticator

Parameters
NameType
argsAuthenticationProviderArgs
Returns

Authenticator

Defined in

create-authenticator.ts:11


createAuthenticator

createAuthenticator(options): (args: AuthenticationProviderArgs) => Authenticator

Parameters
NameType
optionsOptions
Returns

fn

▸ (args): Authenticator

Parameters
NameType
argsAuthenticationProviderArgs
Returns

Authenticator

Defined in

create-authenticator.ts:11


createMechanism

createMechanism(options, mechanism?): Mechanism

Parameters
NameTypeDefault value
optionsOptionsundefined
mechanismstringTYPE
Returns

Mechanism

Defined in

create-mechanism.ts:26

Keywords

FAQs

Package last updated on 07 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc