client

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTokenCredentials

func NewTokenCredentials(source TokenSource) *tokenCredentials

NewTokenCredentials creates a new tokenCredentials instance for the given token source.

Types

type ServiceAccount

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

ServiceAccount impersonates a service account using the Kubernetes TokenRequest API.

func NewServiceAccount

func NewServiceAccount(client serviceAccountInterface, serviceAccountName string) *ServiceAccount

NewServiceAccount returns a new ServiceAccount with the given name and using the given Kubernetes client.

func (*ServiceAccount) Prune

func (m *ServiceAccount) Prune(unusedSince time.Time) int

Prunes unused token sources from the cache. Returns a count of pruned token sources.

func (*ServiceAccount) TokenSource

func (m *ServiceAccount) TokenSource(audience string) TokenSource

TokenSource returns a (cached) token source for the given audience.

type TokenSource

type TokenSource interface {
	Token(ctx context.Context) (*oauth2.Token, error)
}

TokenSource is an interface for requesting a token, similar to oauth2.TokenSource but accepting a context.

type TokenSourceFactory

type TokenSourceFactory interface {
	TokenSource(audience string) TokenSource
	Prune(olderThan time.Time) int
}

TokenSourceFactory is an interface for creating TokenSources for a given audience.

Jump to

Keyboard shortcuts

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