Disclosure of Invention
In view of the above, the embodiments of the present invention provide a method and a system for accessing a local area network based on WeChat, so as to overcome the problem in the prior art that access will be interrupted when a VPN gateway is in a problem, which affects user access experience, by using a VPN gateway to access the local area network.
The embodiment of the invention provides a local area network access method based on WeChat, which is applied to WeChat clients, and comprises the following steps:
Sending an access request to a server of a local area network;
Receiving a token and a WeChat message encryption key sent by the server, wherein the token and the WeChat message encryption key are distributed to the WeChat client after the server performs identity verification on the WeChat client by using the access request;
Sending a simulated access request with the token to the server;
after receiving an access success identification sent by the server, establishing data access with the server based on the token and the WeChat message encryption key, and sending the access success identification after verifying that the token carried in the simulated access request is consistent with the token distributed for the WeChat client for the server.
Optionally, the sending an access request to a server of the local area network includes:
acquiring identity information of a WeChat client;
and sending an access request with the identity information to the server.
Optionally, the establishing data access with the server based on the token and the WeChat message encryption key includes:
Acquiring the data access requirement of a user;
generating a data access request based on the data access requirement and the token;
Encrypting the data access request by utilizing the WeChat message encryption key, and sending the encrypted data access request to the server;
and receiving the access data fed back by the server.
Optionally, the method further comprises:
And decrypting the access data by using the WeChat message encryption key to obtain decrypted access data.
The embodiment of the invention also provides a local area network access method based on WeChat, which is applied to a server of a local area network and comprises the following steps:
receiving an access request sent by a WeChat client;
the access request is utilized to carry out identity verification on the WeChat client, and after the identity verification is passed, a token and a WeChat message encryption key are distributed to the WeChat client;
sending the token and the WeChat message encryption key to the WeChat client;
receiving a simulated access request with a token sent by the WeChat client;
verifying whether a token carried in the simulated access request is consistent with a token distributed for the WeChat client;
And when the verification is consistent, sending an access success identifier to the WeChat client so as to establish data access with the WeChat client.
Optionally, the performing identity verification on the WeChat client by using the access request includes:
extracting the identity information of the WeChat client from the access request;
judging whether the identity information is consistent with the entered identity information of the WeChat client;
And when the identity information is consistent with the identity information of the input WeChat client, determining that the identity verification passes.
Optionally, the establishing data access with the WeChat client includes:
receiving a data access request sent by the WeChat client;
decrypting the data access request by using the WeChat message encryption key to obtain the data access requirement and the token of the WeChat client;
Judging whether the decrypted token is consistent with the token distributed to the WeChat client;
when the data access requirements are consistent, extracting access data based on the data access requirements;
And sending the access data to the WeChat client.
Optionally, the extracting access data based on the data access requirement includes:
extracting an operation command in the data access requirement;
Calling a corresponding functional module to execute corresponding operation based on the operation command to obtain an execution result fed back by the functional module;
and obtaining access data based on the execution result.
Optionally, the sending the access data to the WeChat client includes:
encrypting the access data and the token by using the WeChat message encryption key to obtain encrypted access data;
and sending the encrypted access data to the WeChat client.
The embodiment of the invention also provides a local area network access system based on the WeChat, which comprises a WeChat client and a server of the local area network, wherein,
The WeChat client sends an access request to a server of a local area network;
the server receives an access request sent by a WeChat client, performs identity verification on the WeChat client by utilizing the access request, and distributes a token and a WeChat message encryption key for the WeChat client after the identity verification is passed;
The WeChat client receives the token and the WeChat message encryption key sent by the server; sending a simulated access request with the token to the server;
The server receives a simulated access request with a token sent by the WeChat client, verifies whether the token carried in the simulated access request is consistent with the token distributed for the WeChat client or not, and sends an access success identifier to the WeChat client when the token is verified to be consistent with the token distributed for the WeChat client;
and after receiving the access success identification sent by the server, the WeChat client establishes data access with the server based on the token and the WeChat message encryption key.
The technical scheme of the invention has the following advantages:
1. The embodiment of the invention provides a local area network access method based on WeChat, which is applied to WeChat clients, wherein a token and a WeChat message encryption key are distributed to the clients passing verification in a mode of identity verification between the clients and a server, whether the clients are successfully accessed to the server is verified in a mode of simulating an access request, mutual trust relationship identification of the clients and the server is realized, and data access of the clients and the server can be established after the clients are successfully accessed, so that access of a user terminal to the local area network can be realized without VPN deployment, normal access of users is prevented from being influenced due to the occurrence of problems of VPN gateways, and transmission safety in the data access process is ensured and access experience of the users is improved through a transmission mode of the token and the WeChat message encryption key.
2. The embodiment of the invention provides a local area network access method based on WeChat, which is applied to a server of the local area network, wherein a token and a WeChat message encryption key are distributed to a client passing verification in a mode of identity verification between the client and the server, whether the client is successfully accessed to the server is verified in a mode of simulating an access request, mutual trust relationship identification of the client and the server is realized, and data access of the client and the server can be established after the client is successfully accessed, so that access of a user terminal to the local area network can be realized without VPN deployment, normal access of a user is prevented from being influenced due to the occurrence of problems of a VPN gateway, and transmission safety in the data access process is ensured and access experience of the user is improved through a transmission mode of the token and the WeChat message encryption key.
3. The embodiment of the invention also provides a local area network access system based on WeChat, which consists of a WeChat client and a server of the local area network, wherein the system distributes a token and a WeChat message encryption key for the client passing verification by a mode of carrying out identity verification between the client and the server, verifies whether the client is successfully accessed to the server by simulating an access request, realizes mutual trust relationship identification of the client and the server, and establishes data access of the client and the server after successful access, thereby realizing access of a user terminal to the local area network without deploying VPN, avoiding problems of a VPN gateway to influence normal access of a user, ensuring transmission safety in the data access process by a transmission mode of the token and the WeChat message encryption key, and improving access experience of the user.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The technical features of the different embodiments of the invention described below may be combined with one another as long as they do not conflict with one another.
In the prior art, a manner of remote access to a private network, i.e., a local area network, by a user terminal is generally implemented by a VPN gateway configured with a private network in a VPN server. However, the technology is complicated to deploy, and when a VPN gateway has a problem, the access from the user terminal to the private network is interrupted, so that the access experience of the user is affected.
Based on the above problems, the embodiment of the invention provides a local area network access system based on a micro-letter, as shown in fig. 1, which comprises a micro-letter client 101 and a server 102 of the local area network, wherein the micro-letter client 101 sends an access request to the server 102 of the local area network, the server 102 receives the access request sent by the micro-letter client 101, performs identity verification on the micro-letter client 101 by using the access request, distributes a token and a micro-letter message encryption key to the micro-letter client 101 after the identity verification is passed, sends the token and the micro-letter message encryption key to the micro-letter client 101, the micro-letter client 101 receives the token and the micro-letter message encryption key sent by the server 102, sends a simulated access request with the token to the server 102, the server 102 receives the simulated access request with the token sent by the micro-letter client 101, verifies whether the token carried by the simulated access request is consistent with the token distributed for the micro-letter client 101, sends an access success identification to the micro-letter client 101 when the token is verified to be consistent, and establishes an access success identification with the micro-letter client 101 based on the token and the encrypted data of the micro-letter client 102 after the access identification sent by the server 102 is received.
Specifically, if the local area network is a proprietary network of an enterprise, the WeChat client 101 corresponds to the enterprise WeChat client 101, and if the local area network is other types of internal networks, the WeChat client 101 may also be a personal WeChat client 101, specifically, the settings may be performed according to the application scenario of the actual local area network, which is not limited in the present invention. It should be noted that, the server 102 of the lan is the server 102 responsible for the communication service of the whole lan, and the server 102 of one lan may correspond to a plurality of micro-letter clients 101, or may correspond to an enterprise micro-letter client 101 or a personal micro-letter client 101, in this embodiment of the present invention, the description is given by taking a data access between one of the micro-letter clients 101 and the server 102 of the lan as an example, and a specific interaction process between the micro-letter client 101 and the server 102 of the lan is referred to as an interaction schematic diagram shown in fig. 2 and a specific process schematic diagram of access to the lan based on micro-letter as shown in fig. 3. In practical applications, the server 102 of the lan may establish data access with multiple WeChat clients 101 at the same time, and the specific implementation process is similar to the access process of one WeChat client 101, which is not described herein.
Detailed working procedures of the WeChat client 101 and the server 102 are described in the following steps of the method embodiment, and will not be described here.
Through the cooperation of the components, the local area network access system based on WeChat provided by the embodiment of the invention distributes a token and a WeChat message encryption key for the client passing verification by means of identity verification between the client and the server, verifies whether the client is successfully accessed to the server by means of simulating an access request, realizes mutual trust relationship identification of the client and the server, and establishes data access of the client and the server after successful access, thereby realizing access of a user terminal to the local area network without VPN deployment, avoiding problems of a VPN gateway to influence normal access of a user, ensuring transmission safety in the data access process by means of transmission of the token and the WeChat message encryption key, and improving access experience of the user.
The embodiment of the invention also provides a local area network access method based on WeChat, which is applied to the WeChat client 101 shown in fig. 1 and the server 102 of the local area network, wherein as shown in fig. 2, the WeChat client 101 is used for executing steps S101 to S104, and the server 102 is used for executing steps S201 to S206.
Step S101, sending an access request to a server of the local area network.
Specifically, the method comprises the steps of acquiring identity information of a WeChat client, and sending an access request with the identity information to a server. Taking the WeChat client as an enterprise WeChat as an example, the identity information can comprise an enterprise ID, an application ID and the like of the enterprise WeChat.
Step S201, receiving an access request sent by a WeChat client.
And step S202, carrying out identity verification on the WeChat client by using the access request, and distributing a token and a WeChat message encryption key for the WeChat client after the identity verification is passed.
Specifically, in order to ensure the security of the access of the WeChat client, the known and legal WeChat client is ensured to be called a client access server for short. The information of the client, such as enterprise ID, application ID and the like of enterprise WeChat, needs to be firstly input on the server, and after the information of the client is input on the server, the client can actively initiate an access request to the server.
Further, the step S202 is implemented by extracting the identity information of the WeChat client from the access request, determining whether the identity information is consistent with the entered identity information of the WeChat client, and determining that the identity verification is passed when the identity information is consistent with the entered identity information of the WeChat client. The server, after receiving the access request of the client, needs to check the information of the client first, compares whether the information such as the enterprise ID and the application ID is consistent with the entered information, if so, can execute the subsequent steps, and if not, refuses the access request of the client, so as to avoid the invasion of the illegal client and ensure the safety of the local area network. After the verification of the information is completed, in order to enable the subsequent access of the client and the server to be more convenient, a Token and a WeChat message encryption key EncodingAESKey are distributed to the server, so that authentication is not required for each request, the access speed and the access efficiency are greatly improved, and the use experience of a user is further improved.
And step 203, the token and the WeChat message encryption key are sent to the WeChat client.
And step S102, receiving the token and the WeChat message encryption key sent by the server.
Step S103, sending a simulated access request with a token to a server.
Specifically, after receiving the Token sent by the server, the client simulates a user access request once by carrying the Token in order to ensure the validity and availability of the Token, so as to remove access faults and ensure the successful proceeding of subsequent access.
And step S204, receiving a simulated access request with a token sent by the WeChat client.
Step S205, verifying whether the token carried in the simulated access request is consistent with the token distributed for the WeChat client.
And step S206, when the verification is consistent, sending an access success identification to the WeChat client.
Step S104, after receiving the access success identification sent by the server, establishing data access with the server based on the token and the WeChat message encryption key.
Specifically, after the server returns the identifier of successful access, the Token is represented as being normally usable. At this time, the user can be allowed to access the client, the subsequent data interaction between the client and the server only needs to carry token access, and consistency verification is not needed, so that the access flow is further simplified, and the use experience of the user is improved.
By executing the steps, the local area network access method based on WeChat provided by the embodiment of the invention distributes the token and the WeChat message encryption key for the client passing the verification by the identity verification mode between the client and the server, verifies whether the client is successfully accessed to the server by simulating the access request mode, realizes the mutual trust relationship identification of the client and the server, and establishes the data access of the client and the server after the client is successfully accessed, thereby realizing the access of the user terminal to the local area network without deploying VPN, avoiding the problem of a VPN gateway to influence the normal access of the user, ensuring the transmission safety in the data access process by the transmission mode of the token and the WeChat message encryption key, and improving the access experience of the user.
Specifically, in an embodiment, the step S104 performed by the WeChat client 101 includes performing the following steps S41 to S45, and the step S206 performed by the server 102 includes performing the following steps S61 to S65. A specific process of the WeChat client 101 and the server 102 for performing the consistency check is shown in fig. 4.
And S41, acquiring the data access requirement of the user.
Specifically, the data access requirement of the user may be that the user sends a specified command to the back end of the local area network, and the specified command format may be, for example, a form of a keyword+a parameter, where the keyword is used to perform identification of a function, and the parameter is data used in a corresponding function.
And step S42, generating a data access request based on the data access requirement and the token.
Specifically, the data access request may be created in a pre-set format, such as in the format of sender, recipient, token, and command.
And step S43, encrypting the data access request by using the WeChat message encryption key, and sending the encrypted data access request to the server.
Step S61, receiving a data access request sent by the WeChat client.
And step S62, decrypting the data access request by utilizing the WeChat message encryption key to obtain the data access requirement and the token of the WeChat client.
Step S63, judging whether the decrypted token is consistent with the token distributed to the WeChat client;
and S64, extracting access data based on the data access requirement when the access data are consistent.
The method comprises the steps of extracting an operation command in a data access requirement, calling a corresponding functional module to execute corresponding operation based on the operation command to obtain an execution result fed back by the functional module, and obtaining access data based on the execution result.
In practical application, after receiving the encrypted data sent from the enterprise WeChat client, the server decrypts the data by using the configured EncodingAESKey to obtain a plaintext, wherein the plaintext comprises a sender, a receiver, a Token and a command, then matches the Token in the plaintext, executes the next step if the Token is consistent, returns an error report if the Token is inconsistent, and refuses to provide access data for the client.
Further, the server extracts the command in the parsed text, judges the keyword preferentially according to a preset format, confirms the specific operation which the client wants to execute, then transmits the corresponding parameters to the corresponding functional modules, and finally obtains the result returned by the functional modules, namely the access data.
And step S65, the access data is sent to the WeChat client.
The method comprises the steps of encrypting access data and a token by utilizing a WeChat message encryption key to obtain encrypted access data, and sending the encrypted access data to a WeChat client.
In practical applications, in order to smoothly return the returned result to the client, the server uses EncodingAESKey fields, i.e., sender, receiver, token, and returned result, to perform AES encryption. And then returns to the client
And S44, receiving access data fed back by the server.
And step S45, decrypting the access data by utilizing the WeChat message encryption key to obtain decrypted access data.
Specifically, after receiving the data, the client uses EncodingAESKey to perform AES decryption to obtain a return result. Finally, the method is displayed on the client of the enterprise WeChat. In addition, in practical application, in order to avoid sending wrong access data due to server problem, the WeChat client side can also utilize the distributed Token to compare Token in the access data sent by the server, if the Token is consistent, the access data is indicated to be the data corresponding to the data access request sent by the user through the client, the accuracy of the data access result is further ensured, and the use experience of the user is improved.
The local area network access method based on the WeChat provided by the embodiment of the invention aims to ensure the safety in the transmission process by using Token and EncodingAESKey to prevent the problem of data leakage caused by hijacking, ensures that a server can identify after receiving a command by setting the format (key word and parameter) of an interactive command, and further ensures the safety in the data transmission process by encrypting the access result returned by the server in the same way in order to ensure the safety of the client capable of identifying data and data transmission.
In the prior art, to realize communication between public network and private network service, self-research app or client is needed, the research and development cost is extremely high, weChat is used as a third party client, and the communication safety between WeChat and local service is difficult to guarantee. The technical scheme provided by the embodiment of the invention realizes command interaction between the client and the private server by relying on the existing and common tools, encrypts and decrypts the data by using the AES key of EncodingAESKey, and combines token to identify the mutual trust relationship between the client and the server so as to ensure the safety of data transmission. Based on the WeChat client, the command is preconfigured (keywords and parameters) to realize the local area network access function of the background service function module, namely screening, executing and outputting results.
Although embodiments of the present invention have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations are within the scope of the invention as defined by the appended claims.