authn

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package authn authenticates Kafka connections and their proxy identities.

Index

Constants

View Source
const LFSPrincipal = "__kafscale_lfs_service"
View Source
const ProbePrincipal = "__kafscale_proxy_probe"

Variables

This section is empty.

Functions

func CertificatePrincipal

func CertificatePrincipal(cert *x509.Certificate, principals map[string]string) (string, error)

CertificatePrincipal requires exactly one mapped URI SAN identity. There is no implicit CN, subject DN, client.id, or network address fallback.

func Principal

func Principal(ctx context.Context) string

func ReadKey

func ReadKey(path string) ([]byte, error)

ReadKey reads a raw shared secret, without trimming or logging its contents. Reading on each connection permits Secret volume rotation without pod restarts.

func ReceiveIdentity

func ReceiveIdentity(conn net.Conn, key []byte) (string, error)

ReceiveIdentity requires proof of the shared key, bound to a fresh challenge. It never accepts legacy Kafka frames or client.id as an identity fallback. NetworkPolicies must still protect the plaintext internal Kafka stream.

func SendIdentity

func SendIdentity(conn net.Conn, key []byte, principal string) error

SendIdentity answers a broker-generated challenge before any Kafka frames. The principal is fixed for the lifetime of this backend connection.

func WithPrincipal

func WithPrincipal(ctx context.Context, principal string) context.Context

WithPrincipal binds an authenticated identity to internal routing calls.

Types

type TLSOptions

type TLSOptions struct {
	CertFile       string
	KeyFile        string
	ClientCAFile   string
	PrincipalsFile string
}

TLSOptions uses projected Secret files. Files are reloaded for every new connection; existing connections retain their authenticated principal. Tickets are disabled so resumption cannot bypass rotated trust or mappings.

func (TLSOptions) Authenticate

func (o TLSOptions) Authenticate(ctx context.Context, conn net.Conn) (net.Conn, string, error)

func (TLSOptions) Config

func (o TLSOptions) Config() (*tls.Config, map[string]string, error)

Jump to

Keyboard shortcuts

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