Help us shape the future of Go! Take the 2026 Go Developer Survey

authentication

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpirationDuration = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TokenGetter

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

func NewTokenGetter

func NewTokenGetter(client corev1.ServiceAccountsGetter, options ...TokenGetterOption) *TokenGetter

Returns a token getter that can fetch tokens given a service account. The token getter also caches tokens which helps reduce the number of requests to the API Server. In case a cached token is expiring a fresh token is created.

func (*TokenGetter) Delete added in v0.13.0

func (t *TokenGetter) Delete(key types.NamespacedName)

func (*TokenGetter) Get

Get returns a token from the cache if available and not expiring, otherwise creates a new token

type TokenGetterOption

type TokenGetterOption func(*TokenGetter)

func WithExpirationDuration

func WithExpirationDuration(expirationDuration time.Duration) TokenGetterOption

type TokenInjectingRoundTripper added in v0.13.0

type TokenInjectingRoundTripper struct {
	Tripper     http.RoundTripper
	TokenGetter *TokenGetter
	Key         types.NamespacedName
}

func (*TokenInjectingRoundTripper) RoundTrip added in v0.13.0

func (tt *TokenInjectingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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