redis_token

package
v0.0.0-...-94183c9 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 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 Config

type Config struct {
	Redis struct {
		Address  string
		Password string
		Db       int
	}
	Jwt struct {
		ExpireDuration time.Duration
		PrivateKeyPath string
		PublicKeyPath  string
		JwtSignMethod  string
	}
}

type Module

type Module struct {
	*Config
	Log bool
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) (*Module, error)

func (*Module) ClearToken

func (m *Module) ClearToken(tokenMd5 string) error

清除Token

func (*Module) ClearTokenOfUser

func (m *Module) ClearTokenOfUser(uid string, provider string) error

清除用户的Token

func (*Module) EncodeToken

func (m *Module) EncodeToken(token string) string

func (*Module) FindToken

func (m *Module) FindToken(tokenMd5 string) (user map[string]string)

查找token

func (*Module) GetUserTokenKey

func (m *Module) GetUserTokenKey(uid string, provider string) string

func (*Module) NewToken

func (m *Module) NewToken(user map[string]string) (string, int64, error)

新Token

func (*Module) StoreToken

func (m *Module) StoreToken(claim *UserClaims, token string) error

type UserClaims

type UserClaims struct {
	*jwt.StandardClaims
	User map[string]string
}

Jump to

Keyboard shortcuts

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