Forráskód Böngészése

feature:基础模块开发
1.修改token验证

ZZH-wl 3 éve
szülő
commit
b1a09a6055

+ 1 - 0
opms_admin/main.go

@@ -34,6 +34,7 @@ func main() {
 // AuthExcludePaths 设定不需要认证的路径
 var AuthExcludePaths = []string{
 	"/Auth/Login",
+	"/Auth/ValidToken",
 	"/Role/GetRoleList",
 	"/Common/GetCaptchaImg",
 	"/Model/*",

+ 1 - 2
opms_libary/micro_srv/micro_srv.go

@@ -199,7 +199,6 @@ func HandleAuth(ctx context.Context, req *protocol.Message, token string, authEx
 	path := "/" + req.ServicePath + "/" + req.ServiceMethod
 	//g.Log().Info("reqPath: ", path)
 	//g.Log().Info("token: ", token)
-	req.Metadata["authExclude"] = "true"
 
 	if authPath(path, authExcludePaths) {
 		req.Metadata["authExclude"] = "false"
@@ -271,7 +270,7 @@ func validToken(token string) gtoken.Resp {
 		return grsp
 	}
 
-	authService := InitMicroSrvClient("Admin", "micro_srv.auth")
+	authService := InitMicroSrvClient("Auth", "micro_srv.auth")
 	defer authService.Close()
 	rsp := &auth.Response{}
 	err := authService.Call(context.TODO(), "ValidToken", token, rsp)

+ 1 - 1
opms_parent/config/config.toml

@@ -19,4 +19,4 @@
         link = "mysql:root:Dashoo#190801@tcp(127.0.0.1:3306)/dashoo_crm"
 
 [micro_srv]
-    auth = "dashoo.opms.admin-0.0.1"
+    auth = "dashoo.opms.admin-0.0.1,127.0.0.1:8887"