token_storage

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisTokenStorage

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

Implementation of the TokenStorage interface for Redis.

func NewRedisTokenStorage

func NewRedisTokenStorage(redis *redis.Client) *RedisTokenStorage

Get redis token storage.

func (*RedisTokenStorage) CheckToken

func (r *RedisTokenStorage) CheckToken(ctx context.Context, token string) (bool, error)

Check for token existence in redis.

func (*RedisTokenStorage) Close

func (r *RedisTokenStorage) Close() error

Close redis client.

func (*RedisTokenStorage) DeleteToken

func (r *RedisTokenStorage) DeleteToken(ctx context.Context, token string) error

Delete token in Redis.

func (*RedisTokenStorage) SaveToken

func (r *RedisTokenStorage) SaveToken(
	ctx context.Context,
	token string,
	lifeDuration time.Duration,
) error

Seve token in Redis.

type TokenStorage

type TokenStorage interface {
	SaveToken(ctx context.Context, token string, lifeDuration time.Duration) error
	DeleteToken(ctx context.Context, token string) error
	CheckToken(ctx context.Context, token string) (bool, error)
	Close() error
}

Jump to

Keyboard shortcuts

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