token

package
v0.0.0-...-625d9dc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetToken

func GetToken(r *http.Request) (string, error)

Types

type JwtToken

type JwtToken struct {
	Secret []byte
}

func NewJwtToken

func NewJwtToken(secret string) (*JwtToken, error)

func (*JwtToken) Check

func (tk *JwtToken) Check(ctx context.Context, inputToken string) (bool, error)

func (*JwtToken) Create

func (tk *JwtToken) Create(username string, uid, tokenExpTime int64, userRoleID int32) (string, error)

func (*JwtToken) FindUserData

func (tk *JwtToken) FindUserData(inputToken string) (uid int64, username string, userRoleID int32, err error)

type Manager

type Manager interface {
	Create(username string, uid, tokenExpTime int64, userRoleID int32) (string, error)
	Check(context.Context, string) (bool, error)
	FindUserData(string) (uid int64, username string, userRoleID int32, err error)
}

Jump to

Keyboard shortcuts

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