{"id":18722447,"url":"https://github.com/halfdan/kafka_msk_auth","last_synced_at":"2026-02-25T07:14:51.397Z","repository":{"id":250895224,"uuid":"835776405","full_name":"halfdan/kafka_msk_auth","owner":"halfdan","description":"AWS_MSK_IAM Authentication Plugin for Broadway Kafka and brod","archived":false,"fork":false,"pushed_at":"2024-07-31T11:48:15.000Z","size":61,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-28T00:57:36.526Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/halfdan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-30T14:04:26.000Z","updated_at":"2024-08-30T05:57:41.000Z","dependencies_parsed_at":"2024-11-07T13:43:23.902Z","dependency_job_id":"6bdf3ffc-6635-43f7-8aa4-ee3971349e7b","html_url":"https://github.com/halfdan/kafka_msk_auth","commit_stats":null,"previous_names":["halfdan/kafka_msk_auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/halfdan/kafka_msk_auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfdan%2Fkafka_msk_auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfdan%2Fkafka_msk_auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfdan%2Fkafka_msk_auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfdan%2Fkafka_msk_auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/halfdan","download_url":"https://codeload.github.com/halfdan/kafka_msk_auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/halfdan%2Fkafka_msk_auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29813743,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T13:41:27.862Z","updated_at":"2026-02-25T07:14:51.383Z","avatar_url":"https://github.com/halfdan.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KafkaMskAuth\n\n`kafka_msk_auth` is an authentication plugin for `brod` and `broadway_kafka`. It enables Broadway Kafka clients to authenticate with Amazon's Managed Streaming for Apache Kafka(Amazon MSK) via [AWS_MSK_IAM](https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html) SASL mechanism as well as [OAuthBearer](https://docs.confluent.io/platform/current/security/authentication/sasl/oauthbearer/overview.html).\n\nThis code is heavily based upon [`ex_aws_msk_iam_auth`](https://github.com/BigThinkcode/ex_aws_msk_iam_auth/) but was extended to support the OAUTHBEARER auth mechanism as well as role based auth.\n\n\n## Installation\n\nAdd the following dependency to your `mix.exs`\n```elixir\ndef deps do\n  [\n    {:kafka_msk_auth, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n## Usage\n\nBroadway Kafka supports connecting to Kafka broker via SASL authentication. The following sample configuration shows how `kafka_msk_auth` plugin can be used with it.\n \nRef: https://hexdocs.pm/broadway_kafka/BroadwayKafka.Producer.html#module-client-config-options\n\n```elixir\n  client_config: [\n            sasl:\n              {\n                :callback, \n                KafkaMskAuth.MskIamAuth, \n                {:MSK_IAM_AUTH, %{access_key_id: \"AWS_ACCESS_KEY_ID\", secret_access_key: \"AWS_SECRET_ACCESS_KEY\"}}\n              },\n            ssl: true\n          ]\n```\n\n## Background\n\n### Broadway Kafka and brod\n[Broadway Kafka](https://github.com/dashbitco/broadway_kafka) is a Kafka Connector for [Broadway](https://github.com/dashbitco/broadway) - an Elixir library to build concurrent, multi-stage data ingestion/processing pipelines with Elixir.\nBroadway Kafka is an amalgamation of awesome features from Broadway with Kafka as a producer. Internally, it uses [brod](https://github.com/kafka4beam/brod) as its Kafka client acting as a wrapper. Brod supports `SASL PLAIN`, `SCRAM-SHA-256` and `SCRAM-SHA-512` authentication mechanisms out of the box and also offers extension points to support custom [authentication plugins](https://github.com/kafka4beam/brod#authentication-support). \n\n### AWS MSK Authentication Mechanisms\nMSK supports two variants - MSK Fully Managed and MSK Serverless. In both the variants, Kafka service can be protected via SASL, in particular, AWS's custom SASL mechanism AWS_MSK_IAM(https://docs.aws.amazon.com/msk/latest/developerguide/iam-access-control.html). At the time of writing this library, MSK's Serverless variant's only supported authentication was AWS_MSK_IAM SASL mechanism.\n\n### Solution Diagram\n![Solution Diagram](solution.png)\n\n### Implementation\nThis library takes inspiration from its Java counterpart [aws-msk-iam-auth](https://github.com/aws/aws-msk-iam-auth)\n\n### Relevant Issues/PRs\n1. https://github.com/dashbitco/broadway_kafka/issues/82\n2. https://github.com/dashbitco/broadway_kafka/pull/85\n3. https://github.com/aws-beam/aws_signature/issues/14\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfdan%2Fkafka_msk_auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalfdan%2Fkafka_msk_auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalfdan%2Fkafka_msk_auth/lists"}