satoken

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Error(err error, msg string, keysAndValues ...interface{})
	Info(msg string, keysAndValues ...interface{})
}

type Manager

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

func NewManager

func NewManager(cl clientset.Interface, log Logger, tokenCache map[string]*authenticationv1.TokenRequest) *Manager

NewManager returns a new token manager, primed with the tokenCache. A nil token cache will cause a new one to be automatically created.

func (*Manager) Cleanup

func (m *Manager) Cleanup()

func (*Manager) GetServiceAccountToken

func (m *Manager) GetServiceAccountToken(serviceAccount *corev1.ServiceAccount) (string, error)

GetServiceAccountToken gets a service account token from cache or from the TokenRequest API. This process is as follows: * Check the cache for the current token request. * If the token exists and does not require a refresh, return the current token. * Attempt to refresh the token. * If the token is refreshed successfully, save it in the cache and return the token. * If refresh fails and the old token is still valid, log an error and return the old token. * If refresh fails and the old token is no longer valid, return an error

type TokenManager

type TokenManager interface {
	GetServiceAccountToken(serviceAccount *corev1.ServiceAccount) (string, error)
	Cleanup()
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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