tokenstorage

package
v0.2023.21 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTokenStorage added in v0.2023.21

type DefaultTokenStorage struct {
	// SecretStorage is the underlying storage that handled the storing of the tokens. This must be initialized explicitly
	// before it is used in this token storage instance.
	SecretStorage secretstorage.TypedSecretStorage[api.SPIAccessToken, api.Token]
}

DefaultTokenStorage is the default implementation of the TokenStorage interface that uses the underlying SecretStorage for actually storing the data. It honors the original behavior of the TokenStorage interface that used to return nil instead of throwing NotFoundError when encountering non-existent records in Get and Delete.

func (*DefaultTokenStorage) Delete added in v0.2023.21

func (s *DefaultTokenStorage) Delete(ctx context.Context, owner *api.SPIAccessToken) error

Delete implements TokenStorage

func (*DefaultTokenStorage) Get added in v0.2023.21

Get implements TokenStorage

func (*DefaultTokenStorage) Initialize added in v0.2023.21

func (s *DefaultTokenStorage) Initialize(ctx context.Context) error

Initialize implements TokenStorage. It is a noop in the case of the DefaultTokenStorage.

func (*DefaultTokenStorage) Store added in v0.2023.21

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

Store implements TokenStorage

type NotifyingTokenStorage added in v0.3.0

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

	// 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) Initialize added in v0.8.1

func (n NotifyingTokenStorage) Initialize(ctx context.Context) 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 {
	InitializeImpl func(context.Context) error
	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) Initialize added in v0.8.1

func (t TestTokenStorage) Initialize(ctx context.Context) error

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 {
	Initialize(ctx context.Context) error
	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 an interface similar to SecretStorage that has historically been used to work with tokens. New storage types are built on top of secretstorage.TypedSecretStorage that provides the same interface generically.

func NewJSONSerializingTokenStorage added in v0.2023.21

func NewJSONSerializingTokenStorage(secretStorage secretstorage.SecretStorage) TokenStorage

NewJSONSerializingTokenStorage is a convenience function to construct a TokenStorage instance based on the provided SecretStorage and serializing the data to JSON for persistence. The returned object is an instance of DefaultTokenStorage. NOTE that the provided secret storage MUST BE initialized before this call.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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