tokenrepo

package
v0.0.0-...-a9081ec Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tokenrepo holds the repository logic associated with the token domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	Redis *redis.Client
}

Repository is data/repository implementation of service layer TokenRepository

func New

func New(redisClient *redis.Client) *Repository

New is a factory for initializing Token Repositories

func (*Repository) DeleteRefreshToken

func (r *Repository) DeleteRefreshToken(ctx context.Context, userID, tokenID string) error

DeleteRefreshToken used to delete old refresh tokens Services my access this to revolve tokens

func (*Repository) DeleteUserRefreshTokens

func (r *Repository) DeleteUserRefreshTokens(ctx context.Context, userID string) error

DeleteUserRefreshTokens looks for all tokens beginning with userID and scans to delete them in a non-blocking fashion

func (*Repository) SetRefreshToken

func (r *Repository) SetRefreshToken(ctx context.Context, userID string,
	tokenID string, expiresIn time.Duration,
) error

SetRefreshToken stores a refresh token with an expiry time

Jump to

Keyboard shortcuts

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