oauth

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: BSD-3-Clause Imports: 4 Imported by: 11

Documentation

Overview

Package oauth provides OAUTHBEARER sasl authentication as specified in RFC7628.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Oauth

func Oauth(authFn func(context.Context) (Auth, error)) sasl.Mechanism

Oauth returns an OAUTHBEARER sasl mechanism that will call authFn whenever authentication is needed. The returned Auth is used for a single session.

Types

type Auth

type Auth struct {
	// Zid is an optional authorization ID to use in authenticating.
	Zid string

	// Token is the oauthbearer token to use for a single session's
	// authentication.
	Token string
	// Extensions are key value pairs to add to the authentication request.
	Extensions map[string]string
	// contains filtered or unexported fields
}

Auth contains information for authentication.

This client may add fields to this struct in the future if Kafka adds more capabilities to Oauth.

func (Auth) AsMechanism

func (a Auth) AsMechanism() sasl.Mechanism

AsMechanism returns a sasl mechanism that will use 'a' as credentials for all sasl sessions.

This is a shortcut for using the Oauth function and is useful when you do not need to live-rotate credentials.

Jump to

Keyboard shortcuts

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