tokenstorage

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotifyingTokenStorage added in v0.3.0

type NotifyingTokenStorage struct {
	// Client is the kubernetes client to use to create the v1beta1.SPIAccessTokenDataUpdate objects.
	Client client.Client

	// TokenStorage is the token storage to delegate the actual storage operations to.
	TokenStorage TokenStorage
}

NotifyingTokenStorage is a wrapper around TokenStorage that also automatically creates the v1beta1.SPIAccessTokenDataUpdate objects.

func (NotifyingTokenStorage) Delete added in v0.3.0

func (NotifyingTokenStorage) Get added in v0.3.0

func (NotifyingTokenStorage) Store added in v0.3.0

func (n NotifyingTokenStorage) Store(ctx context.Context, owner *api.SPIAccessToken, token *api.Token) error

type TestTokenStorage added in v0.3.0

type TestTokenStorage struct {
	StoreImpl  func(context.Context, *api.SPIAccessToken, *api.Token) error
	GetImpl    func(ctx context.Context, token *api.SPIAccessToken) (*api.Token, error)
	DeleteImpl func(context.Context, *api.SPIAccessToken) error
}

func (TestTokenStorage) Delete added in v0.3.0

func (t TestTokenStorage) Delete(ctx context.Context, owner *api.SPIAccessToken) error

func (TestTokenStorage) Get added in v0.3.0

func (TestTokenStorage) Store added in v0.3.0

func (t TestTokenStorage) Store(ctx context.Context, owner *api.SPIAccessToken, token *api.Token) error

type TokenStorage

type TokenStorage interface {
	Store(ctx context.Context, owner *api.SPIAccessToken, token *api.Token) error
	Get(ctx context.Context, owner *api.SPIAccessToken) (*api.Token, error)
	Delete(ctx context.Context, owner *api.SPIAccessToken) error
}

TokenStorage is a simple interface on top of Kubernetes client to perform CRUD operations on the tokens. This is done so that we can provide either secret-based or Vault-based implementation.

func CreateTestVaultTokenStorage added in v0.3.0

func CreateTestVaultTokenStorage(t vtesting.T) (*vault.TestCluster, TokenStorage)

func NewSecretsStorage added in v0.3.0

func NewSecretsStorage(cl client.Client) (TokenStorage, error)

NewSecretsStorage creates a new `TokenStorage` instance using the provided Kubernetes client.

func NewVaultStorage added in v0.3.0

func NewVaultStorage(role string, vaultHost string, serviceAccountToken string) (TokenStorage, error)

NewVaultStorage creates a new `TokenStorage` instance using the provided Vault instance.

Jump to

Keyboard shortcuts

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