签入脚本
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// ================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// You can delete these comments if you wish manually maintain this interface file.
|
||||
// ================================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"easygoadmin/api/v1"
|
||||
)
|
||||
|
||||
// 按模块独立拆分(源:gf gen service 产物手工重组)。
|
||||
// logic 方法签名变更时需同步维护本文件(手维护,勿整体运行 gf gen service)。
|
||||
|
||||
// IAuth 认证服务接口
|
||||
type (
|
||||
IAuth interface {
|
||||
// Login 登录
|
||||
// 流程:验证码校验 → 定位用户 → 状态与租户校验 → bcrypt 密码校验 → 签发双令牌 → 写入登录日志
|
||||
Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error)
|
||||
// Logout 登出
|
||||
// 将当前访问令牌的 jti 加入黑名单,并写入登录日志
|
||||
Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error)
|
||||
// Captcha 生成图形验证码
|
||||
Captcha(ctx context.Context, req *v1.CaptchaReq) (res *v1.CaptchaRes, err error)
|
||||
// Refresh 刷新令牌
|
||||
// 支持 refresh_token 轮换,并兼容密码模式兑换
|
||||
Refresh(ctx context.Context, req *v1.RefreshReq) (res *v1.RefreshRes, err error)
|
||||
// CheckToken 校验令牌有效性
|
||||
// 身份认证中间件已通过即视为有效
|
||||
CheckToken(ctx context.Context, req *v1.CheckTokenReq) (res *v1.CheckTokenRes, err error)
|
||||
// RemoveToken 撤销指定令牌
|
||||
// 将指定令牌加入黑名单,实现踢下线
|
||||
RemoveToken(ctx context.Context, req *v1.RemoveTokenReq) (res *v1.RemoveTokenRes, err error)
|
||||
}
|
||||
)
|
||||
|
||||
// localAuth 认证服务实现实例
|
||||
var (
|
||||
localAuth IAuth
|
||||
)
|
||||
|
||||
// Auth 获取认证服务实例
|
||||
func Auth() IAuth {
|
||||
if localAuth == nil {
|
||||
panic("implement not found for interface IAuth, forgot register?")
|
||||
}
|
||||
return localAuth
|
||||
}
|
||||
|
||||
// RegisterAuth 注册认证服务实现
|
||||
func RegisterAuth(i IAuth) {
|
||||
localAuth = i
|
||||
}
|
||||
Reference in New Issue
Block a user