auth

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TokenPrefix = "tk"

Variables

View Source
var ErrPoolNotExist error = errors.New("the pool was not exists")
View Source
var ErrTokenExist error = errors.New("the token has already existed")

ErrTokenExist means the user-defined has already existed

Functions

func Setup

func Setup(conf *config.Config) error

Setup config auth redis client and token manager

Types

type TokenManager

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

func GetTokenManager

func GetTokenManager() *TokenManager

func NewTokenManager

func NewTokenManager(cli *redis.Client) *TokenManager

func (*TokenManager) Delete

func (tm *TokenManager) Delete(pool, namespace, token string) error

func (*TokenManager) Exist

func (tm *TokenManager) Exist(pool, namespace, token string) (exist bool, err error)

func (*TokenManager) List

func (tm *TokenManager) List(pool, namespace string) (tokens map[string]string, err error)

func (*TokenManager) New

func (tm *TokenManager) New(pool, namespace, token, description string) (string, error)

New would create the token in pool

Jump to

Keyboard shortcuts

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