Network penetration/dynamic networking/video cloud gateway EasyNTS networking platform can’t log in when entering account and password, how to solve

As a video cloud gateway, EasyNTS has functions such as video networking and remote operation and maintenance. Before going online, it will go through multiple tests from the R&D department-testing department-project department. In this process, the product is continuously improved.

EasyNTS architecture diagram 12.5D.png

Recently, our developers tested the compatibility of EasyNTS and found that when both EasyNTS and EasyNVS are deployed on the same server, the web pages of the two services are accessed in the same browser. At this time, if you log in to EasyNVS first, it will cause EasyNTS cannot log in; if you enter EasyNTS directly, it will show that the network request failed.

Cause Analysis

The reason is that the token is set in the Cookie after logging in to EasyNVS. After EasyNTS sends the request, it gets the token of EasyNVS for verification. However, the verification must have failed, so login is not possible.

Value in cookie:

34.png

After EasyNVS login, EasyNTS reports an error:

35.png

Solve the problem

At the beginning, to verify whether the user is logged in is first verified through the token, but EasyNTS does not use the token, but uses the sid as the key to obtain the corresponding value for verification. So remove the token verification code in EasyNTS.

// 判断用户是否已经登录
func userIsLogin(c *gin.Context) (bool, error) {

   token := sessions.GetToken(c)

   // 如果查找到了 token
   if token != consts.EmptyString {
      username, password, str := security.ResolveToken(token)
      if str == consts.EmptyString && username != consts.EmptyString && password != consts.EmptyString {
         // 从 session 中获取用户 ID 同 token 中解析,二次验证防止出错
         userID := sessions.GetUserID(c)
         if userID == username {
            return true, nil
         } else {
            return false, errors.New("Session信息与令牌信息不一致,请重新登录!")
         }
      } else {
         return false, errors.New("令牌已过期,请重新登录!")
      }
   }

   return false, errors.New("未查找到令牌信息,请重新登录!")
}

After the solution, it can be used normally and log in normally:

36.png

More about EasyNTS cloud networking

  • Stable and reliable The
    powerful server group supports the networking environment, with multiple types of servers to choose from, high performance and high availability;
  • Simple and easy to use
    Create an intelligent network based on dynamic networking services, and select network members that need networking to achieve point-to-point interconnection;
  • Data security
    The MQTT encryption protocol is adopted, which has the advantages of fast calculation speed, high security and low resource consumption;
  • Efficient management
    Centralized management of each network through the web, completely solve the problem of complex deployment and low maintenance.

If you want to know more about it, you can enter the TSINGSEE green rhino video to browse and check. The TSINGSEE Qingxi Video team focuses on the development and research in the fields of computer vision and pattern recognition. Its main products cover multi-protocol and multi-channel intelligent analysis servers that support ONVIF, RTSP, GB/T28181, etc. The main products include EasyGBS national standard video cloud service, EasyDSS Internet video cloud service, EasyCVR security video cloud service, EasyRTC video conference cloud service, EasyNVR video edge computing gateway, EasyNTS cloud gateway, etc. It also has EasyDarwin open source community and open platform.

EasyDarwin is an open source community developed and maintained by the domestic video streaming team TSINGSEE Qingxi Video. Since its establishment and development in December 2012, it has expanded from the original single-service streaming media server form to the current open source project of the cloud platform architecture.

Guess you like

Origin blog.csdn.net/EasyNTS/article/details/108747702