cache

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache provides in-memory owerlay for JWT key storage with key rotation functionality.

func New

func New(ctx context.Context, store Datastore) (*Cache, error)

New init new database interface.

func (*Cache) GetCurrentKey

func (db *Cache) GetCurrentKey() auth.JWTKey

GetCurrentKey fetch latest key from cache, it should have privatekey.

func (*Cache) GetKeys

func (db *Cache) GetKeys() []auth.JWTKey

GetKeys fetch all keys from cache.

func (*Cache) RefreshKeys

func (db *Cache) RefreshKeys(ctx context.Context, reload bool) ([]auth.JWTKey, error)

RefreshKeys refresh the keys from database.

func (*Cache) RotateKeys

func (db *Cache) RotateKeys(ctx context.Context) error

RotateKeys rotates the jwt keys.

type Datastore

type Datastore interface {
	ListJWTKeys(context.Context) ([]auth.JWTKey, error)
	RotateJWTKeys(context.Context, auth.JWTKey) error
}

Datastore represents required storage interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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