cache

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 5 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 caches auth service data from a provider.

func NewCache

func NewCache(prov auth.Provider) *Cache

NewCache creates a new auth cache.

func NewCacheWithTimeProvider

func NewCacheWithTimeProvider(prov auth.Provider, tp TimeProvider) *Cache

NewCacheWithTimeProvider creates a new auth cache with the given time provider. This is primarily useful for testing.

func (*Cache) GetUser

func (c *Cache) GetUser(le *logrus.Entry, token string) (*auth.User, error)

GetUser gets a user given a token. Returns InvalidToken error.

func (*Cache) ValidateUserNames

func (c *Cache) ValidateUserNames(le *logrus.Entry, userNames *[]string, token string) error

ValidateUserNames validates that user names exist in the auth system. token can be any valid token - it's used only to look up the userName. Returns InvalidToken error and InvalidUserError.

type TimeProvider

type TimeProvider interface {
	// Now returns the current time.
	Now() time.Time
}

TimeProvider provides the current time.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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