securestorage

package module
v1.12.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 6 Imported by: 17 modules, 17 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultBasePath = "secret"
View Source
const EnvVaultAuthPath = "CRAY_VAULT_AUTH_PATH"
View Source
const EnvVaultJWTFile = "CRAY_VAULT_JWT_FILE"

These Env var are provided globally to pods

View Source
const EnvVaultRoleFile = "CRAY_VAULT_ROLE_FILE"

Variables

This section is empty.

Functions

func NewMockAdapter

func NewMockAdapter() (SecureStorage, *MockAdapter)

Types

type AuthConfig

type AuthConfig struct {
	JWTFile  string
	RoleFile string
	Path     string
	// contains filtered or unexported fields
}

AuthConfig struct for vault k8s authentication

func DefaultAuthConfig

func DefaultAuthConfig() *AuthConfig

DefaultAuthConfig Create the default auth config that will work for almost all scenarios

func (*AuthConfig) GetAuthArgs

func (authConfig *AuthConfig) GetAuthArgs() map[string]interface{}

GetAuthArgs generates the ars required for generating an auth token

func (*AuthConfig) GetAuthPath

func (authConfig *AuthConfig) GetAuthPath() string

GetAuthPath Getter for auth path key

func (*AuthConfig) LoadJWT

func (authConfig *AuthConfig) LoadJWT() error

LoadJWT save contents of JWTFile to the jwt field

func (*AuthConfig) LoadRole

func (authConfig *AuthConfig) LoadRole() error

LoadRole save contents of RoleFile to the role field

func (*AuthConfig) ReadEnvironment

func (authConfig *AuthConfig) ReadEnvironment() error

ReadEnvironment Update an authConfig with environment variables

type InputDelete

type InputDelete struct {
	Key string
}

type InputLookup

type InputLookup struct {
	Key string
}

type InputLookupKeys

type InputLookupKeys struct {
	KeyPath string
}

type InputStore

type InputStore struct {
	Key   string
	Value interface{}
}

type MockAdapter

type MockAdapter struct {
	StoreNum       int
	StoreData      []MockStore
	LookupNum      int
	LookupData     []MockLookup
	DeleteNum      int
	DeleteData     []MockDelete
	LookupKeysNum  int
	LookupKeysData []MockLookupKeys
}

func (*MockAdapter) Delete

func (ss *MockAdapter) Delete(key string) error

func (*MockAdapter) Lookup

func (ss *MockAdapter) Lookup(key string, output interface{}) error

func (*MockAdapter) LookupKeys

func (ss *MockAdapter) LookupKeys(keyPath string) ([]string, error)

func (*MockAdapter) Store

func (ss *MockAdapter) Store(key string, value interface{}) error

type MockDelete

type MockDelete struct {
	Input  InputDelete
	Output OutputDelete
}

type MockLookup

type MockLookup struct {
	Input  InputLookup
	Output OutputLookup
}

type MockLookupKeys

type MockLookupKeys struct {
	Input  InputLookupKeys
	Output OutputLookupKeys
}

type MockStore

type MockStore struct {
	Input  InputStore
	Output OutputStore
}

type OutputDelete

type OutputDelete struct {
	Err error
}

type OutputLookup

type OutputLookup struct {
	Output interface{}
	Err    error
}

type OutputLookupKeys

type OutputLookupKeys struct {
	Klist []string
	Err   error
}

type OutputStore

type OutputStore struct {
	Err error
}

type RealVaultApi

type RealVaultApi struct {
	Client *api.Client
}

func (*RealVaultApi) Delete

func (v *RealVaultApi) Delete(path string) (*api.Secret, error)

func (*RealVaultApi) List

func (v *RealVaultApi) List(path string) (*api.Secret, error)

func (*RealVaultApi) Read

func (v *RealVaultApi) Read(path string) (*api.Secret, error)

func (*RealVaultApi) SetToken

func (v *RealVaultApi) SetToken(t string)

func (*RealVaultApi) Write

func (v *RealVaultApi) Write(path string, data map[string]interface{}) (*api.Secret, error)

type SecureStorage

type SecureStorage interface {
	Store(key string, value interface{}) error
	Lookup(key string, output interface{}) error
	Delete(key string) error
	LookupKeys(keyPath string) ([]string, error)
}

func NewVaultAdapter

func NewVaultAdapter(basePath string) (SecureStorage, error)

Create a new SecureStorage interface that uses Vault. This connects to vault.

type VaultAdapter

type VaultAdapter struct {
	Config     *api.Config
	Client     VaultApi
	AuthConfig *AuthConfig
	BasePath   string
	VaultRetry int
}

func (*VaultAdapter) Delete

func (ss *VaultAdapter) Delete(key string) error

Remove a struct from Vault at the location specified by key. This function prepends the basePath. Retries are implemented for token renewal.

func (*VaultAdapter) Lookup

func (ss *VaultAdapter) Lookup(key string, output interface{}) error

Read a struct from Vault at the location specified by key. This function prepends the basePath. Retries are implemented for token renewal.

func (*VaultAdapter) LookupKeys

func (ss *VaultAdapter) LookupKeys(keyPath string) ([]string, error)

Get a list of keys that exsist in Vault at the path specified by keyPath. This function prepends the basePath. Retries are implemented for token renewal.

func (*VaultAdapter) Store

func (ss *VaultAdapter) Store(key string, value interface{}) error

Write a struct to Vault at the location specified by key. This function prepends the basePath. Retries are implemented for token renewal.

type VaultApi

type VaultApi interface {
	Read(path string) (*api.Secret, error)
	Write(path string, data map[string]interface{}) (*api.Secret, error)
	Delete(path string) (*api.Secret, error)
	List(path string) (*api.Secret, error)
	SetToken(t string)
}

///////////////////////////////////////////////////////////////////////////// Vault API interface - This interface wraps only a subset of functions for api.Client so as to reduce the amount of functions that need to be mocked for unit testing. /////////////////////////////////////////////////////////////////////////////

func NewRealVaultApi

func NewRealVaultApi(client *api.Client) VaultApi

Jump to

Keyboard shortcuts

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