证书作为公钥进行验证
This commit is contained in:
@@ -25,8 +25,9 @@ func (*ReqCMCALoginAlarm) Handle(request ziface.IRequest) {
|
||||
body, err := parse.RequestBodyDecode(request, []string{"user", "key", "cert", "type"})
|
||||
username := body.Data["user"]
|
||||
key := body.Data["key"]
|
||||
cert := body.Data["cert"]
|
||||
tp := body.Data["type"]
|
||||
if err != nil || username == "" || key == "" || tp == "" {
|
||||
if err != nil || username == "" || cert == "" || key == "" || tp == "" {
|
||||
zlog.Ins().ErrorF("inlaid message body %s", err.Error())
|
||||
request.GetConnection().SendMsg(ReqLoginAlarmMsgType, core.ResultError(ReqLoginAlarmMsgName, err.Error(), ""))
|
||||
return
|
||||
@@ -49,7 +50,7 @@ func (*ReqCMCALoginAlarm) Handle(request ziface.IRequest) {
|
||||
seqNo := m.GetUserByPID(uid.(string)).SeqNo
|
||||
content := username + ":" + seqNo
|
||||
// 检查判断是否对应随机码
|
||||
if err := service.CMCALogin(content, key); err != nil {
|
||||
if err := service.CMCALogin(cert, content, key); err != nil {
|
||||
zlog.Ins().ErrorF("LoginFail %s", err)
|
||||
request.GetConnection().SendMsg(ReqLoginAlarmMsgType, core.Result(ReqLoginAlarmMsgName, map[string]string{
|
||||
"result": "autherror",
|
||||
|
||||
Reference in New Issue
Block a user