token

package
v1.0.3-0...-16bcd14 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pid     = "pid"     // 用户的父id业务场景:子账号
	IsAdmin = "isAdmin" // 是否是管理员
	Role    = "role"    // 用户身份
)

Variables

This section is empty.

Functions

func Auth

func Auth() bm.HandlerFunc

Auth token token handler

func NoAuth

func NoAuth(filter []string)

NoAuth not token api

Types

type JsonWebToken

type JsonWebToken string

JsonWebToken jwt

func NewToken

func NewToken(name string, mid, pid, role int64, isAdmin bool) (jwt JsonWebToken, err error)

NewToken create new jwt token

func (JsonWebToken) GetMid

func (jwt JsonWebToken) GetMid() int64

GetMid get member id

func (JsonWebToken) GetName

func (jwt JsonWebToken) GetName() string

GetName get member name

func (JsonWebToken) GetPid

func (jwt JsonWebToken) GetPid() int64

GetPid get parent id

func (JsonWebToken) IsAdmin

func (jwt JsonWebToken) IsAdmin() bool

IsAdmin is admin

func (JsonWebToken) String

func (jwt JsonWebToken) String() string

type Token

type Token struct {
	Header  header
	Payload *payload
	Secret  string
}

Jump to

Keyboard shortcuts

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