cache

package
v0.0.0-...-f0a7105 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserToken

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

func NewUserToken

func NewUserToken(
	rdb *redis.Client,
	authenticator engine.Authenticator,
	logger log.Logger,
	accessTokenKeyPrefix string,
	refreshTokenKeyPrefix string,
) *UserToken

func (*UserToken) GenerateAccessToken

func (r *UserToken) GenerateAccessToken(ctx context.Context, userId uint32, userName string) (accessToken string, err error)

GenerateAccessToken create access token

func (*UserToken) GenerateRefreshToken

func (r *UserToken) GenerateRefreshToken(ctx context.Context, user *userv1.User) (refreshToken string, err error)

GenerateRefreshToken create refresh token

func (*UserToken) GenerateToken

func (r *UserToken) GenerateToken(ctx context.Context, user *userv1.User) (accessToken string, refreshToken string, err error)

GenerateToken create token

func (*UserToken) GetAccessToken

func (r *UserToken) GetAccessToken(ctx context.Context, userId uint32) string

GetAccessToken get access token

func (*UserToken) GetRefreshToken

func (r *UserToken) GetRefreshToken(ctx context.Context, userId uint32) string

GetRefreshToken get refresh token

func (*UserToken) RemoveToken

func (r *UserToken) RemoveToken(ctx context.Context, userId uint32) error

RemoveToken remove all tokens

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳