From 327aeb309a1cf58a8a72c87fb8c4763f43655d84 Mon Sep 17 00:00:00 2001 From: kgdxpr Date: Fri, 4 Jun 2021 15:22:16 +0800 Subject: [PATCH] update --- .../CaptchaController/CaptchaController.go | 45 ++++++++ .../Login/CaptchaController/RedisStore.go | 60 ++++++++++ .../Login/LoginController/LoginController.go | 103 +++++++++++++++--- dsSdsf/Business/Login/LoginDao/LoginDao.go | 37 +++++++ dsSdsf/Config/White.txt | 9 ++ dsSdsf/Handler/LoginHandler.go | 44 +++++++- dsSdsf/Utils/CommonUtil/CommonUtil.go | 47 ++++++++ dsSdsf/Utils/DbUtil/DbUtil.go | 65 +++++++++++ dsSdsf/Utils/RedisUtil/RedisUtil.go | 4 + dsSdsf/go.mod | 18 +++ dsSdsf/go.sum | 55 ++++++++++ dsSso/go.mod | 2 +- dsSso/go.sum | 2 + 13 files changed, 472 insertions(+), 19 deletions(-) create mode 100644 dsSdsf/Business/Login/CaptchaController/CaptchaController.go create mode 100644 dsSdsf/Business/Login/CaptchaController/RedisStore.go create mode 100644 dsSdsf/Business/Login/LoginDao/LoginDao.go create mode 100644 dsSdsf/Config/White.txt create mode 100644 dsSdsf/Utils/DbUtil/DbUtil.go diff --git a/dsSdsf/Business/Login/CaptchaController/CaptchaController.go b/dsSdsf/Business/Login/CaptchaController/CaptchaController.go new file mode 100644 index 00000000..6dc38306 --- /dev/null +++ b/dsSdsf/Business/Login/CaptchaController/CaptchaController.go @@ -0,0 +1,45 @@ +package CaptchaController + +import ( + "bytes" + "fmt" + "github.com/dchest/captcha" + "log" + "net/http" + "time" +) + +func Serve(w http.ResponseWriter, r *http.Request, id string, width, height int) error { + w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + w.Header().Set("Pragma", "no-cache") + w.Header().Set("Expires", "0") + var content bytes.Buffer + w.Header().Set("Content-Type", "image/png") + //设置到Redis + captcha.SetCustomStore(&RedisStoreBean) + captcha.WriteImage(&content, id, width, height) + if content.Bytes()==nil{ + return captcha.ErrNotFound + }else { + http.ServeContent(w, r, id+".png", time.Time{}, bytes.NewReader(content.Bytes())) + return nil + } +} + +func ServeHTTP(w http.ResponseWriter, r *http.Request){ + //GET方式传参 + keys, ok := r.URL.Query()["captchaId"] + if !ok || len(keys) < 1 { + log.Println("Url Param 'key' is missing") + return + } + id := keys[0] + + fmt.Println("reload : " + r.FormValue("reload")) + if r.FormValue("reload") != "" { + captcha.Reload(id) + } + if Serve(w, r, id, captcha.StdWidth, captcha.StdHeight) == captcha.ErrNotFound { + http.NotFound(w, r) + } +} diff --git a/dsSdsf/Business/Login/CaptchaController/RedisStore.go b/dsSdsf/Business/Login/CaptchaController/RedisStore.go new file mode 100644 index 00000000..153867aa --- /dev/null +++ b/dsSdsf/Business/Login/CaptchaController/RedisStore.go @@ -0,0 +1,60 @@ +package CaptchaController + +import ( + "bytes" + "dsSdsf/Utils/RedisUtil" + "fmt" +) + +//redis键值前缀 +var prefix = "captcha_" + +//自定验证码的保存到redis,解决因集群负载均衡造成下一个请求无法访问的到的问题 +var RedisStoreBean RedisStore //单例模式 + +type RedisStore struct { +} + +func (_redis *RedisStore) Set(captchaId string, digits []byte) { + //将captchaId和value值写入到redis,并且定义好过期时间,比如120秒 + key := prefix + captchaId + RedisUtil.SET(key, string(digits), 120) +} +func getValue(captchaId string) (digits []byte) { + //通过capthcId从redis中读取value值 + key := prefix + captchaId + value, err := RedisUtil.GET(key) + if err != nil { + fmt.Println(err) + return nil + } else { + return []byte(value) + } +} + +func (_redis *RedisStore) Get(captchaId string, clear bool) (digits []byte) { + return getValue(captchaId) +} + +func (_redis *RedisStore) VerifyString(captchaId string, value string) bool { + key := prefix + captchaId + digits := getValue(captchaId) + //这段代码抄自captcha.go源码 + ns := make([]byte, len(value), 8) + for i := range ns { + d := value[i] + switch { + case '0' <= d && d <= '9': + ns[i] = d - '0' + case d == ' ' || d == ',': + // ignore + default: + return false + } + } + //阅后即焚 + RedisUtil.DEL(key) + //返回两个字节数组的对比结果 + isOk := bytes.Equal(digits, ns) + return isOk +} diff --git a/dsSdsf/Business/Login/LoginController/LoginController.go b/dsSdsf/Business/Login/LoginController/LoginController.go index 8ca57190..1efa61c6 100644 --- a/dsSdsf/Business/Login/LoginController/LoginController.go +++ b/dsSdsf/Business/Login/LoginController/LoginController.go @@ -1,11 +1,13 @@ package LoginController import ( + "dsSdsf/Business/Login/CaptchaController" + "dsSdsf/Business/Login/LoginDao" "dsSdsf/Utils/CommonUtil" - "dsSdsf/Utils/ConfigUtil" "dsSdsf/Utils/RedisUtil" "dsSdsf/Utils/RsaUtil" "encoding/base64" + "github.com/dchest/captcha" "github.com/gin-gonic/gin" "net/http" ) @@ -16,6 +18,11 @@ func Routers(r *gin.RouterGroup) { rr.GET("/test", test) rr.GET("/test1", test1) + rr.GET("/testSql", testSql) + + rr.GET("/getCaptchaId", getCaptchaId) + rr.GET("/getCaptchaPng", getCaptchaPng) + rr.GET("/verifyCaptcha", verifyCaptcha) rr.POST("/doLogin", doLogin) return @@ -26,31 +33,50 @@ func test(c *gin.Context) { enb, _ := base64.StdEncoding.DecodeString(b) decryptPwd, err := RsaUtil.RsaDecrypt(enb) if err != nil { - c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "无法解密!"}) + c.JSON(http.StatusOK, gin.H{"success": false, "info": "无法解密!"}) return } - c.JSON(http.StatusOK, gin.H{"sucess": true, "info": string(decryptPwd)}) + c.JSON(http.StatusOK, gin.H{"success": true, "info": string(decryptPwd)}) } func test1(c *gin.Context) { - redirectUri := c.Query("redirect_uri") + //redirectUri := c.Query("redirect_uri") token := CommonUtil.GetUUID() RedisUtil.SET(token, "1", 3000) c.SetCookie("token", token, 0, "/", "", false, true) - c.Redirect(http.StatusMovedPermanently, redirectUri) + //c.Redirect(http.StatusMovedPermanently, redirectUri) } func doLogin(c *gin.Context) { + //用户名 user := c.PostForm("user") + //密码 pwd := c.PostForm("pwd") + //验证码ID + captchaId := c.PostForm("captchaId") + //验证码值 + captchaVal := c.PostForm("captchaVal") if user == "" || pwd == "" { - c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "用户名或密码不允许为空!"}) + c.JSON(http.StatusOK, gin.H{"success": false, "info": "用户名或密码不允许为空!"}) + return + } + + if captchaId == "" || captchaVal == "" { + c.JSON(http.StatusOK, gin.H{"success": false, "info": "验证码不允许为空!"}) + return + } + + //验证码校验 + var redisStore CaptchaController.RedisStore + verifyFlag := redisStore.VerifyString(captchaId, captchaVal) + if !verifyFlag { + c.JSON(http.StatusOK, gin.H{"success": verifyFlag, "info": "验证码不正确!"}) return } @@ -58,15 +84,16 @@ func doLogin(c *gin.Context) { base64Pwd, _ := base64.StdEncoding.DecodeString(pwd) decryptPwdByte, err := RsaUtil.RsaDecrypt(base64Pwd) if err != nil { - c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "用户名或密码不正确!"}) + c.JSON(http.StatusOK, gin.H{"success": false, "info": "用户名或密码不正确!"}) return } - //真实密码 - realPwd := string(decryptPwdByte) - //验证密码 - if realPwd != ConfigUtil.UserPwd { - c.JSON(http.StatusOK, gin.H{"sucess": false, "info": "用户名或密码不正确!"}) + //前台密码经过RSA解密和MD5加密 + md5Pwd := CommonUtil.MD5(string(decryptPwdByte)) + + //校验用户名和密码是否存在 + if !LoginDao.GetLoginPwdExists(user, md5Pwd) { + c.JSON(http.StatusOK, gin.H{"success": false, "info": "用户名或密码不正确!"}) return } @@ -77,6 +104,56 @@ func doLogin(c *gin.Context) { //写cookie c.SetCookie("token", token, 0, "/", "", false, true) - c.JSON(http.StatusOK, gin.H{"sucess": true, "info": "登录成功!"}) + c.JSON(http.StatusOK, gin.H{"success": true, "info": "登录成功!"}) +} + +func getCaptchaId(c *gin.Context) { + + captcha.SetCustomStore(&CaptchaController.RedisStoreBean) + + captchaId := captcha.NewLen(4) + + c.JSON(http.StatusOK, gin.H{"success": true, "captchaId": captchaId}) +} + +func getCaptchaPng(c *gin.Context) { + CaptchaController.ServeHTTP(c.Writer, c.Request) +} + +func verifyCaptcha(c *gin.Context) { + captchaId := c.Query("captchaId") + captchaVal := c.Query("captchaVal") + + var redisStore CaptchaController.RedisStore + verifyFlag := redisStore.VerifyString(captchaId, captchaVal) + + if verifyFlag { + c.JSON(http.StatusOK, gin.H{"success": verifyFlag, "info": "验证成功!"}) + } else { + c.JSON(http.StatusOK, gin.H{"success": verifyFlag, "info": "验证失败!"}) + } +} + +func testSql(c *gin.Context) { + /* + results, err := LoginDao.TestSqlJson() + if err != nil { + c.JSON(http.StatusOK, gin.H{"success": false, "info": "无法解密!"}) + return + } + c.JSON(http.StatusOK, gin.H{"success": true, "info": CommonUtil.ConvertJsonStringToMapArray(results)}) + */ + + /* + record := LoginDao.TestSqlSingle() + c.JSON(http.StatusOK, gin.H{"success": true, "info": record["pct_tel"].String()}) + */ + + jsonStr := `{"user":"admin","pwd":"dsideal","captchaId":"Av7CyMklC3EBXv4BVevW","captchaVal":"3698"}` + + myMap, err := CommonUtil.JsonStringToMap(jsonStr) + + + c.JSON(http.StatusOK, gin.H{"success": err, "info": myMap["captchaId"]}) } diff --git a/dsSdsf/Business/Login/LoginDao/LoginDao.go b/dsSdsf/Business/Login/LoginDao/LoginDao.go new file mode 100644 index 00000000..42f87df4 --- /dev/null +++ b/dsSdsf/Business/Login/LoginDao/LoginDao.go @@ -0,0 +1,37 @@ +package LoginDao + +import ( + "dsSdsf/Utils/DbUtil" + "github.com/xormplus/xorm" +) + +var db = DbUtil.Engine + +func TestSqlJson() (string, error) { + sql := "select * from t_complaint_info" + results, err := db.SQL(sql).Query().Json() + return results, err +} + +func TestSqlSingle() xorm.Record { + record := make(xorm.Record) + sql := "select * from t_complaint_info where id =?" + db.SQL(sql, "157328").Get(&record) + return record +} + +func TestSqlUpdate() { + sql := "update t_complaint_info set pct_tel = ? where id = ?" + db.SQL(sql, "13999999998", "157328").Execute() +} + +//用户名和密码是否存在 +func GetLoginPwdExists(user string, pwd string) bool { + flag := false + sql := "select login_pwd from t_complaint_login where login_name = ? and login_pwd = ? and b_use = 1" + c, _ := db.SQL(sql, user, pwd).Query().Count() + if c > 0 { + flag = true + } + return flag +} diff --git a/dsSdsf/Config/White.txt b/dsSdsf/Config/White.txt new file mode 100644 index 00000000..722a1a93 --- /dev/null +++ b/dsSdsf/Config/White.txt @@ -0,0 +1,9 @@ +.ico +.html +.css +.jpg +.jpeg +.png +.js +/sdsf/login/doLogin +/sdsf/login/test1 \ No newline at end of file diff --git a/dsSdsf/Handler/LoginHandler.go b/dsSdsf/Handler/LoginHandler.go index ab9b5af7..c131c5ef 100644 --- a/dsSdsf/Handler/LoginHandler.go +++ b/dsSdsf/Handler/LoginHandler.go @@ -1,20 +1,53 @@ package Handler import ( + "bufio" + "dsSdsf/Utils/CommonUtil" "dsSdsf/Utils/RedisUtil" + "fmt" "github.com/gin-gonic/gin" + "io" "net/http" + "os" "strings" ) +var WhiteArray []string + +// 初始化白名单 +func init() { + configIniFile := "./Config/White.txt" + if !CommonUtil.Exists(configIniFile) { + configIniFile = "/usr/local/dsMin/dsBaseWeb/Config/White.txt" + } + f, err := os.Open(configIniFile) + if err != nil { + fmt.Println("没有找到白名单文件!") + } + buf := bufio.NewReader(f) + for { + line, err := buf.ReadString('\n') + line = strings.TrimSpace(line) + if strings.Index(line, "#") < 0 && len(line) > 0 { + WhiteArray = append(WhiteArray, line) + } + if err != nil || io.EOF == err { + break + } + } +} + func LoginHandler() gin.HandlerFunc { return func(c *gin.Context) { requestUri := c.Request.RequestURI - if strings.Index(requestUri, "/sdsf/login/test1") >= 0 { - //放行~ - c.Next() - return + //白名单中的放行 + for i := 0; i < len(WhiteArray); i++ { + if strings.Index(requestUri, WhiteArray[i]) >= 0 { + //放行~ + c.Next() + return + } } //是否需要登录,默认为true需要登录 @@ -30,7 +63,8 @@ func LoginHandler() gin.HandlerFunc { } if needLoginFlag { - c.Redirect(http.StatusMovedPermanently, "/sdsf/login/test1?redirect_uri="+requestUri) + //跳转到登录页面 + c.Redirect(http.StatusMovedPermanently, "/sdsf/login/doLogin?redirect_uri="+requestUri) } else { //将redis中的token有效期重置 RedisUtil.EXPIRE(cookieToken.Value, 1800) diff --git a/dsSdsf/Utils/CommonUtil/CommonUtil.go b/dsSdsf/Utils/CommonUtil/CommonUtil.go index f7347563..912e9bc6 100644 --- a/dsSdsf/Utils/CommonUtil/CommonUtil.go +++ b/dsSdsf/Utils/CommonUtil/CommonUtil.go @@ -1,7 +1,12 @@ package CommonUtil import ( + "crypto/md5" + "encoding/hex" + "encoding/json" + "fmt" uuid "github.com/satori/go.uuid" + "os" "strings" ) @@ -14,3 +19,45 @@ func GetUUID() string { u2 := strings.ToUpper(uuid.NewV4().String()) return u2 } + +/** +功能:将JSON字符串转化为map数组 +作者: 黄海 +时间:2020-04-17 +*/ +func ConvertJsonStringToMapArray(data string) []map[string]interface{} { + var m = make([]map[string]interface{}, 0) + str := []byte(data) + json.Unmarshal(str, &m) + return m +} + +func MD5(v string) string { + d := []byte(v) + m := md5.New() + m.Write(d) + return hex.EncodeToString(m.Sum(nil)) +} + +// 判断所给路径文件/文件夹是否存在 +func Exists(path string) bool { + _, err := os.Stat(path) //os.Stat获取文件信息 + if err != nil { + if os.IsExist(err) { + return true + } + return false + } + return true +} + +//json字符串转map +func JsonStringToMap(jsonStr string) (map[string]string, error) { + m := make(map[string]string) + err := json.Unmarshal([]byte(jsonStr), &m) + if err != nil { + fmt.Printf("Unmarshal with error: %+v\n", err) + return nil, err + } + return m, nil +} diff --git a/dsSdsf/Utils/DbUtil/DbUtil.go b/dsSdsf/Utils/DbUtil/DbUtil.go new file mode 100644 index 00000000..edba39f6 --- /dev/null +++ b/dsSdsf/Utils/DbUtil/DbUtil.go @@ -0,0 +1,65 @@ +package DbUtil + +import ( + "dsSdsf/Utils/ConfigUtil" + "fmt" + _ "github.com/go-sql-driver/mysql" + "github.com/xormplus/xorm" + "github.com/xormplus/xorm/log" + "os" + "time" +) + +var Engine *xorm.Engine + +func init() { + host := ConfigUtil.MysqlIp + port := ConfigUtil.MysqlPort + user := ConfigUtil.MysqlUser + dbname := ConfigUtil.MysqlDbName + password := ConfigUtil.MysqlPwd + //mysql + master := fmt.Sprintf("%s:%s@%s(%s:%s)/%s?charset=utf8", user, password, "tcp", host, port, dbname) + var err error + Engine, err = xorm.NewEngine("mysql", master) + if err != nil { + fmt.Println(err) + } + //注册SqlMap配置,可选功能,如应用中无需使用SqlMap,可无需初始化 + err = Engine.RegisterSqlMap(xorm.Xml("./Sql", ".xml")) + if err != nil { + fmt.Println(err) + } + + //设置数据库连接池 + Engine.SetMaxOpenConns(100) //设置打开数据库的最大连接数,包含正在使用的连接和连接池的连接。 + Engine.SetMaxIdleConns(10) //设置连接池中的保持连接的最大连接数。 + Engine.SetConnMaxLifetime(time.Second * 30) + + //调用第一次 + Engine.Ping() + + //这段代码是黄海后加上的 2020-04-16 + //通过定时ping保持鲜活 + // 创建完成engine之后,并没有立即连接数据库,此时可以通过engine.Ping()来进行数据库的连接测试是否可以连接到数据库。 + // 另外对于某些数据库有连接超时设置的,可以通过起一个定期Ping的Go程来保持连接鲜活。 + go func() { + for { + //https://studygolang.com/articles/12617 + time.Sleep(time.Duration(10) * time.Second) + Engine.Ping() + } + }() + + //设置数据时区 + var location *time.Location + location, err = time.LoadLocation("Asia/Shanghai") + Engine.TZLocation = location + + //显示+记录SQL日志 + f, _ := os.Create(ConfigUtil.DistributeRemotePath + "sql.log") + Engine.SetLogger(log.NewSimpleLogger(f)) + + Engine.ShowSQL(true) // 则会在控制台打印出生成的SQL语句 + Engine.Logger().SetLevel(log.LOG_DEBUG) //则会在控制台打印info及以上的信息 +} diff --git a/dsSdsf/Utils/RedisUtil/RedisUtil.go b/dsSdsf/Utils/RedisUtil/RedisUtil.go index ddcb91ee..4811a08f 100644 --- a/dsSdsf/Utils/RedisUtil/RedisUtil.go +++ b/dsSdsf/Utils/RedisUtil/RedisUtil.go @@ -34,3 +34,7 @@ func GET(key string) (string, error) { func EXPIRE(key string, expiration time.Duration) { RedisClient.Expire(key, expiration*time.Second) } + +func DEL(key string) { + RedisClient.Del(key) +} diff --git a/dsSdsf/go.mod b/dsSdsf/go.mod index 6ae53936..5321de7a 100644 --- a/dsSdsf/go.mod +++ b/dsSdsf/go.mod @@ -3,9 +3,27 @@ module dsSdsf go 1.16 require ( + github.com/Chronokeeper/anyxml v0.0.0-20160530174208-54457d8e98c6 // indirect + github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect + github.com/CloudyKit/jet v2.1.2+incompatible // indirect + github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee // indirect + github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 // indirect + github.com/bndr/gotabulate v1.1.2 // indirect + github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect + github.com/fatih/structs v1.1.0 // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gin-gonic/gin v1.7.2 // indirect github.com/go-redis/redis v6.15.9+incompatible // indirect + github.com/go-sql-driver/mysql v1.6.0 // indirect + github.com/golang/snappy v0.0.3 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/satori/go.uuid v1.2.0 // indirect + github.com/syndtr/goleveldb v1.0.0 // indirect + github.com/tealeg/xlsx v1.0.5 // indirect + github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be // indirect + github.com/xormplus/xorm v0.0.0-20210512135344-8123d584d5f5 // indirect + golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b // indirect + gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 // indirect gopkg.in/ini.v1 v1.62.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/dsSdsf/go.sum b/dsSdsf/go.sum index 7e918980..d2b5f5ec 100644 --- a/dsSdsf/go.sum +++ b/dsSdsf/go.sum @@ -1,6 +1,26 @@ +gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= +github.com/Chronokeeper/anyxml v0.0.0-20160530174208-54457d8e98c6 h1:Etfj2lhXyrYemgmWzEtEQQb1kezeEXc8jVjkQUyJnWI= +github.com/Chronokeeper/anyxml v0.0.0-20160530174208-54457d8e98c6/go.mod h1:YzuYAe2hrrwKXkM9kqjbkTLlkbA+/xw2MA46f1+ENxc= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet v2.1.2+incompatible h1:ybZoYzMBdoijK6I+Ke3vg9GZsmlKo/ZhKdNMWz0P26c= +github.com/CloudyKit/jet v2.1.2+incompatible/go.mod h1:HPYO+50pSWkPoj9Q/eq0aRGByCL6ScRlUmiEX5Zgm+w= +github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee h1:0RklYSvekYaIFI9JUx7TFPQvo++TdILmZiV17QI4nXk= +github.com/agrison/go-tablib v0.0.0-20160310143025-4930582c22ee/go.mod h1:M9nmO4lBRWR/bBv7UCOmDJ1MB2DVoqz19B4JchDA+K0= +github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4 h1:XBNSe5eibe5Fh131ah+xnO6s4A97U1T3tKZKLQQvqu0= +github.com/agrison/mxj v0.0.0-20160310142625-1269f8afb3b4/go.mod h1:n7qJAqL9BKqGqiJyjPbWtxpdswTL5wX0IVP2Uw4vVhQ= +github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c= +github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f h1:q/DpyjJjZs94bziQ7YkBmIlpqbVP7yw179rnzoNVX1M= +github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY= +github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.7.2 h1:Tg03T9yM2xa8j6I3Z3oqLaQRSmKvxPd6g/2HJ6zICFA= @@ -15,12 +35,22 @@ github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7a github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= github.com/go-redis/redis v6.15.9+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= @@ -29,6 +59,9 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OH github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -40,19 +73,33 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE= +github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= +github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE= +github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be h1:HTSana2sMSKVze3XXYrF89w2tw835Fh+7xX5KPvAkuo= +github.com/xormplus/builder v0.0.0-20200331055651-240ff40009be/go.mod h1:PgBA7NoHtnttVkWModa/qpvIWkX6MpOKgyRCWsSKSB0= +github.com/xormplus/xorm v0.0.0-20210512135344-8123d584d5f5 h1:cWR+WB50oxaGYLQP/GKODvUPgpAMikPeW5BQKSmvvU0= +github.com/xormplus/xorm v0.0.0-20210512135344-8123d584d5f5/go.mod h1:+v6b10b4x5IcQmp1/Cbo9IqaknxVeuhQng+fhya6bdI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b h1:qh4f65QIVFjq9eBURLEYWqaEXmOyqdUyiBSgaXWccWk= +golang.org/x/sys v0.0.0-20210601080250-7ecdf8ef093b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -60,8 +107,16 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IK golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 h1:eyQQg/uGuZ3ndaBhqteakHpVW+dSOPalilfC9RpM2TA= +gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4/go.mod h1:bJkYqV5pg6+Z7MsSu/hSb1zsPT955hBW2QHLE1jm4wA= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= diff --git a/dsSso/go.mod b/dsSso/go.mod index 8c191639..f72f8574 100644 --- a/dsSso/go.mod +++ b/dsSso/go.mod @@ -14,7 +14,7 @@ require ( github.com/bluesky335/IDCheck v0.0.0-20200103080159-bc528ea71642 github.com/bndr/gotabulate v1.1.2 // indirect github.com/clbanning/mxj v1.8.4 // indirect - github.com/dchest/captcha v0.0.0-20170622155422-6a29415a8364 + github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f github.com/fatih/structs v1.1.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/garyburd/redigo v1.6.0 diff --git a/dsSso/go.sum b/dsSso/go.sum index 6678ede3..8273b8dc 100644 --- a/dsSso/go.sum +++ b/dsSso/go.sum @@ -54,6 +54,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/captcha v0.0.0-20170622155422-6a29415a8364 h1:U+BMqUt8LFgyrF0/NKgPZdr1sGZ3j6uBECpOGcISpFI= github.com/dchest/captcha v0.0.0-20170622155422-6a29415a8364/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY= +github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f h1:q/DpyjJjZs94bziQ7YkBmIlpqbVP7yw179rnzoNVX1M= +github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY= github.com/denisenkom/go-mssqldb v0.0.0-20180707235734-242fa5aa1b45 h1:UW8VerkZA1zCt3uWhQ2wbMae76OLn7s7Utz8wyKtJUk= github.com/denisenkom/go-mssqldb v0.0.0-20180707235734-242fa5aa1b45/go.mod h1:xN/JuLBIz4bjkxNmByTiV1IbhfnYb6oo99phBn4Eqhc= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=