auth

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EffectiveToken = 1

EffectiveToken 有效token

View Source
const ExpireToken = 3

ExpireToken 过期token

View Source
const InvalidToken = 2

InvalidToken 无效token

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	common.NakamaApi
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(userName string, password string, url string, signKey string, model string) *Auth

func (*Auth) GetToken

func (a *Auth) GetToken(loginToken LoginToken) (LoginToken, error)

GetToken 获取身份token

type ConsoleTokenClaims

type ConsoleTokenClaims struct {
	Username  string   `json:"usn,omitempty"`
	Email     string   `json:"ema,omitempty"`
	Role      UserRole `json:"rol,omitempty"`
	ExpiresAt int64    `json:"exp,omitempty"`
	Cookie    string   `json:"cki,omitempty"`
}

func (*ConsoleTokenClaims) Valid

func (stc *ConsoleTokenClaims) Valid() error

Valid 校验

type LoginToken

type LoginToken struct {
	Token string   `json:"token"`
	Uname string   `json:"uname"`
	Email string   `json:"email"`
	Role  UserRole `json:"role"`
}

LoginToken 身份验证token

type UserRole

type UserRole int32

Jump to

Keyboard shortcuts

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