liujiandao
2023-10-13 4a598a4d1289039928bab05e14dd5735ad219a0f
middleware/user.go
@@ -32,7 +32,15 @@
   }
}
var whiteList = map[string]struct{}{ //白名单地址列表
   "/api/code/getCodeList": {},
   "/api/data/getAllData":  {},
}
func CheckAuth(apiPath string, token string) bool {
   if _, ok := whiteList[apiPath]; ok {
      return true
   }
   cli := user.NewUserServiceClient(userConn)
   ctx, cancel := context.WithTimeout(context.Background(), time.Second)
   defer cancel()