1 Star 0 Fork 0

linxing / youye-core

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
auth.go 995 Bytes
一键复制 编辑 原始数据 按行查看 历史
Mark 提交于 2024-04-27 21:23 . feat: auth添加注入session信息函数
package jwtauth
import (
"time"
"gitee.com/linxing_3/youye-core/sdk/pkg/jwtauth/user"
"github.com/gin-gonic/gin"
)
type LoginResponse struct {
Code int `json:"code"` // 状态码
Token string `json:"token"` // token
Msg string `json:"msg"` // 提示内容
Expire int `json:"expire"` // 过期时间戳
Third map[string]interface{} `json:"third,omitempty"` // 第三方登录信息
}
type IAuthLoginHandler func(ctx *gin.Context) (user.ISessionInfo, error)
type IAuth interface {
// 会话验证
MiddlewareFunc() gin.HandlerFunc
// 登录处理
LoginHandler(ctx *gin.Context)
// 更新session信息
// @return string token
UpdateSession(info user.ISessionInfo, expiredAt time.Time) (string, error)
// 获取当前用户会话信息
GetSessionInfo(ctx *gin.Context) (user.ISessionInfo, error)
// 删除会话
DeleteSession(ctx *gin.Context) error
}
1
https://gitee.com/linxing_3/youye-core.git
git@gitee.com:linxing_3/youye-core.git
linxing_3
youye-core
youye-core
v0.0.1-202405061706

搜索帮助