weauth

package
Version: v0.0.0-...-e14235d Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ClientIsDisable = "CLIENT_IS_DISABLE"
View Source
const EmailHasBeenUsed = "EMAIL_HAS_BEEN_USED"
View Source
const PassWordError = "PASS_WORLD_ERROR"
View Source
const TextFormatIsIllegal = "TEXT_FORMAT_IS_ILLEGAL"
View Source
const TokenHasError = "TOKEN_HAS_ERROR"
View Source
const UserNotFound = "USER_NOT_Found"

Error

Variables

This section is empty.

Functions

func IsEmailUsed

func IsEmailUsed(email string) bool

func Login

func Login(str string, pass string, cid string) (*string, error)

func MakeIdToken

func MakeIdToken(c *Conversation) (*string, error)

/基于会话生成token

func MakeRefreshToken

func MakeRefreshToken(c *Conversation)

/ 生成该会话的RefreshToken

func RemoveConversation

func RemoveConversation(uid string, cid string, pass string) error

func UpdateClientStatus

func UpdateClientStatus(cid string, status int) error

func UpdateUserEmail

func UpdateUserEmail(uid string, newEmail string) error

func UpdateUserPassWord

func UpdateUserPassWord(uid string, pass string) error

func UpdateUserStatus

func UpdateUserStatus(uid string, status int) error

Types

type Client

type Client struct {
	Id         string
	Key        string
	Name       string
	Status     int
	Leave      int
	Url        string
	Permission string
	AdminUser  string
	CreateTime int
}

Client 定义了客户端对象,所有用户token都是基于客户端发放、验证 status 定义了客户端状态:-2 封禁,-1 禁用,0 启用 permission 定义了客户端所需权限,默认所有客户端有拥有唯一id权限 adminUser 定义了客户端管理员,管理员拥有客户端的全部权限,一个客户端仅允许一个管理员 leave 定义了客户端权限等级: -1 系统客户端,0 仅用于第三方登录,1 长期用户授权 ...

func AddClient

func AddClient(name string, admin string, leave int, url string, permission string) (*Client, error)

func GetClient

func GetClient(id string) (*Client, error)

type Conversation

type Conversation struct {
	Uid         string
	Cid         string
	Pass        string
	StartTime   int64
	ExpiredTime int64
}

func AddConversation

func AddConversation(uid string, cid string) (*Conversation, error)

func GetConversation

func GetConversation(uid string, cid string, pass string) (*Conversation, error)

type Id

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

func GetIDToken

func GetIDToken(str string) (*Id, error)

type Permission

type Permission struct {
	Id         string
	Depict     string
	DepictZhCn string
}

func AddPermission

func AddPermission(depict string, depictZhCn string) (*Permission, error)

func GetPermission

func GetPermission(id string) (*Permission, error)

type Refresh

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

type User

type User struct {
	Uid           string
	Username      string
	Email         string
	Status        int
	Nickname      string
	Pass          string
	Avatar        string
	CreateTime    int
	UpdateTime    int
	CreateAddress string
}

User定义了单个用户对象 status决定了这个用户的关键状态信息: -4已注销,-3已封禁,-2小黑屋,-1邮箱未验证,0:正常

func AddUser

func AddUser(username string, email string, password string, nickname string, address string) (*User, error)

func CheckPassword

func CheckPassword(str string, password string) (*User, error)

/ 检查用户密码,str可以是 uid,用户名,和邮箱

func GetUser

func GetUser(str string) (*User, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL