kafka

package module
v0.116.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureAuthentication

func ConfigureAuthentication(ctx context.Context, config Authentication, saramaConfig *sarama.Config) error

ConfigureAuthentication configures authentication in sarama.Config.

Types

type AWSMSKConfig

type AWSMSKConfig struct {
	// Region is the AWS region the MSK cluster is based in
	Region string `mapstructure:"region"`
	// BrokerAddr is the client is connecting to in order to perform the auth required
	BrokerAddr string `mapstructure:"broker_addr"`
	// contains filtered or unexported fields
}

AWSMSKConfig defines the additional SASL authentication measures needed to use AWS_MSK_IAM and AWS_MSK_IAM_OAUTHBEARER mechanism

func (*AWSMSKConfig) Token added in v0.116.0

func (c *AWSMSKConfig) Token() (*sarama.AccessToken, error)

Token return the AWS session token for the AWS_MSK_IAM_OAUTHBEARER mechanism

type Authentication

type Authentication struct {
	PlainText *PlainTextConfig        `mapstructure:"plain_text"`
	SASL      *SASLConfig             `mapstructure:"sasl"`
	TLS       *configtls.ClientConfig `mapstructure:"tls"`
	Kerberos  *KerberosConfig         `mapstructure:"kerberos"`
}

Authentication defines authentication.

type KerberosConfig

type KerberosConfig struct {
	ServiceName     string `mapstructure:"service_name"`
	Realm           string `mapstructure:"realm"`
	UseKeyTab       bool   `mapstructure:"use_keytab"`
	Username        string `mapstructure:"username"`
	Password        string `mapstructure:"password" json:"-"`
	ConfigPath      string `mapstructure:"config_file"`
	KeyTabPath      string `mapstructure:"keytab_file"`
	DisablePAFXFAST bool   `mapstructure:"disable_fast_negotiation"`
}

KerberosConfig defines kerberos configuration.

type PlainTextConfig

type PlainTextConfig struct {
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
}

PlainTextConfig defines plaintext authentication.

type SASLConfig

type SASLConfig struct {
	// Username to be used on authentication
	Username string `mapstructure:"username"`
	// Password to be used on authentication
	Password string `mapstructure:"password"`
	// SASL Mechanism to be used, possible values are: (PLAIN, AWS_MSK_IAM, AWS_MSK_IAM_OAUTHBEARER, SCRAM-SHA-256 or SCRAM-SHA-512).
	Mechanism string `mapstructure:"mechanism"`
	// SASL Protocol Version to be used, possible values are: (0, 1). Defaults to 0.
	Version int `mapstructure:"version"`

	AWSMSK AWSMSKConfig `mapstructure:"aws_msk"`
}

SASLConfig defines the configuration for the SASL authentication.

type XDGSCRAMClient

type XDGSCRAMClient struct {
	*scram.Client
	*scram.ClientConversation
	scram.HashGeneratorFcn
}

XDGSCRAMClient uses xdg-go scram to authentication conversation

func (*XDGSCRAMClient) Begin

func (x *XDGSCRAMClient) Begin(userName, password, authzID string) (err error)

Begin starts the XDGSCRAMClient conversation.

func (*XDGSCRAMClient) Done

func (x *XDGSCRAMClient) Done() bool

Done returns true if the conversation is completed or has errored.

func (*XDGSCRAMClient) Step

func (x *XDGSCRAMClient) Step(challenge string) (response string, err error)

Step takes a string provided from a server (or just an empty string for the very first conversation step) and attempts to move the authentication conversation forward. It returns a string to be sent to the server or an error if the server message is invalid. Calling Step after a conversation completes is also an error.

Directories

Path Synopsis
Package msk implements the required IAM auth used by AWS' managed Kafka platform to be used with the Surama kafka producer.
Package msk implements the required IAM auth used by AWS' managed Kafka platform to be used with the Surama kafka producer.

Jump to

Keyboard shortcuts

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