memory_store

package
v0.0.0-...-1726717 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dependencies

type Dependencies struct {
	Log             *zerolog.Logger
	StorageProvider storage.Provider
}

Dependencies struct for memory store provider

type Provider

type Provider interface {
	// SetUserSession sets the user session for given user identifier in form recipe:user_id
	SetUserSession(userId, key, token string, expiration int64) error
	// GetUserSession returns the session token for given token
	GetUserSession(userId, key string) (string, error)
	// DeleteUserSession deletes the user session
	DeleteUserSession(userId, key string) error
	// DeleteAllSessions deletes all the sessions from the session store
	DeleteAllUserSessions(userId string) error
	// DeleteSessionForNamespace deletes the session for a given namespace
	DeleteSessionForNamespace(namespace string) error
	// SetMfaSession sets the mfa session with key and value of userId
	SetMfaSession(userId, key string, expiration int64) error
	// GetMfaSession returns value of given mfa session
	GetMfaSession(userId, key string) (string, error)
	// GetAllMfaSessions returns all mfa sessions for given userId
	GetAllMfaSessions(userId string) ([]string, error)
	// DeleteMfaSession deletes given mfa session from in-memory store.
	DeleteMfaSession(userId, key string) error

	// SetState sets the login state (key, value form) in the session store
	SetState(key, state string) error
	// GetState returns the state from the session store
	GetState(key string) (string, error)
	// RemoveState removes the social login state from the session store
	RemoveState(key string) error
	// GetAndRemoveState atomically retrieves and deletes the state entry.
	// Returns the state value and removes it in a single operation to
	// prevent authorization code replay (RFC 6749 §4.1.2).
	GetAndRemoveState(key string) (string, error)

	// GetAllData returns all the data from the session store
	// This is used for testing purposes only
	GetAllData() (map[string]string, error)
}

Provider defines current memory store provider

func New

func New(cfg *config.Config, deps *Dependencies) (Provider, error)

New returns a new memory store provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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