sasl

module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2019 License: MIT

README

SASL/OAUTHBEARER Access Token Provider

Overview

This pkg is intended to be used as a complement to Shopify/sarama. It provides an implementation of the sarama.AccessTokenProvider interface to be employed by clients using the SASL/OAUTHBEARER mechanism for Apache Kafka.

This package leverages golang/oauth2 and golang/oauth2/clientcredentials to perform the 2 legged client credentials flow to obtain an Access Token outside the context of a user.

Installation

go get github.com/damiannolan/sasl/oauthbearer

Usage

The appropriate configuration settings must be set on the sarama.Config. It is recommended to use this protocol over TLS.

import (
    "github.com/damiannolan/sasl/oauthbearer"
)

func main() {
    cfg := sarama.NewConfig()

    cfg.Net.SASL.Enable = true
    cfg.Net.SASL.Mechanism = sarama.SASLTypeOAuth
    cfg.Net.SASL.AccessTokenProvider = oauthbearer.NewTokenProvider(clientID, clientSecret, tokenURL)
    ...
}

References

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL