minauth

package
v0.0.0-...-212a885 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

* @Author: Wangjun * @Date: 2021-07-19 19:31:56 * @LastEditTime: 2023-07-20 13:38:58 * @LastEditors: Wangjun * @Description: * @FilePath: \golib\autoroute\minauth\user.go * hnxr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallbackNeedAuth

func CallbackNeedAuth(c *gin.Context) (ptr interface{}, err error)

CallbackNeedAuth 需要认证回调函数, m gin.H 只要 header, cookie, param 参数中任何一个带有uid标识的均可通过验证

func Hash

func Hash(s string) string

Hash ...

func Init

func Init(defaultUser func() (user, passwd string))

func RemoveByName

func RemoveByName(name string)

RemoveByName 移除认证

func RemoveBySID

func RemoveBySID(sid string)

RemoveBySID 移除认证

func Save

func Save() (err error)

*

  • @description: 保存账号信息
  • @return {*}

func SetAuthURL

func SetAuthURL(url string)

SetAuthURL 设置认证地址

Types

type Auth

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

Auth ...

type Session

type Session struct {
	Name      string //名称
	Alias     string //别名
	LoginTime int64  //登陆时间
	LastTime  int64  //最后访问时间
	Image     string //图像
	ClientIP  string //客户端地址
	SID       string //session ID
}

Session ...

func FindByName

func FindByName(name string) (sess *Session, err error)

FindByName 根据用户名查找会话

func FindBySID

func FindBySID(sid string) (sess *Session, err error)

FindBySID 查找

func Register

func Register(name, alias, image, clientIP string) (sess *Session)

Register 注册信息

type User

type User struct {
	Name string //用户名
	Pwd  string //密码
}

type Users

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

func GetUsers

func GetUsers() *Users

func (*Users) AddUser

func (m *Users) AddUser(name, pwd string, needHash bool)

func (*Users) GetUser

func (m *Users) GetUser(name string) *User

func (*Users) Save

func (m *Users) Save() (err error)

Jump to

Keyboard shortcuts

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