mirror of https://github.com/bjdgyc/anylink.git
修复test未通过的问题
This commit is contained in:
parent
e9c55a0853
commit
a450fe3eef
|
@ -154,19 +154,23 @@ func SetGroup(g *Group) error {
|
|||
if err != nil {
|
||||
return errors.New("排除域名有误:" + err.Error())
|
||||
}
|
||||
// 处理认证类型
|
||||
// 处理认证方式的逻辑
|
||||
defAuth := map[string]interface{}{
|
||||
"type": "local",
|
||||
}
|
||||
if len(g.Auth) == 0 {
|
||||
g.Auth = defAuth
|
||||
}
|
||||
switch g.Auth["type"] {
|
||||
case "local":
|
||||
g.Auth = map[string]interface{}{
|
||||
"type": g.Auth["type"],
|
||||
}
|
||||
g.Auth = defAuth
|
||||
case "radius":
|
||||
err = checkRadiusData(g.Auth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
default:
|
||||
return errors.New("未知的认证类型")
|
||||
return errors.New("#" + fmt.Sprintf("%s", g.Auth["type"]) + "#未知的认证类型")
|
||||
}
|
||||
|
||||
g.UpdatedAt = time.Now()
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/bjdgyc/anylink/base"
|
||||
"github.com/bjdgyc/anylink/pkg/utils"
|
||||
"github.com/xlzd/gotp"
|
||||
"layeh.com/radius"
|
||||
|
@ -79,12 +78,12 @@ func CheckUser(name, pwd, group string) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf("%s %s", name, "No用户组")
|
||||
}
|
||||
// 初始化Auth
|
||||
if len(groupData.Auth) == 0 {
|
||||
groupData.Auth["type"] = "local"
|
||||
}
|
||||
base.Debug(name + " auth type: " + fmt.Sprintf("%s", groupData.Auth["type"]))
|
||||
switch groupData.Auth["type"] {
|
||||
case "local":
|
||||
case "", "local":
|
||||
return checkLocalUser(name, pwd, group)
|
||||
case "radius":
|
||||
radisConf := AuthRadius{}
|
||||
|
|
Loading…
Reference in New Issue