package webhook

import "k8s.io/apiserver/plugin/pkg/authenticator/token/webhook"

Package webhook implements the authenticator.Token interface using HTTP webhooks.

Index

Functions

func DefaultRetryBackoff

func DefaultRetryBackoff() *wait.Backoff

DefaultRetryBackoff returns the default backoff parameters for webhook retry.

Types

type AuthenticatorMetrics

type AuthenticatorMetrics struct {
	// RecordRequestTotal increments the total number of requests for webhooks
	RecordRequestTotal func(ctx context.Context, code string)

	// RecordRequestLatency measures request latency in seconds for webhooks. Broken down by status code.
	RecordRequestLatency func(ctx context.Context, code string, latency float64)
}

AuthenticatorMetrics specifies a set of methods that are used to register various metrics

type WebhookTokenAuthenticator

type WebhookTokenAuthenticator struct {
	// contains filtered or unexported fields
}

func New

func New(config *rest.Config, version string, implicitAuds authenticator.Audiences, retryBackoff wait.Backoff) (*WebhookTokenAuthenticator, error)

New creates a new WebhookTokenAuthenticator from the provided rest config. It is recommend to wrap this authenticator with the token cache authenticator implemented in k8s.io/apiserver/pkg/authentication/token/cache.

func NewFromInterface

func NewFromInterface(tokenReview authenticationv1client.AuthenticationV1Interface, implicitAuds authenticator.Audiences, retryBackoff wait.Backoff, requestTimeout time.Duration, metrics AuthenticatorMetrics) (*WebhookTokenAuthenticator, error)

NewFromInterface creates a webhook authenticator using the given tokenReview client. It is recommend to wrap this authenticator with the token cache authenticator implemented in k8s.io/apiserver/pkg/authentication/token/cache.

func (*WebhookTokenAuthenticator) AuthenticateToken

func (w *WebhookTokenAuthenticator) AuthenticateToken(ctx context.Context, token string) (*authenticator.Response, bool, error)

AuthenticateToken implements the authenticator.Token interface.

Source Files

metrics.go webhook.go

Version
v0.33.1 (latest)
Published
May 15, 2025
Platform
linux/amd64
Imports
18 packages
Last checked
2 hours ago

Tools for package owners.