auth

package
v0.0.0-...-52cadad Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const CattleAuthFailed = "X-API-Cattle-Auth-Failed"

Variables

View Source
var ExistingContext = ToMiddleware(AuthenticatorFunc(func(req *http.Request) (user.Info, bool, error) {
	user, ok := request.UserFrom(req.Context())
	return user, ok, nil
}))
View Source
var (
	// Default value taken from DefaultAuthWebhookRetryBackoff
	WebhookBackoff = wait.Backoff{
		Duration: 500 * time.Millisecond,
		Factor:   1.5,
		Jitter:   0.2,
		Steps:    5,
	}
)

Functions

func AlwaysAdmin

func AlwaysAdmin(req *http.Request) (user.Info, bool, error)

func Impersonation

func Impersonation(req *http.Request) (user.Info, bool, error)

func WebhookConfigForURL

func WebhookConfigForURL(url string) (string, error)

Types

type Authenticator

type Authenticator interface {
	Authenticate(req *http.Request) (user.Info, bool, error)
}

func NewWebhookAuthenticator

func NewWebhookAuthenticator(cacheTTL time.Duration, kubeConfig *rest.Config) (Authenticator, error)

type AuthenticatorFunc

type AuthenticatorFunc func(req *http.Request) (user.Info, bool, error)

func (AuthenticatorFunc) Authenticate

func (a AuthenticatorFunc) Authenticate(req *http.Request) (user.Info, bool, error)

type Middleware

type Middleware func(next http.Handler) http.Handler

func NewWebhookMiddleware

func NewWebhookMiddleware(cacheTTL time.Duration, kubeConfig *rest.Config) (Middleware, error)

func ToMiddleware

func ToMiddleware(auth Authenticator) Middleware

func (Middleware) Chain

func (m Middleware) Chain(middleware Middleware) Middleware

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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