sasl

package
v3.32.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2020 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedSASLMechanism = errors.New("unsupported SASL mechanism")
)

SASL specific error types.

View Source
var SHA256 scram.HashGeneratorFcn = func() hash.Hash { return sha256.New() }

SHA256 generates the SHA256 hash

View Source
var SHA512 scram.HashGeneratorFcn = func() hash.Hash { return sha512.New() }

SHA512 generates the SHA512 hash

Functions

func FieldSpec

func FieldSpec() docs.FieldSpec

FieldSpec returns specs for SASL fields.

Types

type Config

type Config struct {
	Enabled     bool   `json:"enabled" yaml:"enabled"` // DEPRECATED
	Mechanism   string `json:"mechanism" yaml:"mechanism"`
	User        string `json:"user" yaml:"user"`
	Password    string `json:"password" yaml:"password"`
	AccessToken string `json:"access_token" yaml:"access_token"`
	TokenCache  string `json:"token_cache" yaml:"token_cache"`
	TokenKey    string `json:"token_key" yaml:"token_key"`
}

Config contains configuration for SASL based authentication. TODO: V4 Remove "enabled" and set a default mechanism

func NewConfig

func NewConfig() Config

NewConfig returns a new SASL config for Kafka with default values.

func (Config) Apply

func (s Config) Apply(mgr types.Manager, conf *sarama.Config) error

Apply applies the SASL authentication configuration to a Sarama config object.

type XDGSCRAMClient

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

XDGSCRAMClient represents struct to XDG Scram client to initialize conversation

func (*XDGSCRAMClient) Begin

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

Begin initializes new client and conversation to securely transmit the provided credentials to Kafka

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

Jump to

Keyboard shortcuts

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