tokenstorage

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VaultError = errors.New("error in Vault")
)
View Source
var VaultUnknownAuthMethodError = errors.New("unknown Vault authentication method")

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 (n NotifyingTokenStorage) Get(ctx context.Context, owner *api.SPIAccessToken) (token *api.Token, err error)

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(vaultTokenStorageConfig *VaultStorageConfig) (TokenStorage, error)

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

type VaultAuthMethod added in v0.7.0

type VaultAuthMethod string
var VaultAuthMethodApprole VaultAuthMethod = "approle"
var VaultAuthMethodKubernetes VaultAuthMethod = "kubernetes"

type VaultStorageConfig added in v0.7.0

type VaultStorageConfig struct {
	Host     string
	AuthType VaultAuthMethod
	Insecure bool

	Role                        string
	ServiceAccountTokenFilePath string

	RoleIdFilePath   string
	SecretIdFilePath string
}

Jump to

Keyboard shortcuts

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