storage

package
v0.0.0-...-c1a17fb Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisStore

type RedisStore struct {
	Client *redis.Client
}

func (RedisStore) Close

func (r RedisStore) Close() error

Close closes of any open resources

func (RedisStore) Delete

func (r RedisStore) Delete(ctx context.Context, key string) error

Delete remove the key

func (RedisStore) Exists

func (r RedisStore) Exists(ctx context.Context, key string) (bool, error)

Checks if key exists in store

func (RedisStore) Get

func (r RedisStore) Get(ctx context.Context, key string) (string, error)

Get retrieves a token from the store

func (RedisStore) GetRefreshTokenFromStore

func (r RedisStore) GetRefreshTokenFromStore(
	ctx context.Context,
	token string,
) (string, error)

Get retrieves a token from the store, the key we are using here is the access token

func (RedisStore) Set

func (r RedisStore) Set(ctx context.Context, key, value string, expiration time.Duration) error

Set adds a token to the store

type Storage

type Storage interface {
	// Set the token to the store
	Set(ctx context.Context, key string, value string, expiration time.Duration) error
	// Get retrieves a token from the store
	Get(ctx context.Context, key string) (string, error)
	// Exists checks if key exists in store
	Exists(ctx context.Context, key string) (bool, error)
	// Delete removes a key from the store
	Delete(ctx context.Context, key string) error
	// Close is used to close off any resources
	Close() error
	GetRefreshTokenFromStore(ctx context.Context, token string) (string, error)
}

storage is used to hold the offline refresh token, assuming you don't want to use the default practice of a encrypted cookie

func CreateStorage

func CreateStorage(location string) (Storage, error)

createStorage creates the store client for use

Jump to

Keyboard shortcuts

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