auth

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRoundTripper

func BuildRoundTripper(ctx context.Context, restConfig *rest.Config, authMode AuthMode, useTLS, insecure bool) (http.RoundTripper, error)

BuildRoundTripper creates an http.RoundTripper using the configured auth mode.

func ContextWithAuthFromRequest

func ContextWithAuthFromRequest(ctx context.Context, r *http.Request) context.Context

Types

type AuthMode

type AuthMode string

AuthMode defines the authentication mode

const (
	// AuthModeKubeConfig reads the bearer token from the kubeconfig or from the mounted service account token file.
	AuthModeKubeConfig AuthMode = "kubeconfig"
	// AuthModeServiceAccount reads the bearer token from the mounted service account token file.
	AuthModeServiceAccount AuthMode = "serviceaccount"
	// AuthModeHeader reads the bearer token from the incoming request's authorization header.
	// The caller must store the token in the context.
	AuthModeHeader AuthMode = "header"
)

func ParseAuthMode

func ParseAuthMode(mode string) (AuthMode, error)

ParseAuthMode validates and converts a string to AuthMode

Jump to

Keyboard shortcuts

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