tokencache

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFSCache

func NewFSCache(cacheDir string) (*fsCache, error)

NewFSCache creates a new filesystem backed cache

Types

type Cache

type Cache interface {
	Lookup(key Key) (*oidc.TokenSet, error)
	Save(key Key, tokenSet oidc.TokenSet) error
	Invalidate(key Key) error
}

Cache represents a token caching interface

type CacheMissError

type CacheMissError struct{}

CacheMissError is an error used on cache misses

func (*CacheMissError) Error

func (e *CacheMissError) Error() string

type Key

type Key struct {
	IssuerURL   string
	ClientID    string
	ExtraScopes []string
}

Key is used to generate a unique ID for a cached token

type MockCache

type MockCache struct {
	mock.Mock
}

MockCache is an autogenerated mock type for the Cache type

func NewMockCache

func NewMockCache(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCache

NewMockCache creates a new instance of MockCache. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCache) EXPECT

func (_m *MockCache) EXPECT() *MockCache_Expecter

func (*MockCache) Invalidate

func (_m *MockCache) Invalidate(key Key) error

Invalidate provides a mock function with given fields: key

func (*MockCache) Lookup

func (_m *MockCache) Lookup(key Key) (*oidc.TokenSet, error)

Lookup provides a mock function with given fields: key

func (*MockCache) Save

func (_m *MockCache) Save(key Key, tokenSet oidc.TokenSet) error

Save provides a mock function with given fields: key, tokenSet

type MockCache_Expecter

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

func (*MockCache_Expecter) Invalidate

func (_e *MockCache_Expecter) Invalidate(key interface{}) *MockCache_Invalidate_Call

Invalidate is a helper method to define mock.On call

  • key Key

func (*MockCache_Expecter) Lookup

func (_e *MockCache_Expecter) Lookup(key interface{}) *MockCache_Lookup_Call

Lookup is a helper method to define mock.On call

  • key Key

func (*MockCache_Expecter) Save

func (_e *MockCache_Expecter) Save(key interface{}, tokenSet interface{}) *MockCache_Save_Call

Save is a helper method to define mock.On call

  • key Key
  • tokenSet oidc.TokenSet

type MockCache_Invalidate_Call

type MockCache_Invalidate_Call struct {
	*mock.Call
}

MockCache_Invalidate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Invalidate'

func (*MockCache_Invalidate_Call) Return

func (*MockCache_Invalidate_Call) Run

func (*MockCache_Invalidate_Call) RunAndReturn

func (_c *MockCache_Invalidate_Call) RunAndReturn(run func(Key) error) *MockCache_Invalidate_Call

type MockCache_Lookup_Call

type MockCache_Lookup_Call struct {
	*mock.Call
}

MockCache_Lookup_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Lookup'

func (*MockCache_Lookup_Call) Return

func (*MockCache_Lookup_Call) Run

func (_c *MockCache_Lookup_Call) Run(run func(key Key)) *MockCache_Lookup_Call

func (*MockCache_Lookup_Call) RunAndReturn

func (_c *MockCache_Lookup_Call) RunAndReturn(run func(Key) (*oidc.TokenSet, error)) *MockCache_Lookup_Call

type MockCache_Save_Call

type MockCache_Save_Call struct {
	*mock.Call
}

MockCache_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'

func (*MockCache_Save_Call) Return

func (*MockCache_Save_Call) Run

func (_c *MockCache_Save_Call) Run(run func(key Key, tokenSet oidc.TokenSet)) *MockCache_Save_Call

func (*MockCache_Save_Call) RunAndReturn

func (_c *MockCache_Save_Call) RunAndReturn(run func(Key, oidc.TokenSet) error) *MockCache_Save_Call

Jump to

Keyboard shortcuts

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