WO2023202214A1 - 一种通信方法、装置、系统、终端及服务器 - Google Patents

一种通信方法、装置、系统、终端及服务器 Download PDF

Info

Publication number
WO2023202214A1
WO2023202214A1 PCT/CN2023/077819 CN2023077819W WO2023202214A1 WO 2023202214 A1 WO2023202214 A1 WO 2023202214A1 CN 2023077819 W CN2023077819 W CN 2023077819W WO 2023202214 A1 WO2023202214 A1 WO 2023202214A1
Authority
WO
WIPO (PCT)
Prior art keywords
authentication information
session authentication
server
client
session
Prior art date
Application number
PCT/CN2023/077819
Other languages
English (en)
French (fr)
Inventor
蒲伊娜
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2023202214A1 publication Critical patent/WO2023202214A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/321Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
    • H04L9/3213Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority using tickets or tokens, e.g. Kerberos
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3226Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using a predetermined code, e.g. password, passphrase or PIN

Definitions

  • the present application relates to the field of communication technology, and in particular, to a communication method, device, system, terminal and server.
  • the client when the client communicates with the server, it will first authenticate to the server through the user name and password. After the authentication is passed, the server will issue a session authentication information to the client, and the client can subsequently authenticate based on this session. The information is communicated with the server to ensure the legality of the communication.
  • the client may need to call a local service process to communicate with the server.
  • each local service process is authenticated based on the above session.
  • information communicates with the server it needs to carry a token.
  • the token is a parameter used to prevent attacks.
  • the token carried by the local service process needs to be different every time it communicates with the server.
  • each local service process needs to obtain a token from the client every time it communicates with the server.
  • the client allocates different tokens to the local service process each time. The process is cumbersome and the communication efficiency is low.
  • the purpose of the embodiments of this application is to provide a communication method, device, system, terminal and server to improve communication efficiency.
  • the specific technical solutions are as follows:
  • embodiments of the present application provide a communication method applied to a terminal running a client and a local service process.
  • the method includes:
  • the local service process communicates with the server based on the first session authentication information and a token maintained by itself.
  • the step of sending a session authentication information request to the server includes:
  • the local service process sends a session authentication information request carrying a user name and password to the server, so that the server returns the first session authentication information to the local service process after passing the authentication of the user name and password. .
  • the step of sending a session authentication information request to the server includes:
  • the client sends a session authentication information request to the server based on the second session authentication information, so that the server generates the first session authentication information after passing the verification of the second session authentication information, and returns the first session authentication information to the client, wherein the second session authentication information is the session authentication information generated by the server after performing login authentication on the client, and the client is based on the second session authentication information and the The server communicates, and the second session authentication information is different from the first session authentication information;
  • the method further includes:
  • the client receives the first session authentication information returned by the server, and sends the first session authentication information to the local service process.
  • the method also includes:
  • the client sends a first destruction instruction to the server, so that the server destroys the first session authentication information and the second session authentication information; wherein the first destruction instruction is used to instruct the destruction of the Second session authentication information; or,
  • the client sends a second destruction instruction to the server and the local service process, so that the server destroys the first session authentication information; the local service process receives the second destruction instruction and destroys all The first session authentication information, wherein the second destruction instruction is used to instruct the destruction of the first session authentication information.
  • the method also includes:
  • the client receives the third destruction instruction sent by the server, and destroys the second session authentication information and the first session authentication information, wherein the third destruction instruction is used to instruct the destruction of the second session authentication information. information; or,
  • the client receives a fourth destruction instruction sent by the server to destroy the first session authentication information, where the fourth destruction instruction is used to instruct the destruction of the first session authentication information.
  • the step of destroying the second session authentication information and the first session authentication information includes:
  • the pre-recorded second session authentication information determines the first session authentication information corresponding to the second session authentication information indicated by the third destruction instruction, and destroy the second session Authentication information and the determined first session authentication information.
  • the first session authentication information is generated based on the second session authentication information in accordance with preset session authentication information generation rules after the server passes the verification of the second session authentication information;
  • the step of destroying the second session authentication information and the first session authentication information includes:
  • Each of the local service processes communicates with the server based on different first session authentication information.
  • embodiments of the present application provide a communication method, applied to a server, and the method includes:
  • the first session authentication information is sent to the terminal, so that the local service process communicates with the server based on the first session authentication information and the token maintained by itself. .
  • the step of receiving the session authentication information request sent by the terminal includes:
  • the step of sending the first session authentication information after the local service process is authenticated includes:
  • the first session authentication information is sent to the local service process.
  • the step of receiving the session authentication information request sent by the terminal includes:
  • the step of sending first session authentication information to the terminal after the local service process is authenticated includes:
  • the method also includes:
  • the step of destroying the first session authentication information and the second session authentication information includes:
  • the pre-recorded second session authentication information determines the first session authentication information corresponding to the second session authentication information indicated by the first destruction instruction, and destroy the second session Authentication information and the determined first session authentication information.
  • the first session authentication information is generated based on the second session authentication information in accordance with preset session authentication information generation rules after the second session authentication information is verified;
  • the step of destroying the first session authentication information and the second session authentication information includes:
  • the method also includes:
  • the server communicates with each of the local service processes based on different first session authentication information.
  • embodiments of the present application provide a communication device, which is applied to a terminal.
  • the terminal runs a client and a local service process.
  • the device includes:
  • the first sending module is configured to send a session authentication information request to the server after the client passes the login authentication of the server, so that the server returns the first session authentication after passing the authentication of the local service process. information;
  • a first communication module configured for the local service process to communicate with the server based on the first session authentication information and a token maintained by itself.
  • embodiments of the present application provide a communication device, applied to a server, and the device includes:
  • the first receiving module is used to receive a session authentication information request sent by the terminal, wherein the terminal runs a client and a local service process, and the session authentication information request is sent by the terminal through the server on the client. Sent after login authentication;
  • the second sending module is configured to send the first session authentication information to the terminal after passing the authentication of the local service process, so that the local service process can use the first session authentication information and the token maintained by itself. , communicate with the server.
  • inventions of the present application provide a communication system.
  • the system includes a terminal and a server.
  • the terminal runs a client and a local service process, wherein:
  • the terminal is used to perform the method steps described in any one of the above first aspects
  • the server is configured to perform the method steps described in any one of the above second aspects.
  • embodiments of the present application provide a terminal, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
  • Memory used to store computer programs
  • the processor is used to implement any of the method steps described in the first aspect when executing a program stored in the memory.
  • embodiments of the present application provide a server, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
  • Memory used to store computer programs
  • the processor is used to implement any of the method steps described in the second aspect when executing the program stored in the memory.
  • embodiments of the present application provide a computer-readable storage medium.
  • a computer program is stored in the computer-readable storage medium.
  • the computer program is executed by a processor, the above-mentioned first aspect or the above-mentioned second aspect is implemented. any of the method steps described.
  • embodiments of the present application provide a computer program product containing instructions.
  • the computer program product When the computer program product is run on a computer, it causes the computer to execute any of the above-mentioned first aspect or the above-mentioned second aspect. Method steps.
  • the client After the client passes the server's login authentication, it sends a session authentication information request to the server, so that after the server passes the authentication of the local service process, it returns the first session authentication information, and the local service process Communicates with the server based on the first session authentication information and the token maintained by itself.
  • the local service process communicates with the server, the local service process does not need to obtain a token from the client every time, but communicates with the server based on the first session authentication information and the token maintained by itself.
  • the solution for communicating between the local service process and the server simplifies the communication process and improves communication efficiency.
  • any product or method of the present application does not necessarily require achieving all the above-mentioned advantages simultaneously.
  • Figure 1 is a flow chart of the first communication method provided by the embodiment of the present application.
  • Figure 2 is a flow chart of a method for a client to send a request for session authentication information based on the embodiment shown in Figure 1;
  • Figure 3 is a flow chart of the second communication method provided by the embodiment of the present application.
  • Figure 4 is a signaling interaction diagram of the communication method provided by the embodiment of the present application.
  • Figure 5 is a schematic structural diagram of a first communication device provided by an embodiment of the present application.
  • Figure 6 is a schematic structural diagram of a second communication device provided by an embodiment of the present application.
  • Figure 7 is a schematic structural diagram of a communication system provided by an embodiment of the present application.
  • Figure 8 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • Figure 9 is a schematic structural diagram of a server provided by an embodiment of the present application.
  • embodiments of the present application provide a communication method, device, system, terminal, server, computer-readable storage medium, and computer program product.
  • Session authentication information (session authentication information): Authentication information used in the communication process between the terminal and the server to ensure the legitimacy of network requests.
  • Token When the client or local service process sends a network request to the server, a parameter carried in the network request to prevent attacks. Every time the client or local service process sends a network request to the server, it carries The tokens will all change.
  • WebSocket A protocol for full-duplex communication over a single TCP (Transmission Control Protocol) connection, which makes data exchange between the client and server simpler, allowing the server to actively push data to the client .
  • TCP Transmission Control Protocol
  • the client and the server only need to complete a handshake, and a persistent connection can be created between the two and bidirectional data transmission can be performed.
  • the first communication method provided by the embodiment of the present application can be applied to any terminal that needs to communicate with the server, which can be a mobile phone, a computer, a tablet, etc.
  • the terminal runs a client and a local service process.
  • the client can be an application installed on the terminal, a web browser, etc., which is not specifically limited here.
  • a communication method is applied to a terminal.
  • the terminal runs a client and a local service process.
  • the method includes:
  • S102 The local service process communicates with the server based on the first session authentication information and the token maintained by itself.
  • the client after the client passes the login authentication of the server, it sends a session authentication information request to the server, so that the server returns the first session authentication information after passing the authentication of the local service process.
  • the service process communicates with the server based on the first session authentication information and the token maintained by itself.
  • the client When the user wants to open the client to watch network content, he or she can enter the user's account information, that is, user name and password, in the login interface displayed on the client. Then the client can generate a login request based on the communication protocol and send the login request. to the server. Among them, the login request carries the user name and password.
  • the communication protocol can be WebSocket, of course, it can also be File Transfer Protocol (File Transfer Protocol), Hypertext Transfer Protocol (Hypertext Transfer Protocol), etc., which are not specifically limited here.
  • the user when a user wants to view photos stored in cloud disk A through the client, the user can enter the user name and password in the login interface of cloud disk A displayed on the client, and then the client can generate a login request and send The login request carrying the user name and password is sent to the server corresponding to cloud disk A.
  • the server can perform login authentication based on the user name and password carried in the login request.
  • the server can verify whether the user name and password carried in the login request are consistent with the stored user name and password provided during user registration. The name and password match. If they match, it can be determined that the login authentication passed and the user logged in successfully; if they do not match, it can be determined that the authentication did not pass and the user logged in failed.
  • the client may need to call one or more local service processes to communicate with the server.
  • the video content of each playback window can be obtained from the server through a local service process.
  • the client or the local service process can send a session authentication information request to the server.
  • the server After the server receives the session authentication information request, it can send a request to the local service process. Perform authentication.
  • the first session authentication information can be returned.
  • the first session authentication information can be authentication information such as a string, which is not specifically limited here.
  • the local service process since the local service process has passed the authentication of the server, it can communicate with the server independently. Specifically, the local service process can communicate with the server based on the first session authentication information and the token maintained by itself.
  • the token maintained by the local service process itself is the token generated by the local service process itself based on certain rules, rather than the token obtained from the client.
  • the local service process can select a number in order from 1-200 as the token based on this communication.
  • the token based on the last communication with the server is 1, then the token based on this communication can be 2. .
  • each local service process can communicate with the server based on different first session authentication information. Since each local service process communicates with the server based on different first session authentication information, each local service process can maintain its own token without the need to obtain a different token from the client each time. Different local service processes can communicate with the server based on the same token, or they can communicate with the server based on different tokens, without affecting the smooth progress of communication.
  • the above-mentioned step of sending a session authentication information request to the server may include:
  • the local service process sends a session authentication information request carrying a user name and password to the server, so that the server returns the first session authentication information to the local service process after passing the authentication of the user name and password. .
  • the local service process can send a session authentication information request carrying the user name and password to the server.
  • the server receives the session authentication information request, it can authenticate the user name and password it carries.
  • the user name and password authentication is passed, it means that the local service process has communication permissions, and the server can return the first session authentication information to the local service process.
  • the local service process can communicate with the server based on the first session authentication information and the token maintained by itself.
  • the local service process can send a session authentication information request carrying the user name and password to the server. Then, the server can authenticate the user name and password, and after passing the authentication, return the first session authentication information to the local service. process. In this way, the local service process can obtain the first session authentication information from the server through user name and password authentication. Subsequently, there is no need to request a token from the client. Instead, it can communicate with the server based on the first session authentication information and the token maintained by itself. communication.
  • the above-mentioned step of sending a session authentication information request to the server may include:
  • the client sends a session authentication information request to the server based on the second session authentication information, so that the server generates the first session authentication information after passing the verification of the second session authentication information, and returns the first session Authentication information to the client.
  • the server After passing the authentication of the client, the server can return the second session authentication information to the client.
  • the second session authentication information is the authentication information generated by the server after the user name and password are authenticated. That is, the second session authentication information can identify The validity of the login status of the currently logged in user.
  • the client can receive the second session authentication information and send a session authentication information request to the server based on the second session authentication information.
  • the server After the server passes the verification of the second session authentication information, it can generate the first session authentication information and return the first session authentication information.
  • session authentication information is the session authentication information generated after the server performs login authentication on the client.
  • the client communicates with the server based on the second session authentication information, and the local service process communicates with the server based on the first session authentication information.
  • the second session authentication information is different from the first session authentication information.
  • Each first session authentication information is used to identify the legitimacy of its corresponding local service process.
  • the above method may further include:
  • the client receives the first session authentication information returned by the server, and sends the first session authentication information to the local service process.
  • the client After receiving the first session authentication information returned by the server, the client can send the first session authentication information to the local service process. After the local service process receives the first session authentication information, it can use the first session authentication information and the self-maintained The token communicates with the server. In this way, when the client calls the local service process to communicate with the server, it does not need to authenticate the user name and password separately for each local service process, which can improve communication efficiency.
  • the client when multiple local service processes need to communicate with the server, the client can apply to the server for first session authentication information for each local service process. Furthermore, the client can apply different first session authentication information to the server. The authentication information is sent to different local service processes, and each local service process can communicate with the server based on the received first session authentication information.
  • the client and the server only pass one authentication based on the user name and password, so that different local service processes can communicate with the server independently, which can further improve communication efficiency.
  • each session authentication information has an expiration time. For example, if the second session authentication information has not been used for more than ten years, Minutes, the second session authentication information will become invalid, and then the corresponding first session authentication information will also become invalid.
  • the first session authentication information and the second session authentication information provided in the embodiment of this application may be an inheritance relationship, that is, the second session authentication information may be called main session authentication information, and the first session authentication information may be called sub-session authentication. information.
  • the terminal and server can pre-set the following rules: Whether it is the main session authentication information or the sub-session authentication information, each session authentication information will have an expiration time. When the session authentication information is not used within the preset time period, the session The authentication information will become invalid; if the main session authentication information has always survived, then the sub-session authentication information corresponding to the main session authentication information will not become invalid; if one or more sub-session authentication information has been used or survived, then the main session authentication information has been used. The session authentication information will not be invalidated.
  • the number of sub-session authentication information inherited from the main session authentication information may have an upper limit, for example, it may be 3, 5, 8, etc., and is not specifically limited here.
  • the step of the client sending a session authentication information request to the server based on the second session authentication information may include:
  • the client generates a session authentication information request based on the second session authentication information and the token maintained by itself;
  • the token maintained by the client itself is the authentication parameter maintained by the client based on the communication protocol with the server.
  • the client can determine the authentication parameters used to communicate with the server based on the pre-negotiated token range with the server, that is, the token maintained by itself.
  • the client can generate a session authentication information request based on the second session authentication information and the token.
  • the token maintained by the client itself is the authentication parameter carried in the data request to prevent attacks. Every time the client communicates with the server, the token carried in the communication request will change.
  • data requests and communication requests are the network requests mentioned in the foregoing content.
  • the above-mentioned self-maintained token can be 1.
  • the token used can be 2, and so on.
  • the token used can be increased by 1.
  • the client sends the session authentication information request to the server, so that the server verifies whether the second session authentication information and the token carried in the session authentication information request are legal. After the verification is passed, Create first session authentication information, and send the first session authentication information to the client.
  • the client After the client generates a session authentication information request, it can send the session authentication information request to the server. After receiving the session authentication information request, the server can verify whether the second session authentication information and token carried in the session authentication information request are legal.
  • the server after the server receives the session authentication information request, it can verify whether the second session authentication information carried in the session authentication information request is consistent with the second session authentication information generated by the server itself after the client login authentication passes. If they are consistent, Then it is determined that the second session authentication information carried in the session authentication information request is legal. At the same time, the server can also verify whether the token carried in the session authentication information request belongs to the token range pre-negotiated with the client, and whether it is repeated with the token carried in the network request previously sent by the client. If it belongs to the token range and is not repeated, It can be determined that the second session authentication information and token carried in the session authentication information request are legal.
  • the server can create the first session authentication information, and then send the first session authentication information to the client.
  • the first session authentication information and its corresponding second session authentication information have the same authentication capabilities, that is, they can both identify the legitimacy of the user's login status.
  • the client can generate a session authentication information request based on the second session authentication information and the token maintained by itself, send the session authentication information request to the server, and then the server can verify the second session carried in the session authentication information request. Whether the authentication information and token are legal or not, after passing the verification, the first session authentication information can be created and sent to the client. In this way, the client can request the first session authentication information with the same authentication capability as the second session authentication information while ensuring communication security, so as to ensure that the local service process can legally communicate with the server based on the first session authentication information.
  • the above method may also include:
  • the client sends a first destruction instruction to the server, so that the server destroys the first session authentication information and the second session authentication information; or, the client sends a second destruction instruction to the server.
  • server and the local service process so that the server destroys the first session authentication information; the local service process receives the second destruction instruction and destroys the first session authentication information.
  • the client can send a destruction instruction to the server and/or local service process to destroy the corresponding session authentication information.
  • the client when the communication between the client and the server needs to be stopped, the client can send the first destruction instruction to the server, Among them, the first destruction instruction is used to instruct the destruction of the second session authentication information. Since the communication between the client and the server stops, the communication between all local service processes corresponding to the client and the server also stops. Then, if the second session authentication information fails, the second session authentication information corresponding to There is no need for all the first session authentication information to continue to exist. Therefore, after receiving the first destruction instruction, the server can destroy the second session authentication information and the first session authentication information corresponding to the second session authentication information. Subsequently, even if the local service process sends a data request to the server based on the first session authentication information, since the server has destroyed the first session authentication information, the two cannot continue to communicate.
  • the client can also send a destruction instruction to each local service process. Then, after receiving the destruction instruction, each local service process destroys its corresponding first session authentication information. In this way, the client All session authentication information corresponding to the client will be destroyed.
  • the client when it is necessary to stop the communication between one or more local service processes and the server, the client can send a second destruction instruction to the server and the local service process, where the second destruction instruction is used to instruct the destruction of a certain First session authentication information.
  • the number of first session authentication information generally has an upper limit, so after the communication between one or some local service processes and the server is completed, the first session authentication information corresponding to the local service process can be destroyed. , so that when a new local service process needs to communicate with the server, new first session authentication information can be created smoothly.
  • the client can send a second destruction command to the server and the local service process corresponding to playback window A.
  • the server and the local service process can destroy the first session authentication information indicated by the second destruction instruction.
  • the server After the second session authentication information is destroyed, if the client sends a network request carrying the second session authentication information to the server, or the local service process sends a network request carrying the first session authentication information corresponding to the second session authentication information to When using the server, the server will fail the authentication. After the first session authentication information is destroyed, if the local service process sends a network request carrying the first session authentication information to the server, the server will fail the authentication. However, at this time, the second session authentication information and other first session authentication information are still valid and can continue to be used.
  • the client can send a first destruction instruction to the server to cause the server to destroy the second session authentication information and the first session authentication information; or, the client can send a second destruction instruction to the server and the local service process. , so that the server and local service processes destroy the first session authentication information.
  • the client can send different destruction instructions, so that the server and/or the local service process can destroy the corresponding session authentication information in time, which can not only ensure communication security, but also improve communication efficiency.
  • the above method may also include:
  • the client receives the third destruction instruction sent by the server and destroys the second session authentication information and the first session authentication information; or the client receives the fourth destruction instruction sent by the server and destroys the second session authentication information and the first session authentication information.
  • the first session authentication information receives the third destruction instruction sent by the server and destroys the second session authentication information and the first session authentication information.
  • the server can also actively send a destruction instruction to the client.
  • the server can send a third destruction instruction to the client, where the third destruction instruction is used to instruct destruction.
  • Second session authentication information since the communication between the client and the server stops, the communication between all local service processes corresponding to the client and the server also stops. Then, if the second session authentication information fails, then all first sessions There is no need for the authentication information to continue to exist, so the client can destroy the second session authentication information and the first session authentication information.
  • the server can send a fourth destruction instruction to the client, where the fourth destruction instruction is used to instruct the destruction of the first session authentication information.
  • the client receives the fourth destruction instruction After issuing the command, the first session authentication information can be destroyed.
  • the client when destroying the first session authentication information, can also send a destruction instruction to the corresponding local service process. After receiving the destruction instruction, the local service process can destroy its corresponding first session authentication information, that is, it does not Then communicate with the server.
  • the client can receive the third destruction instruction sent by the server to destroy the second session authentication information and the first session authentication information; or the client can receive the fourth destruction instruction sent by the server and destroy the First session authentication information.
  • the server can send different destruction instructions so that the client can destroy the corresponding session authentication information in time, which can not only ensure communication security, but also improve communication efficiency.
  • the above-mentioned step of destroying the second session authentication information and the first session authentication information may include:
  • the pre-recorded second session authentication information determines the first session authentication information corresponding to the second session authentication information indicated by the third destruction instruction, and destroy the second session Authentication information and the determined first session authentication information.
  • the client can record the second session authentication information and the first session authentication information after receiving the second session authentication information and the first session authentication information sent by the server. correspondence between them.
  • the client communicates with the server through session A, and there are also three local service processes communicating with the server based on session A1, session A2, and session A3. Then the client can record the second session authentication information and the first session authentication information.
  • the corresponding relationship between them is as follows:
  • the client when it receives the third destruction instruction sent by the server, it can determine the second session authentication indicated by the third destruction instruction based on the correspondence between the pre-recorded second session authentication information and the first session authentication information.
  • the first session authentication information corresponding to the information, the second session authentication information and the determined first session authentication information are destroyed.
  • the client can determine that the first session authentication information that needs to be destroyed includes session A1, session A2, and session A3 based on the corresponding relationship recorded in the above table. Furthermore, session A, session A1, session A2 and session A3 can be destroyed.
  • the client after receiving the second session authentication information and the first session authentication information sent by the server, the client can record the correspondence between the second session authentication information and the first session authentication information, so that subsequent When destroying the second session authentication information and the first session authentication information, the first session authentication information corresponding to the second session authentication information indicated by the destruction instruction can be quickly determined based on the corresponding relationship, thereby realizing rapid destruction of the session authentication information.
  • the above-mentioned first session authentication information may be generated by the server based on the second session authentication information and in accordance with preset session authentication information generation rules after the server passes the verification of the second session authentication information.
  • the preset session authentication information generation rules can be preset on the server and the client, so that when the server generates the first session authentication information, it can generate it according to the preset session authentication information generation rules.
  • default session authentication The information generation rule may be to add numbers based on the second session authentication information in order of generation.
  • the second session authentication information is: 922D39266FF24883A4EDBFE4A706F31F.
  • the server when it generates the first session authentication information based on the second session authentication information according to the preset session authentication information generation rules for the first time, it can generate the first session authentication information: 922D39266FF24883A4EDBFE4A706F31F_1; the second time
  • the first session authentication information when the first session authentication information is generated based on the second session authentication information according to the preset session authentication information generation rules, the first session authentication information can be generated: 922D39266FF24883A4EDBFE4A706F31F_2, and so on, multiple first session authentication information can be generated.
  • the above-mentioned step of destroying the second session authentication information and the first session authentication information may include:
  • the client when the client receives the third destruction instruction, it can search for the second session indicated by the third destruction instruction.
  • the authentication information conforms to the first session authentication information of the preset session authentication information generation rules, and then, the second session authentication information and the found first session authentication information are destroyed.
  • the first session authentication information and the second session authentication information to be destroyed can be determined accurately and quickly.
  • embodiments of the present application also provide a second communication method.
  • the second communication method provided by the embodiment of the present application is introduced below.
  • the second communication method provided by the embodiment of this application can be applied to the server.
  • a communication method is applied to the server.
  • the method may include:
  • the terminal runs a client and a local service process, and the session authentication information request is sent by the terminal after the client passes the login authentication of the server.
  • S302 After the local service process is authenticated, send the first session authentication information to the terminal, so that the local service process communicates with the server based on the first session authentication information and the token maintained by itself. communicate.
  • the server can receive the session authentication information request sent by the terminal, and after passing the authentication of the local service process, send the first session authentication information to the terminal, so that the local service process can authenticate based on the first session
  • the authentication information and the token maintained by itself communicate with the server.
  • the terminal runs a client and a local service process.
  • the session authentication information request is sent by the terminal after the client passes the login authentication of the server.
  • the above-mentioned step of receiving the session authentication information request sent by the terminal may include:
  • the above-mentioned step of sending the first session authentication information after the local service process is authenticated may include:
  • the first session authentication information is sent to the local service process.
  • the above-mentioned step of receiving the session authentication information request sent by the terminal may include:
  • Second session authentication information is session authentication information generated after the server performs login authentication on the client, and the client Based on the second session authentication information communicate with said server;
  • the above-mentioned step of sending the first session authentication information to the terminal after the local service process is authenticated may include:
  • the above method may also include:
  • the above-mentioned step of destroying the first session authentication information and the second session authentication information may include:
  • the pre-recorded second session authentication information determines the first session authentication information corresponding to the second session authentication information indicated by the first destruction instruction, and destroy the second session Authentication information and the determined first session authentication information.
  • the above-mentioned first session authentication information may be generated based on the preset session authentication information generation rules based on the second session authentication information after the second session authentication information is verified;
  • the above-mentioned step of destroying the first session authentication information and the second session authentication information may include:
  • the above method may also include:
  • the above-mentioned server and each of the local service processes may communicate based on different first session authentication information.
  • the client sends a login request to the server
  • the server receives the login request and performs login authentication based on the user name and password carried in the login request. If the authentication is successful, the second session authentication information is generated;
  • the server sends the second session authentication information to the client;
  • the client receives the second session authentication information and generates it based on the second session authentication information and the token maintained by itself. session authentication information request;
  • the client sends a session authentication information request to the server;
  • the server receives the session authentication information request and verifies whether the second session authentication information and token carried in the session authentication information request are legal; if legal, the server creates the first session authentication information corresponding to the second session authentication information;
  • the first session authentication information and the second session authentication information may comply with the preset session authentication information generation rules.
  • the server sends the first session authentication information to the client
  • the client receives the first session authentication information
  • the client sends the first session authentication information to the local service process
  • the local service process receives the first session authentication information
  • the client sends a picture request instruction to the local service process
  • the local service process receives the picture request instruction and generates a picture acquisition request based on the first session authentication information and the token maintained by itself;
  • step S414 The server receives the image acquisition request and verifies whether the first session authentication information and token in the image acquisition request are legal. If they are legal, step S415 is executed;
  • the server returns the data result corresponding to the image acquisition request to the local service process
  • the local service process displays pictures based on the data results
  • the communication process may also include the following steps:
  • the client sends the second destruction command to the local service process and the server;
  • the second destruction instruction is used to instruct the destruction of the first session authentication information
  • the server destroys the first session authentication information.
  • the client, the server and the local service process can communicate with the server when the client calls the local service process, especially when performing multi-process communication, without the need to obtain the information from the client every time.
  • Token compared with the current communication connection method, the communication process is simple and improves communication efficiency.
  • embodiments of the present application also provide a communication device.
  • a communication device is applied to a terminal.
  • the terminal runs a client and a local service process.
  • the device may include:
  • the first sending module 510 is configured to send a session authentication information request to the server after the client passes the login authentication of the server, so that the server returns to the first session after passing the authentication of the local service process.
  • Certification Information
  • the first communication module 520 is used for the local service process to communicate with the server based on the first session authentication information and the token maintained by itself.
  • the client after the client passes the login authentication of the server, it sends a session authentication information request to the server, so that the server returns the first session authentication information after passing the authentication of the local service process.
  • the service process communicates with the server based on the first session authentication information and the token maintained by itself.
  • the local service process communicates with the server When sending a message, the local service process does not need to obtain the token from the client every time. Instead, it communicates with the server based on the first session authentication information and the token maintained by itself.
  • the communication The process is simple and communication efficiency is improved.
  • the above-mentioned first sending module 510 may include:
  • a first sending unit configured for the local service process to send a session authentication information request carrying a user name and password to the server, so that the server returns the first session authentication after passing the authentication of the user name and password. information to the local service process.
  • the above-mentioned first sending module 510 may include:
  • a second sending unit configured for the client to send a session authentication information request to the server based on the second session authentication information, so that the server generates the first session authentication information after passing the verification of the second session authentication information, and returns the first session authentication information to the client, wherein the second session authentication information is the session authentication information generated after the server performs login authentication on the client, and the client is based on the Second session authentication information is communicated with the server, and the second session authentication information is different from the first session authentication information;
  • the above devices may also include:
  • the second sending module is configured to, after sending the session authentication information request to the server, the client receive the first session authentication information returned by the server, and send the first session authentication information to the server. Describe the local service process.
  • the above device may also include:
  • a first destruction instruction sending module configured for the client to send a first destruction instruction to the server, so that the server destroys the first session authentication information and the second session authentication information;
  • the client sends a second destruction instruction to the server and the local service process, so that the server destroys the first session authentication information; the local service process receives the second destruction instruction, and Destroy the first session authentication information.
  • the first destruction instruction is used to instruct the destruction of the second session authentication information
  • the second destruction instruction is used to instruct the destruction of the first session authentication information
  • the above device may also include:
  • a first destruction module configured for the client to receive the third destruction instruction sent by the server and destroy the second session authentication information and the first session authentication information; or,
  • the client receives the fourth destruction instruction sent by the server and destroys the first session authentication information.
  • the third destruction instruction is used to instruct the destruction of the second session authentication information.
  • the fourth destruction instruction is used to instruct the destruction of the first session authentication information.
  • the above-mentioned first destruction module may include:
  • a first destruction unit configured to determine, based on the correspondence between the pre-recorded second session authentication information and the first session authentication information, the first session authentication information corresponding to the second session authentication information indicated by the third destruction instruction. , destroy the second session authentication information and the determined first session authentication information.
  • the above-mentioned first session authentication information may be generated based on the preset session authentication information rules based on the second session authentication information after the server passes the verification. Generated;
  • the above-mentioned first destruction module may include:
  • the second destruction unit is used to search for the first session authentication information that conforms to the preset session authentication information generation rules with the second session authentication information indicated by the third destruction instruction, and destroy the second session authentication information and the second session authentication information. The first session authentication information found.
  • Each of the local service processes communicates with the server based on different first session authentication information.
  • embodiments of the present application also provide another communication device.
  • a communication device is applied to a server.
  • the device includes:
  • the first receiving module 610 is used to receive the session authentication information request sent by the terminal;
  • the terminal runs a client and a local service process, and the session authentication information request is sent by the terminal after the client passes the login authentication of the server.
  • the second sending module 620 is configured to send the first session authentication information to the terminal after passing the authentication of the local service process, so that the local service process can use the first session authentication information and the command maintained by itself. cards to communicate with the server.
  • the server can receive the session authentication information request sent by the terminal, and after passing the authentication of the local service process, send the first session authentication information to the terminal, so that the local service process can authenticate based on the first session
  • the authentication information and the token maintained by itself communicate with the server.
  • the terminal runs a client and a local service process.
  • the session authentication information request is sent by the terminal after the client passes the login authentication of the server.
  • the above-mentioned first receiving module 610 may include:
  • a first receiving unit configured to receive a session authentication information request carrying a user name and password sent by the local service process
  • the above-mentioned second sending module 620 may include:
  • the first session authentication information is sent to the local service process.
  • the above-mentioned first receiving module 610 may include:
  • a second receiving unit configured to receive a session authentication information request sent by the client based on the second session authentication information
  • the second session authentication information is session authentication information generated by the server after performing login authentication on the client, and the client communicates with the server based on the second session authentication information.
  • the above-mentioned second sending module 620 may include:
  • a session authentication information generation unit configured to verify the second session authentication information and generate the first session authentication information after the verification is passed;
  • the first session authentication information is different from the second session authentication information.
  • a session authentication information sending unit configured to send the first session authentication information to the client, so that the client receives the first session authentication information, and sends the first session authentication information to the local service process.
  • the above device may also include:
  • a second destruction module configured to receive the first destruction instruction sent by the client; destroy the first session authentication information and the second session authentication information; or,
  • the first destruction instruction is used to instruct the destruction of the second session authentication information
  • the second destruction instruction is used to instruct the destruction of the first session authentication information
  • the above-mentioned second destruction module may include:
  • the third destruction unit is configured to determine the first session authentication information corresponding to the second session authentication information indicated by the first destruction instruction based on the correspondence between the pre-recorded second session authentication information and the first session authentication information. , destroy the second session authentication information and the determined first session authentication information.
  • the above-mentioned first session authentication information may be generated based on the preset session authentication information generation rules based on the second session authentication information after the second session authentication information is verified;
  • the above-mentioned second destruction module may include:
  • the fourth destruction unit is used to search for the first session authentication information that conforms to the preset session authentication information generation rules with the second session authentication information indicated by the first destruction instruction, and destroy the second session authentication information and the second session authentication information. Determine the first session authentication information.
  • the above device may also include:
  • a second destruction instruction sending module is configured to send a third destruction instruction to the client, so that the client destroys the second session authentication information and the first session authentication information; or,
  • the third destruction instruction is used to instruct the destruction of the second session authentication information
  • the fourth destruction instruction is used to instruct the destruction of the first session authentication information
  • the server communicates with each of the local service processes based on different first session authentication information.
  • a communication system includes a terminal 701 and a server 702.
  • the terminal 701 runs a client 703 and a local service process. 704, of which:
  • the terminal 701 is used to perform the steps of the above-mentioned first communication method
  • the server 702 is used to perform the steps of the above-mentioned second communication method.
  • the terminal runs a client and a local service process.
  • the terminal can send a session authentication information request to the server, and the server can receive the session authentication information sent by the terminal.
  • Request after passing the authentication of the local service process, send the first session authentication information to the terminal, and the local service process communicates with the server based on the first session authentication information and the token maintained by itself.
  • the local service process communicates with the server, the local service process does not need to obtain a token from the client every time, but communicates with the server based on the first session authentication information and the token maintained by itself.
  • the solution for communicating between the local service process and the server simplifies the communication process and improves communication efficiency.
  • the embodiment of the present application also provides a terminal, as shown in Figure 8, including a processor 801, a communication interface 802, a memory 803, and a communication bus 804.
  • the processor 801, the communication interface 802, and the memory 803 are completed through the communication bus 804. communication between each other,
  • Memory 803 used to store computer programs
  • the processor 801 is used to implement the steps of the above-mentioned first communication method when executing the program stored on the memory 803.
  • the communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the communication bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the communication interface is used for communication between the above terminal and other devices.
  • the memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory.
  • RAM Random Access Memory
  • NVM Non-Volatile Memory
  • the memory may also be at least one storage device located far away from the aforementioned processor.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), special integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP Network Processor
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the embodiment of the present application also provides a server, as shown in Figure 9, including a processor 901, a communication interface 902, a memory 903, and a communication bus 904.
  • the processor 901, the communication interface 902, and the memory 903 are completed through the communication bus 904. communication between each other,
  • Memory 903 used to store computer programs
  • the processor 901 is used to implement the steps of the above-mentioned second communication method when executing the program stored in the memory 903.
  • the communication bus mentioned in the above-mentioned server can be the Peripheral Component Interconnect (PCI) bus or the Extended Industry Standard Architecture (EISA) bus, etc.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the communication bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the communication interface is used for communication between the above-mentioned server and other devices.
  • the memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory.
  • RAM Random Access Memory
  • NVM Non-Volatile Memory
  • the memory may also be at least one storage device located far away from the aforementioned processor.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), special integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP Network Processor
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • a computer-readable storage medium is also provided.
  • a computer program is stored in the computer-readable storage medium.
  • the computer program is executed by a processor, any of the above embodiments can be implemented. the steps of the communication method described above.
  • a computer program product containing instructions is also provided, which when run on a computer causes the computer to perform the communication method described in any of the above embodiments.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, e.g., the computer instructions may be transferred from a website, computer, server, or data center To another website, computer, service through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) server or data center for transmission.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more available media integrated.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请实施例提供了一种通信方法、装置、系统、终端及服务器,所述方法应用于终端,终端运行有客户端及本地服务进程,方法包括:在客户端通过服务器的登录认证后,向服务器发送会话认证信息请求,以使服务器在对本地服务进程认证通过后,返回第一会话认证信息,本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信。本地服务进程每次与服务器进行通信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,可以提高通信效率。

Description

一种通信方法、装置、系统、终端及服务器
本申请要求于2022年04月18日提交中国专利局、申请号为202210403914.7发明名称为“一种通信方法、装置、系统、终端及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,特别是涉及一种通信方法、装置、系统、终端及服务器。
背景技术
目前,客户端在与服务器进行通信的过程中,首先会通过用户名以及密码向服务器进行认证,认证通过后,服务器会给客户端下发一个会话认证信息,客户端后续则可以基于该会话认证信息与服务器进行通信,以保证通信的合法性。
有些情况下,客户端可能需要调用本地服务进程与服务器进行通信,在客户端与服务器进行多进程通信时,针对每个本地服务进程,为了保证通信安全性,每个本地服务进程基于上述会话认证信息与服务器进行通信时,均需要携带一个令牌,令牌是用于防止攻击的一个参数,本地服务进程每次与服务器通信,所携带的令牌需是不同的。
这样,在进行多进程通信时,每个本地服务进程每次与服务器通信都需要向客户端获取令牌,客户端每次分配不同的令牌给本地服务进程,过程繁琐,通信效率较低。
发明内容
本申请实施例的目的在于提供一种通信方法、装置、系统、终端及服务器,以提高通信效率。具体技术方案如下:
第一方面,本申请实施例提供了一种通信方法,应用于终端,所述终端运行有客户端及本地服务进程,所述方法包括:
在所述客户端通过服务器的登录认证后,向所述服务器发送会话认证信息请求,以使所述服务器在对所述本地服务进程认证通过后,返回第一会话认证信息;
所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
可选的,所述向所述服务器发送会话认证信息请求的步骤,包括:
所述本地服务进程向所述服务器发送携带用户名和密码的会话认证信息请求,以使所述服务器在对所述用户名和所述密码认证通过后,返回第一会话认证信息至所述本地服务进程。
可选的,所述向所述服务器发送会话认证信息请求的步骤,包括:
所述客户端基于第二会话认证信息发送会话认证信息请求至所述服务器,以使所述服务器对所述第二会话认证信息验证通过后生成第一会话认证信息,并返回所述第一会话认证信息至所述客户端,其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息与所述服务器进行通信,所述第二会话认证信息与所述第一会话认证信息不同;
在所述向所述服务器发送会话认证信息请求的步骤之后,所述方法还包括:
所述客户端接收所述服务器返回的所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
可选的,所述方法还包括:
所述客户端发送第一销毁指令至所述服务器,以使所述服务器销毁所述第一会话认证信息以及所述第二会话认证信息;其中,所述第一销毁指令用于指示销毁所述第二会话认证信息;或,
所述客户端发送第二销毁指令至所述服务器以及所述本地服务进程,以使所述服务器销毁所述第一会话认证信息;所述本地服务进程接收所述第二销毁指令,并销毁所述第一会话认证信息,其中,所述第二销毁指令用于指示销毁所述第一会话认证信息。
可选的,所述方法还包括:
所述客户端接收所述服务器发送的第三销毁指令,销毁所述第二会话认证信息以及所述第一会话认证信息,其中,所述第三销毁指令用于指示销毁所述第二会话认证信息;或,
所述客户端接收所述服务器发送的第四销毁指令,销毁所述第一会话认证信息,其中,所述第四销毁指令用于指示销毁所述第一会话认证信息。
可选的,所述销毁所述第二会话认证信息以及所述第一会话认证信息的步骤,包括:
根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第三销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
可选的,所述第一会话认证信息为所述服务器对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
所述销毁所述第二会话认证信息以及所述第一会话认证信息的步骤,包括:
查找与所述第三销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所查找到的第一会话认证信息。
可选的,所述本地服务进程为多个;
每个所述本地服务进程基于不同的第一会话认证信息与所述服务器进行通信。
第二方面,本申请实施例提供了一种通信方法,应用于服务器,所述方法包括:
接收终端发送的会话认证信息请求,其中,所述终端运行有客户端及本地服务进程,所述会话认证信息请求为所述终端在所述客户端通过所述服务器的登录认证后发送的;
在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端,以使所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
可选的,所述接收终端发送的会话认证信息请求的步骤,包括:
接收所述本地服务进程发送的携带用户名和密码的会话认证信息请求;
所述在对所述本地服务进程认证通过后,发送第一会话认证信息的步骤,包括:
在对所述用户名和所述密码认证通过后,发送第一会话认证信息至所述本地服务进程。
可选的,所述接收终端发送的会话认证信息请求的步骤,包括:
接收所述客户端基于第二会话认证信息发送的会话认证信息请求,其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息与所述服务器进行通信;
所述在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端的步骤,包括:
对所述第二会话认证信息进行验证,并在验证通过后生成第一会话认证信息,其中,所述第一会话认证信息与所述第二会话认证信息不同;
发送所述第一会话认证信息至所述客户端,以使所述客户端接收所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
可选的,所述方法还包括:
接收所述客户端发送的第一销毁指令;销毁所述第一会话认证信息以及所述第二会话认证信息,其中,所述第一销毁指令用于指示销毁所述第二会话认证信息;或,
接收所述客户端发送的第二销毁指令;销毁所述第一会话认证信息,其中,所述第二销毁指令用于指示销毁所述第一会话认证信息。
可选的,所述销毁所述第一会话认证信息以及所述第二会话认证信息的步骤,包括:
根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第一销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
可选的,所述第一会话认证信息为对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
所述销毁所述第一会话认证信息以及所述第二会话认证信息的步骤,包括:
查找与所述第一销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
可选的,所述方法还包括:
发送第三销毁指令至所述客户端,以使所述客户端销毁所述第二会话认证信息以及所述第一会话认证信息,其中,所述第三销毁指令用于指示销毁所述第二会话认证信息;或,
发送第四销毁指令至所述客户端,以使所述客户端销毁所述第一会话认证信息,其中,所述第四销毁指令用于指示销毁所述第一会话认证信息。
可选的,所述本地服务进程为多个;
所述服务器与每个所述本地服务进程基于不同的第一会话认证信息进行通信。
第三方面,本申请实施例提供了一种通信装置,应用于终端,所述终端运行有客户端及本地服务进程,所述装置包括:
第一发送模块,用于在所述客户端通过服务器的登录认证后,向所述服务器发送会话认证信息请求,以使所述服务器在对所述本地服务进程认证通过后,返回第一会话认证信息;
第一通信模块,用于所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
第四方面,本申请实施例提供了一种通信装置,应用于服务器,所述装置包括:
第一接收模块,用于接收终端发送的会话认证信息请求,其中,所述终端运行有客户端及本地服务进程,所述会话认证信息请求为所述终端在所述客户端通过所述服务器的登录认证后发送的;
第二发送模块,用于在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端,以使所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
第五方面,本申请实施例提供了一种通信系统,所述系统包括终端以及服务器,所述终端运行有客户端及本地服务进程,其中:
所述终端,用于执行上述第一方面任一项所述的方法步骤;
所述服务器,用于执行上述第二方面任一项所述的方法步骤。
第六方面,本申请实施例提供了一种终端,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
存储器,用于存放计算机程序;
处理器,用于执行存储器上所存放的程序时,实现上述第一方面任一所述的方法步骤。
第七方面,本申请实施例提供了一种服务器,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
存储器,用于存放计算机程序;
处理器,用于执行存储器上所存放的程序时,实现上述第二方面任一所述的方法步骤。
第八方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述第一方面或上述第二方面任一所述的方法步骤。
第九方面,本申请实施例提供了一种包含指令的计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行上述第一方面或上述第二方面任一所述的方法步骤。
本申请实施例有益效果:
本申请实施例所提供的方案中,在客户端通过服务器的登录认证后,向服务器发送会话认证信息请求,以使服务器在对本地服务进程认证通过后,返回第一会话认证信息,本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信。通过上述方案,本地服务进程与服务器进行通信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,相较于目前本地服务进程与服务器通信的方案,通信过程简便,提高了通信效率。当然,实施本申请的任一产品或方法并不一定需要同时达到以上所述的所有优点。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。
图1为本申请实施例所提供的第一种通信方法的流程图;
图2为基于图1所示实施例的客户端发送会话认证信息请求方式的一种流程图;
图3为本申请实施例所提供的第二种通信方法的流程图;
图4为本申请实施例所提供的通信方法的一种信令交互图;
图5为本申请实施例所提供的第一种通信装置的结构示意图;
图6为本申请实施例所提供的第二种通信装置的结构示意图;
图7为本申请实施例所提供的一种通信系统的结构示意图;
图8为本申请实施例所提供的一种终端的结构示意图;
图9为本申请实施例所提供的一种服务器的结构示意图。
具体实施方式
为使本申请的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本申请进一步详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为了能够提高通信效率,本申请实施例提供了一种通信方法、装置、系统、终端、服务器、计算机可读存储介质以及计算机程序产品。
为了方便理解本申请实施例所提供的方案,下面首先对本申请中所涉及的术语进行介绍:
session认证信息(会话认证信息):终端与服务器通信过程中所使用的认证信息,保证网络请求的合法性。
token(令牌):在客户端或本地服务进程向服务器发送网络请求时,网络请求中所携带的防止攻击的一个参数,每次客户端或本地服务进程向服务器发送网络请求时,其所携带的token都会变化。
WebSocket:一种在单个TCP(Transmission Control Protocol,传输控制协议)连接上进行全双工通信的协议,其使得客户端和服务器之间的数据交换变得更加简单,允许服务器主动向客户端推送数据。在WebSocket API(Application Programming Interface,应用程序接口)中,客户端和服务器只需要完成一次握手,两者之间就可以创建持久性的连接,并进行双向数据传输。
本申请实施例所提供的第一种通信方法可以应用于任一需要与服务器通信的终端,可以为手机、电脑、平板电脑等。终端运行有客户端及本地服务进程,客户端可以为安装于终端的应用程序、web浏览器等,在此不做具体限定。
如图1所示,一种通信方法,应用于终端,所述终端运行有客户端及本地服务进程,所述方法包括:
S101,在所述客户端通过服务器的登录认证后,向所述服务器发送会话认证信息请求,以使所述服务器在对所述本地服务进程认证通过后,返回第一会话认证信息;
S102,所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
可见,本申请实施例所提供的方案中,在客户端通过服务器的登录认证后,向服务器发送会话认证信息请求,以使服务器在对本地服务进程认证通过后,返回第一会话认证信息,本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信。通过上述方案,本地服务进程与服务器进行通信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,相较于目前本地服务进程与服务器通信的方案,通信过程简便,提高了通信效率。
在用户想要打开客户端观看网络内容时,可以在客户端所显示的登录界面中输入用户的账号信息,即用户名和密码,进而客户端便可以基于通讯协议生成登录请求,并将登录请求发送至服务器。其中,该登录请求携带用户名和密码。
其中,通信协议可以为WebSocket,当然也可以为文件传输协议(File Transfer protocol)、超文本传输协议(Hypertext Transfer Protocol)等,在此不做具体限定。
例如,用户想要通过客户端查看存储于云盘A中的照片时,用户可以在客户端所显示的云盘A的登录界面中输入用户名和密码,进而客户端便可以生成登录请求,并将携带用户名和密码的登录请求发送至云盘A对应的服务器。
服务器在接收到该登录请求后,可以根据登录请求携带的用户名和密码进行登录认证,在一种实施方式中,服务器可以验证登录请求携带的用户名和密码是否与已存储的用户注册时提供的用户名和密码匹配,如果匹配,则可以确定登录认证通过,用户登录成功;如果不匹配,那么则可以确定认证不通过,用户登录失败。
在某些情况下,客户端可能需要调用一个或多个本地服务进程与服务器进行通信。例如,用户进行多窗口播放视频操作时,每个播放窗口的视频内容可以分别通过一个本地服务进程从服务器获取。为了实现本地服务进程与服务器进行通信,在客户端通过服务器的登录认证后,客户端或本地服务进程可以向服务器发送会话认证信息请求,服务器接收到该会话认证信息请求后,可以对本地服务进程进行认证,在认证通过后,可以返回第一session认证信息。其中,第一session认证信息可以为字符串等认证信息,在此不做具体限定。
进而,由于本地服务进程已经通过服务器的认证,那么其便可以与服务器单独进行通信,具体来说,本地服务进程可以基于第一session认证信息以及自身维护的token与服务器进行通信。
其中,本地服务进程自身维护的token为本地服务进程自身基于一定规则生成的token,而不是向客户端获取的token。例如,本地服务进程可以在1-200中按照顺序选择一个数字作为本次通信所基于的token,假设上一次与服务器通信所基于的token为1,那么本次通信所基于的token则可以为2。
如果存在多个本地服务进程与服务器进行通信,那么每个本地服务进程可以基于不同的第一session认证信息与服务器进行通信。由于每个本地服务进程基于不同的第一session认证信息与服务器进行通信,因此每个本地服务进程均可以自身维护token,而不需要每次向客户端获取不同的token。不同的本地服务进程可以基于相同的token与服务器通信,也可以基于不同的token与服务器通信,都不会影响通信的顺利进行。
作为本申请实施例的一种实施方式,上述向所述服务器发送会话认证信息请求的步骤,可以包括:
所述本地服务进程向所述服务器发送携带用户名和密码的会话认证信息请求,以使所述服务器在对所述用户名和所述密码认证通过后,返回第一会话认证信息至所述本地服务进程。
在客户端通过服务器的登录认证后,本地服务进程可以向服务器发送携带用户名和密码的会话认证信息请求,服务器接收到该会话认证信息请求后,可以对其携带的用户名和密码进行认证,在对用户名和密码认证通过后,说明该本地服务进程具有通信权限,服务器可以返回第一session认证信息至本地服务进程。
进而,本地服务进程便可以基于该第一session认证信息以及自身维护的token与服务器进行通信。
可见,本实施例中,本地服务进程可以向服务器发送携带用户名和密码的会话认证信息请求,进而,服务器可以对用户名和密码进行认证,并在认证通过后,返回第一session认证信息至本地服务进程。这样,本地服务进程可以通过用户名和密码认证的方式,从服务器获取第一session认证信息,后续则无需向客户端请求token,而是可以基于该第一session认证信息以及自身维护的token与服务器进行通信。
作为本申请实施例的一种实施方式,上述向所述服务器发送会话认证信息请求的步骤,可以包括:
所述客户端基于第二session认证信息发送会话认证信息请求至所述服务器,以使所述服务器对所述第二session认证信息验证通过后生成第一session认证信息,并返回所述第一session认证信息至所述客户端。
在对客户端认证通过后,服务器可以返回第二session认证信息至客户端,其中,第二session认证信息为服务器在认证用户名和密码通过后所生成的认证信息,即第二session认证信息可以标识当前登录的用户的登录状态的合法性。
进而,客户端可以接收第二session认证信息,并基于第二session认证信息发送会话认证信息请求至服务器,服务器对第二session认证信息验证通过后,可以生成第一session认证信息,并返回第一session认证信息。其中,第二session认证信息为服务器对客户端进行登录认证后生成的session认证信息,客户端基于第二session认证信息与服务器进行通信,本地服务进程则基于第一session认证信息与服务器进行通信,第二session认证信息与第一session认证信息不同。每个第一session认证信息用于标识其所对应的本地服务进程的合法性。
相应的,在上述向所述服务器发送会话认证信息请求的步骤之后,上述方法还可以包括:
所述客户端接收所述服务器返回的所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
客户端接收服务器返回的第一session认证信息后,可以发送第一session认证信息至本地服务进程,本地服务进程接收到该第一session认证信息后,便可以基于第一session认证信息以及自身维护的token与服务器进行通信。这样,客户端调用本地服务进程与服务器进行通信时,不需要针对每个本地服务进程分别进行用户名以及密码的认证,可以提高通信效率。
在一种实施方式中,在需要多个本地服务进程与服务器通信时,客户端可以分别针对每个本地服务进程,向服务器申请第一session认证信息,进而,客户端可以将不同的第一session认证信息发送至不同的本地服务进程,进而每个本地服务进程可以基于所接收到的第一session认证信息分别与服务器进行通信。
可见,在本实施例中,客户端与服务器只通过一次基于用户名和密码的认证,便可以使不同的本地服务进程独立与服务器进行通信,可以进一步提高通信效率。
在一种实施方式中,在客户端与服务器进行通信连接的过程中,为了保证通信的安全性,每个session认证信息都存在失效时间,例如,若第二session认证信息未使用的时间超过十分钟,该第二session认证信息便会失效,那么其对应的各个第一session认证信息也即失效。
本申请实施例所提供的第一session认证信息与第二session认证信息之间可以是继承关系,即第二session认证信息可以称为主session认证信息,第一session认证信息可以称为子session认证信息。具体来说,终端与服务器可以预先设定如下规则:无论是主session认证信息还是子session认证信息,每一个session认证信息都会有失效时间,当这个session认证信息预设时长内不使用,该session认证信息就会失效;如果主session认证信息一直存活着,那么该主session认证信息所对应的子session认证信息也不会失效;如果一个或多个子session认证信息一直在使用即存活着,那么主session认证信息也不会失效。继承于主session认证信息的子session认证信息的数量可以具有上限,例如,可以为3、5、8等,在此不做具体限定。
作为本申请实施例的一种实施方式,如图2所示,上述客户端基于第二会话认证信息发送会话认证信息请求至所述服务器的步骤,可以包括:
S201,所述客户端基于第二会话认证信息以及自身维护的令牌生成会话认证信息请求;
客户端自身维护的token为客户端基于与服务器的通信协议维护的认证参数,客户端在接收到服务 器返回的第二session认证信息后,客户端可以基于与服务器的预先协商好的token范围,确定用于与服务器进行通信的认证参数,即自身维护的token。客户端可以基于第二session认证信息以及该token生成会话认证信息请求。
其中,客户端自身维护的token为数据请求中所携带的能够防止攻击的认证参数,客户端每次与服务器进行通信时,通信请求所携带的token会发生变化。其中,数据请求和通信请求即为前述内容中所提及的网络请求。
例如,客户端与服务器的预先协商好的token范围为1-300,那么上述自身维护的token可以为1,客户端后续再次向服务器发送通信请求时,所使用的token可以为2,依次类推,每次向服务器发送通信请求时,所使用的token可以增加1。
S202,所述客户端发送所述会话认证信息请求至所述服务器,以使所述服务器验证所述会话认证信息请求携带的所述第二会话认证信息以及令牌是否合法,在验证通过后,创建第一会话认证信息,并发送所述第一会话认证信息至所述客户端。
客户端生成会话认证信息请求后,可以将会话认证信息请求发送至服务器。服务器接收到该会话认证信息请求后,可以验证会话认证信息请求携带的第二session认证信息以及token是否合法。
作为一种实施方式,服务器接收到会话认证信息请求后,可以验证会话认证信息请求携带的第二session认证信息是否与客户端登录认证通过后服务器自身生成的第二session认证信息一致,如果一致,则确定会话认证信息请求携带的第二session认证信息是合法的。同时,服务器还可以验证会话认证信息请求携带的token是否属于预先与客户端协商好的token范围,以及是否与客户端之前发送的网络请求所携带的token重复,如果属于该token范围且不重复,可以确定会话认证信息请求携带的第二session认证信息以及token合法。
在验证通过后,服务器可以创建第一session认证信息,进而发送该第一session认证信息至客户端。第一session认证信息与其对应的第二session认证信息具备相同的认证能力,即均可以标识用户登录状态的合法性。
可见,在本实施例中,客户端可以基于第二会话认证信息以及自身维护的令牌生成会话认证信息请求,发送会话认证信息请求至服务器,进而服务器可以验证会话认证信息请求携带的第二会话认证信息以及token是否合法,在验证通过后,可以创建第一会话认证信息,并发送第一会话认证信息至客户端。这样,客户端便能够在保证通信安全的前提下,请求到具备与第二会话认证信息相同认证能力的第一会话认证信息,以保证本地服务进程可以基于第一会话认证信息与服务器合法通信。
作为本申请实施例所提供的一种实施方式,上述方法还可以包括:
所述客户端发送第一销毁指令至所述服务器,以使所述服务器销毁所述第一会话认证信息以及所述第二会话认证信息;或,所述客户端发送第二销毁指令至所述服务器以及所述本地服务进程,以使所述服务器销毁所述第一会话认证信息;所述本地服务进程接收所述第二销毁指令,并销毁所述第一会话认证信息。
在用户想要停止客户端与服务器之间的通信,或者,想要停止某个或某些本地服务进程与服务器之间的通信的情况下,客户端可以发送销毁指令至服务器和/或本地服务进程,以销毁对应的session认证信息。
第一种情况,在需要停止客户端与服务器之间的通信时,客户端可以发送第一销毁指令至服务器, 其中,第一销毁指令用于指示销毁第二session认证信息。由于客户端与服务器之间的通信停止,所以所有与该客户端对应的本地服务进程与服务器之间的通信也就停止,那么,如果第二session认证信息失效,该第二session认证信息对应的所有第一session认证信息也就没有必要继续存在,因此服务器在接收到第一销毁指令后,可以销毁第二session认证信息以及销毁该第二session认证信息对应的第一session认证信息。后续即使本地服务进程再基于第一session认证信息向服务器发送数据请求,由于服务器已经销毁第一session认证信息,所以二者无法继续进行通信。
当然,在这种情况下,客户端也可以发送销毁指令至每个本地服务进程,进而,每个本地服务进程在接收到销毁指令后,销毁自身对应的第一session认证信息,这样,该客户端对应的所有session认证信息即被销毁。
第二种情况,需要停止某个或某些本地服务进程与服务器之间的通信时,客户端可以发送第二销毁指令至服务器以及本地服务进程,其中,第二销毁指令用于指示销毁某个第一session认证信息。
在一种实施方式中,一般第一session认证信息的数量具有上限,所以在某个或某些本地服务进程与服务器之间的通信完成后,可以销毁该本地服务进程对应的第一session认证信息,以便在需要新的本地服务进程与服务器进行通信时,可以顺利创建新的第一session认证信息。
例如,客户端界面中的4个视频播放窗口中的播放窗口A对应的视频播放完成,那么此时客户端可以发送第二销毁指令至服务器以及播放窗口A对应的本地服务进程。
服务器和本地服务进程接收到第二销毁指令后,便可以销毁第二销毁指令所指示的第一session认证信息。
在第二session认证信息销毁之后,如果客户端发送携带该第二session认证信息的网络请求至服务器,或者,本地服务进程发送携带该第二session认证信息对应的第一session认证信息的网络请求至服务器时,服务器均会认证不通过。在第一session认证信息销毁之后,如果本地服务进程发送携带该第一session认证信息的网络请求至服务器时,服务器会认证不通过。但是,此时第二session认证信息和其他第一session认证信息仍然有效,可以继续使用。
可见,在本实施例中,客户端可以发送第一销毁指令至服务器以使服务器销毁第二会话认证信息以及第一会话认证信息;或,客户端可以发送第二销毁指令至服务器以及本地服务进程,以使服务器和本地服务进程销毁第一会话认证信息。这样,针对不同的情况,客户端可以发送不同的销毁指令,以使服务器和/或本地服务进程能够及时销毁对应的会话认证信息,既能够保证通信安全,还能提高通信效率。
作为本申请实施例所提供的一种实施方式,上述方法还可以包括:
所述客户端接收所述服务器发送的第三销毁指令,销毁所述第二会话认证信息以及所述第一会话认证信息;或,所述客户端接收所述服务器发送的第四销毁指令,销毁所述第一会话认证信息。
服务器也可以主动发送销毁指令至客户端,第一种情况,在需要停止服务器与客户端之间的通信时,服务器可以发送第三销毁指令至客户端,其中,第三销毁指令用于指示销毁第二session认证信息。此时,由于客户端与服务器之间的通信停止,所以所有与该客户端对应的本地服务进程与服务器之间的通信也就停止,那么,如果第二session认证信息失效,那么所有第一session认证信息也就没有必要继续存在,因此客户端可以销毁第二session认证信息以及第一session认证信息。
第二种情况,需要停止某个或某些本地服务进程与服务器之间的通信时,服务器可以发送第四销毁指令至客户端,其中,第四销毁指令用于指示销毁第一session认证信息。客户端接收到该第四销毁指 令后,便可以销毁该第一session认证信息。
当然,在销毁第一session认证信息的情况下,客户端也可以发送销毁指令至对应的本地服务进程,本地服务进程接收到销毁指令后,可以销毁自身对应的第一session认证信息,也即不再与服务器进行通信。
可见,在本实施例中,客户端可以接收服务器发送的第三销毁指令,销毁第二会话认证信息以及第一会话认证信息;或,客户端可以接收服务器发送的第四销毁指令,销毁所述第一会话认证信息。这样,针对不同的情况,服务器可以发送不同的销毁指令,以使客户端能够及时销毁对应的会话认证信息,既能够保证通信安全,还能提高通信效率。
作为本申请实施例所提供的一种实施方式,上述销毁所述第二会话认证信息以及所述第一会话认证信息的步骤,可以包括:
根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第三销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
为了方便后续管理第二session认证信息与第一session认证信息,客户端在接收到服务器发送的第二session认证信息和第一session认证信息后,可以记录第二session认证信息与第一session认证信息之间的对应关系。例如,客户端通过session A与服务器通信,同时还存在三个本地服务进程分别基于session A1、session A2以及session A3与服务器通信,那么客户端可以记录第二session认证信息与第一session认证信息之间的对应关系如下:
这样,当客户端接收到服务器发送的第三销毁指令后,可以根据预先记录的第二session认证信息与第一session认证信息之间的对应关系,确定第三销毁指令所指示的第二session认证信息对应的第一session认证信息,销毁第二session认证信息以及所确定的第一session认证信息。
例如,第三销毁指令所指示的第二session认证信息为session A,那么客户端根据上述表格所记录的对应关系,可以确定需要销毁的第一session认证信息包括session A1、session A2以及session A3。进而,可以销毁session A、session A1、session A2以及session A3。
可见,在本实施例中,客户端在接收到服务器发送的第二会话认证信息和第一会话认证信息后,可以记录第二会话认证信息与第一会话认证信息之间的对应关系,这样后续在销毁第二会话认证信息以及第一会话认证信息,可以根据该对应关系,快速确定销毁指令所指示的第二会话认证信息所对应的第一会话认证信息,从而实现会话认证信息的快速销毁。
作为本申请实施例所提供的一种实施方式,上述第一会话认证信息可以为服务器对第二会话认证信息验证通过后,基于第二会话认证信息按照预设会话认证信息生成规则生成的。
其中,预设会话认证信息生成规则可以在服务器和客户端预先设置,这样服务器在生成第一session认证信息时,便可以按照该预设session认证信息生成规则生成。作为一种实施方式,预设session认证 信息生成规则可以为按照生成先后顺序依次在第二session认证信息基础上增加编号。
例如,第二session认证信息为:922D39266FF24883A4EDBFE4A706F31F,那么服务器第一次基于第二session认证信息按照预设session认证信息生成规则生成第一session认证信息时,可以生成第一session认证信息:922D39266FF24883A4EDBFE4A706F31F_1;第二次基于第二session认证信息按照预设session认证信息生成规则生成第一session认证信息时,可以生成第一session认证信息:922D39266FF24883A4EDBFE4A706F31F_2,依此类推,可以生成多个第一session认证信息。
针对这种情况,上述销毁所述第二会话认证信息以及所述第一会话认证信息的步骤,可以包括:
查找与所述第三销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所查找到的第一会话认证信息。
由于第一session认证信息与对应的第二session认证信息之间符合预设session认证信息生成规则,所以当客户端接收到第三销毁指令后,可以查找与第三销毁指令所指示的第二session认证信息符合该预设session认证信息生成规则的第一session认证信息,进而,销毁第二session认证信息以及所查找到的第一session认证信息。
可见,在本实施例中,无论采用哪一种销毁方式,均可以准确快速地确定所要销毁的第一会话认证信息和第二会话认证信息。
相应于上述第一种通信方法,本申请实施例还提供了第二种通信方法。下面对本申请实施例所提供的第二种通信方法进行介绍。本申请实施例所提供的第二种通信方法,可以应用于服务器。
如图3所示,一种通信方法,应用于服务器,所述方法可以包括:
S301,接收终端发送的会话认证信息请求;
其中,所述终端运行有客户端及本地服务进程,所述会话认证信息请求为所述终端在所述客户端通过所述服务器的登录认证后发送的。
S302,在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端,以使所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
可见,本申请实施例所提供的方案中,服务器可以接收终端发送的会话认证信息请求,在对本地服务进程认证通过后,发送第一会话认证信息至终端,以使本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信,其中,终端运行有客户端及本地服务进程,会话认证信息请求为终端在客户端通过服务器的登录认证后发送的。通过上述方案,本地服务进程与服务器进行通信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,相较于目前本地服务进程与服务器通信的方案,通信过程简便,提高了通信效率。
作为本申请实施例的一种实施方式,上述接收终端发送的会话认证信息请求的步骤,可以包括:
接收所述本地服务进程发送的携带用户名和密码的会话认证信息请求;
相应的,上述在对所述本地服务进程认证通过后,发送第一会话认证信息的步骤,可以包括:
在对所述用户名和所述密码认证通过后,发送第一会话认证信息至所述本地服务进程。
作为本申请实施例的一种实施方式,上述接收终端发送的会话认证信息请求的步骤,可以包括:
接收所述客户端基于第二会话认证信息发送的会话认证信息请求,其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息 与所述服务器进行通信;
相应的,上述在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端的步骤,可以包括:
对所述第二会话认证信息进行验证,并在验证通过后生成第一会话认证信息,其中,所述第一会话认证信息与所述第二会话认证信息不同;
发送所述第一会话认证信息至所述客户端,以使所述客户端接收所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
作为本申请实施例的一种实施方式,上述方法还可以包括:
接收所述客户端发送的第一销毁指令;销毁所述第一会话认证信息以及所述第二会话认证信息,其中,所述第一销毁指令用于指示销毁所述第二会话认证信息;或,
接收所述客户端发送的第二销毁指令;销毁所述第一会话认证信息,其中,所述第二销毁指令用于指示销毁所述第一会话认证信息。
作为本申请实施例的一种实施方式,上述销毁所述第一会话认证信息以及所述第二会话认证信息的步骤,可以包括:
根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第一销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
作为本申请实施例的一种实施方式,上述第一会话认证信息可以为对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
相应的,上述销毁所述第一会话认证信息以及所述第二会话认证信息的步骤,可以包括:
查找与所述第一销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
作为本申请实施例的一种实施方式,上述方法还可以包括:
发送第三销毁指令至所述客户端,以使所述客户端销毁所述第二会话认证信息以及所述第一会话认证信息,其中,所述第三销毁指令用于指示销毁所述第二会话认证信息;或,
发送第四销毁指令至所述客户端,以使所述客户端销毁所述第一会话认证信息,其中,所述第四销毁指令用于指示销毁所述第一会话认证信息。
作为本申请实施例的一种实施方式,上述本地服务进程可以为多个;
上述服务器与每个所述本地服务进程可以基于不同的第一会话认证信息进行通信。
下面结合图4所示的信令交互流程图,以客户端通过本地服务进程向服务器请求图片为例,对本申请实施例所提供的通信过程进行举例介绍,可以包括以下步骤:
S401,客户端发送登录请求至服务器;
S402,服务器接收登录请求,并根据登录请求携带的用户名和密码进行登录认证,若认证成功,生成第二session认证信息;
S403,服务器将第二session认证信息发送至客户端;
S404,客户端接收第二session认证信息,并基于第二session认证信息以及自身维护的token生成 session认证信息请求;
S405,客户端发送session认证信息请求至服务器;
S406,服务器接收session认证信息请求,并验证session认证信息请求所携带的第二session认证信息以及token是否合法;若合法,服务器创建第二session认证信息对应的第一session认证信息;
其中,第一session认证信息与第二session认证信息之间可以符合预设session认证信息生成规则。
S407,服务器发送第一session认证信息至客户端;
S408,客户端接收第一session认证信息;
S409,客户端发送第一session认证信息至本地服务进程;
S410,本地服务进程接收第一session认证信息;
S411,客户端发送图片请求指令至本地服务进程;
S412,本地服务进程接收图片请求指令,并基于第一session认证信息以及自身维护的token生成图片获取请求;
S413,本地服务进程将图片获取请求发送至服务器;
S414,服务器接收图片获取请求,并验证图片获取请求中的第一session认证信息以及token是否合法,若合法,则执行步骤S415;
S415,服务器返回图片获取请求对应的数据结果至本地服务进程;
S416,本地服务进程基于数据结果展示图片;
在需要销毁某个第一session认证信息时,通信过程还可以包括以下步骤:
S417,客户端发送第二销毁指令至本地服务进程以及服务器;
其中,第二销毁指令用于指示销毁第一session认证信息;
S418,本地服务进程销毁第一session认证信息;
S419,服务器销毁第一session认证信息。
可见,在本实施例中,客户端、服务器以及本地服务进程通过上述交互方式,能够在客户端调用本地服务进程与服务器进行通信时,尤其是进行多进程通信时,无需每次向客户端获取token,相较于目前的通信连接方法,通信过程简便,提高了通信效率。
相应于上述第一种通信方法,本申请实施例还提供了一种通信装置。
如图5所示,一种通信装置,应用于终端,所述终端运行有客户端及本地服务进程,所述装置可以包括:
第一发送模块510,用于在所述客户端通过服务器的登录认证后,向所述服务器发送会话认证信息请求,以使所述服务器在对所述本地服务进程认证通过后,返回第一会话认证信息;
第一通信模块520,用于所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
可见,本申请实施例所提供的方案中,在客户端通过服务器的登录认证后,向服务器发送会话认证信息请求,以使服务器在对本地服务进程认证通过后,返回第一会话认证信息,本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信。通过上述方案,本地服务进程与服务器进行通 信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,相较于目前本地服务进程与服务器通信的方案,通信过程简便,提高了通信效率。
作为本申请实施例的一种实施方式,上述第一发送模块510,可以包括:
第一发送单元,用于所述本地服务进程向所述服务器发送携带用户名和密码的会话认证信息请求,以使所述服务器在对所述用户名和所述密码认证通过后,返回第一会话认证信息至所述本地服务进程。
作为本申请实施例的一种实施方式,上述第一发送模块510,可以包括:
第二发送单元,用于所述客户端基于第二会话认证信息发送会话认证信息请求至所述服务器,以使所述服务器对所述第二会话认证信息验证通过后生成第一会话认证信息,并返回所述第一会话认证信息至所述客户端,其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息与所述服务器进行通信,所述第二会话认证信息与所述第一会话认证信息不同;
上述装置还可以包括:
第二发送模块,用于在所述向所述服务器发送会话认证信息请求之后,所述客户端接收所述服务器返回的所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
作为本申请实施例的一种实施方式,上述装置还可以包括:
第一销毁指令发送模块,用于所述客户端发送第一销毁指令至所述服务器,以使所述服务器销毁所述第一会话认证信息以及所述第二会话认证信息;或,
用于所述客户端发送第二销毁指令至所述服务器以及所述本地服务进程,以使所述服务器销毁所述第一会话认证信息;所述本地服务进程接收所述第二销毁指令,并销毁所述第一会话认证信息。
其中,所述第一销毁指令用于指示销毁所述第二会话认证信息;所述第二销毁指令用于指示销毁所述第一会话认证信息。
作为本申请实施例的一种实施方式,上述装置还可以包括:
第一销毁模块,用于所述客户端接收所述服务器发送的第三销毁指令,销毁所述第二会话认证信息以及所述第一会话认证信息;或,
用于所述客户端接收所述服务器发送的第四销毁指令,销毁所述第一会话认证信息。
其中,所述第三销毁指令用于指示销毁所述第二会话认证信息其中,所述第四销毁指令用于指示销毁所述第一会话认证信息。
作为本申请实施例的一种实施方式,上述第一销毁模块可以包括:
第一销毁单元,用于根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第三销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
作为本申请实施例的一种实施方式,上述第一会话认证信息可以为所述服务器对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
上述第一销毁模块可以包括:
第二销毁单元,用于查找与所述第三销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所查找到的第一会话认证信息。
作为本申请实施例的一种实施方式,上述本地服务进程为多个;
每个所述本地服务进程基于不同的第一会话认证信息与所述服务器进行通信。
相应于上述第二种通信方法,本申请实施例还提供了另一种通信装置。
如图6所示,一种通信装置,应用于服务器,所述装置包括:
第一接收模块610,用于接收终端发送的会话认证信息请求;
其中,所述终端运行有客户端及本地服务进程,所述会话认证信息请求为所述终端在所述客户端通过所述服务器的登录认证后发送的。
第二发送模块620,用于在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端,以使所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
可见,本申请实施例所提供的方案中,服务器可以接收终端发送的会话认证信息请求,在对本地服务进程认证通过后,发送第一会话认证信息至终端,以使本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信,其中,终端运行有客户端及本地服务进程,会话认证信息请求为终端在客户端通过服务器的登录认证后发送的。通过上述方案,本地服务进程与服务器进行通信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,相较于目前本地服务进程与服务器通信的方案,通信过程简便,提高了通信效率。
作为本申请实施例的一种实施方式,上述第一接收模块610可以包括:
第一接收单元,用于接收所述本地服务进程发送的携带用户名和密码的会话认证信息请求;
上述第二发送模块620可以包括:
在对所述用户名和所述密码认证通过后,发送第一会话认证信息至所述本地服务进程。
作为本申请实施例的一种实施方式,上述第一接收模块610可以包括:
第二接收单元,用于接收所述客户端基于第二会话认证信息发送的会话认证信息请求;
其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息与所述服务器进行通信。
上述第二发送模块620可以包括:
会话认证信息生成单元,用于对所述第二会话认证信息进行验证,并在验证通过后生成第一会话认证信息;
其中,所述第一会话认证信息与所述第二会话认证信息不同。
会话认证信息发送单元,用于发送所述第一会话认证信息至所述客户端,以使所述客户端接收所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
作为本申请实施例的一种实施方式,上述装置还可以包括:
第二销毁模块,用于接收所述客户端发送的第一销毁指令;销毁所述第一会话认证信息以及所述第二会话认证信息;或,
用于接收所述客户端发送的第二销毁指令;销毁所述第一会话认证信息。
其中,所述第一销毁指令用于指示销毁所述第二会话认证信息所述第二销毁指令用于指示销毁所述第一会话认证信息。
作为本申请实施例的一种实施方式,上述第二销毁模块可以包括:
第三销毁单元,用于根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第一销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
作为本申请实施例的一种实施方式,上述第一会话认证信息可以为对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
上述第二销毁模块可以包括:
第四销毁单元,用于查找与所述第一销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
作为本申请实施例的一种实施方式,上述装置还可以包括:
第二销毁指令发送模块,用于发送第三销毁指令至所述客户端,以使所述客户端销毁所述第二会话认证信息以及所述第一会话认证信息;或,
用于发送第四销毁指令至所述客户端,以使所述客户端销毁所述第一会话认证信息。
其中,所述第三销毁指令用于指示销毁所述第二会话认证信息,所述第四销毁指令用于指示销毁所述第一会话认证信息。
作为本申请实施例的一种实施方式,上述本地服务进程可以为多个;
所述服务器与每个所述本地服务进程基于不同的第一会话认证信息进行通信。
相应于上述通信方法,本申请实施例还提供了一种通信系统,如图7所示,一种通信系统,所述系统包括终端701和服务器702,终端701运行有客户端703及本地服务进程704,其中:
所述终端701,用于执行上述第一种通信方法的步骤;
所述服务器702,用于执行上述第二种通信方法的步骤。
可见,本申请实施例所提供的方案中,终端运行有客户端及本地服务进程,终端在客户端通过服务器的登录认证后可以发送会话认证信息请求至服务器,服务器可以接收终端发送的会话认证信息请求,在对本地服务进程认证通过后,发送第一会话认证信息至终端,本地服务进程基于第一会话认证信息以及自身维护的令牌,与服务器进行通信。通过上述方案,本地服务进程与服务器进行通信时,本地服务进程不需要每次向客户端获取令牌,而是基于第一会话认证信息以及自身维护的令牌与服务器进行通信,相较于目前本地服务进程与服务器通信的方案,通信过程简便,提高了通信效率。
本申请实施例还提供了一种终端,如图8所示,包括处理器801、通信接口802、存储器803和通信总线804,其中,处理器801,通信接口802,存储器803通过通信总线804完成相互间的通信,
存储器803,用于存放计算机程序;
处理器801,用于执行存储器803上所存放的程序时,实现上述第一种通信方法的步骤。
上述终端提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一 种类型的总线。
通信接口用于上述终端与其他设备之间的通信。
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
本申请实施例还提供了一种服务器,如图9所示,包括处理器901、通信接口902、存储器903和通信总线904,其中,处理器901,通信接口902,存储器903通过通信总线904完成相互间的通信,
存储器903,用于存放计算机程序;
处理器901,用于执行存储器903上所存放的程序时,实现上述第二种通信方法的步骤。
上述服务器提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
通信接口用于上述服务器与其他设备之间的通信。
存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
在本申请提供的又一实施例中,还提供了一种计算机可读存储介质,该计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例所述的通信方法的步骤。
在本申请提供的又一实施例中,还提供了一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述任一实施例所述的通信方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服 务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于第二种通信方法、装置、系统、终端、服务器、计算机可读存储介质以及计算机程序产品而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本申请的较佳实施例,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。

Claims (23)

  1. 一种通信方法,其特征在于,应用于终端,所述终端运行有客户端及本地服务进程,所述方法包括:
    在所述客户端通过服务器的登录认证后,向所述服务器发送会话认证信息请求,以使所述服务器在对所述本地服务进程认证通过后,返回第一会话认证信息;
    所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
  2. 根据权利要求1所述的方法,其特征在于,所述向所述服务器发送会话认证信息请求的步骤,包括:
    所述本地服务进程向所述服务器发送携带用户名和密码的会话认证信息请求,以使所述服务器在对所述用户名和所述密码认证通过后,返回第一会话认证信息至所述本地服务进程。
  3. 根据权利要求1所述的方法,其特征在于,所述向所述服务器发送会话认证信息请求的步骤,包括:
    所述客户端基于第二会话认证信息发送会话认证信息请求至所述服务器,以使所述服务器对所述第二会话认证信息验证通过后生成第一会话认证信息,并返回所述第一会话认证信息至所述客户端,其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息与所述服务器进行通信,所述第二会话认证信息与所述第一会话认证信息不同;
    在所述向所述服务器发送会话认证信息请求的步骤之后,所述方法还包括:
    所述客户端接收所述服务器返回的所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    所述客户端发送第一销毁指令至所述服务器,以使所述服务器销毁所述第一会话认证信息以及所述第二会话认证信息;其中,所述第一销毁指令用于指示销毁所述第二会话认证信息;或,
    所述客户端发送第二销毁指令至所述服务器以及所述本地服务进程,以使所述服务器销毁所述第一会话认证信息;所述本地服务进程接收所述第二销毁指令,并销毁所述第一会话认证信息,其中,所述第二销毁指令用于指示销毁所述第一会话认证信息。
  5. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    所述客户端接收所述服务器发送的第三销毁指令,销毁所述第二会话认证信息以及所述第一会话认证信息,其中,所述第三销毁指令用于指示销毁所述第二会话认证信息;或,
    所述客户端接收所述服务器发送的第四销毁指令,销毁所述第一会话认证信息,其中,所述第四销毁指令用于指示销毁所述第一会话认证信息。
  6. 根据权利要求5所述的方法,其特征在于,所述销毁所述第二会话认证信息以及所述第一会话认证信息的步骤,包括:
    根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第三销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
  7. 根据权利要求5所述的方法,其特征在于,所述第一会话认证信息为所述服务器对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
    所述销毁所述第二会话认证信息以及所述第一会话认证信息的步骤,包括:
    查找与所述第三销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所查找到的第一会话认证信息。
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述本地服务进程为多个;
    每个所述本地服务进程基于不同的第一会话认证信息与所述服务器进行通信。
  9. 一种通信方法,其特征在于,应用于服务器,所述方法包括:
    接收终端发送的会话认证信息请求,其中,所述终端运行有客户端及本地服务进程,所述会话认证信息请求为所述终端在所述客户端通过所述服务器的登录认证后发送的;
    在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端,以使所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
  10. 根据权利要求9所述的方法,其特征在于,所述接收终端发送的会话认证信息请求的步骤,包括:
    接收所述本地服务进程发送的携带用户名和密码的会话认证信息请求;
    所述在对所述本地服务进程认证通过后,发送第一会话认证信息的步骤,包括:
    在对所述用户名和所述密码认证通过后,发送第一会话认证信息至所述本地服务进程。
  11. 根据权利要求9所述的方法,其特征在于,所述接收终端发送的会话认证信息请求的步骤,包括:
    接收所述客户端基于第二会话认证信息发送的会话认证信息请求,其中,所述第二会话认证信息为所述服务器对所述客户端进行登录认证后生成的会话认证信息,所述客户端基于所述第二会话认证信息与所述服务器进行通信;
    所述在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端的步骤,包括:
    对所述第二会话认证信息进行验证,并在验证通过后生成第一会话认证信息,其中,所述第一会话认证信息与所述第二会话认证信息不同;
    发送所述第一会话认证信息至所述客户端,以使所述客户端接收所述第一会话认证信息,并发送所述第一会话认证信息至所述本地服务进程。
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    接收所述客户端发送的第一销毁指令;销毁所述第一会话认证信息以及所述第二会话认证信息,其中,所述第一销毁指令用于指示销毁所述第二会话认证信息;或,
    接收所述客户端发送的第二销毁指令;销毁所述第一会话认证信息,其中,所述第二销毁指令用于指示销毁所述第一会话认证信息。
  13. 根据权利要求12所述的方法,其特征在于,所述销毁所述第一会话认证信息以及所述第二会话认证信息的步骤,包括:
    根据预先记录的第二会话认证信息与第一会话认证信息之间的对应关系,确定所述第一销毁指令所指示的第二会话认证信息对应的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话 认证信息。
  14. 根据权利要求12所述的方法,其特征在于,所述第一会话认证信息为对所述第二会话认证信息验证通过后,基于所述第二会话认证信息按照预设会话认证信息生成规则生成的;
    所述销毁所述第一会话认证信息以及所述第二会话认证信息的步骤,包括:
    查找与所述第一销毁指令所指示的第二会话认证信息符合所述预设会话认证信息生成规则的第一会话认证信息,销毁所述第二会话认证信息以及所确定的第一会话认证信息。
  15. 根据权利要求11所述的方法,其特征在于,所述方法还包括:
    发送第三销毁指令至所述客户端,以使所述客户端销毁所述第二会话认证信息以及所述第一会话认证信息,其中,所述第三销毁指令用于指示销毁所述第二会话认证信息;或,
    发送第四销毁指令至所述客户端,以使所述客户端销毁所述第一会话认证信息,其中,所述第四销毁指令用于指示销毁所述第一会话认证信息。
  16. 根据权利要求9-15任一项所述的方法,其特征在于,所述本地服务进程为多个;
    所述服务器与每个所述本地服务进程基于不同的第一会话认证信息进行通信。
  17. 一种通信装置,其特征在于,应用于终端,所述终端运行有客户端及本地服务进程,所述装置包括:
    第一发送模块,用于在所述客户端通过服务器的登录认证后,向所述服务器发送会话认证信息请求,以使所述服务器在对所述本地服务进程认证通过后,返回第一会话认证信息;
    第一通信模块,用于所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
  18. 一种通信装置,其特征在于,应用于服务器,所述装置包括:
    第一接收模块,用于接收终端发送的会话认证信息请求,其中,所述终端运行有客户端及本地服务进程,所述会话认证信息请求为所述终端在所述客户端通过所述服务器的登录认证后发送的;
    第二发送模块,用于在对所述本地服务进程认证通过后,发送第一会话认证信息至所述终端,以使所述本地服务进程基于所述第一会话认证信息以及自身维护的令牌,与所述服务器进行通信。
  19. 一种通信系统,其特征在于,所述系统包括终端以及服务器,所述终端运行有客户端及本地服务进程,其中:
    所述终端,用于执行权利要求1-8任一项所述的方法步骤;
    所述服务器,用于执行权利要求9-16任一项所述的方法步骤。
  20. 一种终端,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
    存储器,用于存放计算机程序;
    处理器,用于执行存储器上所存放的程序时,实现权利要求1-8任一所述的方法步骤。
  21. 一种服务器,其特征在于,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;
    存储器,用于存放计算机程序;
    处理器,用于执行存储器上所存放的程序时,实现权利要求9-16任一所述的方法步骤。
  22. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-8或9-16任一所述的方法步骤。
  23. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行权利要求1-8或9-16任一所述的方法步骤。
PCT/CN2023/077819 2022-04-18 2023-02-23 一种通信方法、装置、系统、终端及服务器 WO2023202214A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210403914.7A CN114866247B (zh) 2022-04-18 2022-04-18 一种通信方法、装置、系统、终端及服务器
CN202210403914.7 2022-04-18

Publications (1)

Publication Number Publication Date
WO2023202214A1 true WO2023202214A1 (zh) 2023-10-26

Family

ID=82630649

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/077819 WO2023202214A1 (zh) 2022-04-18 2023-02-23 一种通信方法、装置、系统、终端及服务器

Country Status (2)

Country Link
CN (1) CN114866247B (zh)
WO (1) WO2023202214A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866247B (zh) * 2022-04-18 2024-01-02 杭州海康威视数字技术股份有限公司 一种通信方法、装置、系统、终端及服务器

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130086381A1 (en) * 2011-10-04 2013-04-04 Microsoft Corporation Multi-server authentication token data exchange
CN113285811A (zh) * 2021-06-11 2021-08-20 智道网联科技(北京)有限公司 数据传输的验证方法和装置、系统和计算机可读存储介质
US20210377248A1 (en) * 2020-06-02 2021-12-02 Salesforce.Com, Inc. Authentication token refresh
CN114866247A (zh) * 2022-04-18 2022-08-05 杭州海康威视数字技术股份有限公司 一种通信方法、装置、系统、终端及服务器

Family Cites Families (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7281128B2 (en) * 2001-10-22 2007-10-09 Extended Systems, Inc. One pass security
US7673135B2 (en) * 2005-12-08 2010-03-02 Microsoft Corporation Request authentication token
US8413210B2 (en) * 2008-12-09 2013-04-02 Microsoft Corporation Credential sharing between multiple client applications
US9560035B2 (en) * 2010-08-04 2017-01-31 At&T Mobility Ii Llc Systems, devices, methods and computer program products for establishing network connections between service providers and applications that run natively on devices
US8881250B2 (en) * 2011-06-17 2014-11-04 Ebay Inc. Passporting credentials between a mobile app and a web browser
CN104169935B (zh) * 2012-03-28 2017-10-31 索尼公司 信息处理装置、信息处理系统、信息处理方法
CN105991514B (zh) * 2015-01-28 2019-10-01 阿里巴巴集团控股有限公司 一种业务请求认证方法及装置
CN106375270B (zh) * 2015-07-24 2020-12-08 华为技术有限公司 令牌生成并认证的方法及认证服务器
CN106850699B (zh) * 2017-04-10 2019-11-29 中国工商银行股份有限公司 一种移动终端登录认证方法及系统
CN109005159B (zh) * 2018-07-03 2021-02-19 中国联合网络通信集团有限公司 终端访问系统服务器的数据处理方法与认证服务器
US11693936B2 (en) * 2018-07-24 2023-07-04 Vmware, Inc. User authentication over an audio channel using a mobile device
CN109861954B (zh) * 2018-07-24 2021-12-10 西安新路网络科技有限公司 一种认证方法、移动终端、pc端及辅助认证服务器
CN109639740B (zh) * 2019-01-31 2022-02-22 平安科技(深圳)有限公司 一种基于设备id的登录态共享方法及装置
CN110213356B (zh) * 2019-05-21 2021-11-12 深圳壹账通智能科技有限公司 一种基于数据处理的登录处理方法及相关设备
CN110177120A (zh) * 2019-06-14 2019-08-27 北京首都在线科技股份有限公司 一种单点登录的方法、装置及计算机可读存储介质
CN110166577B (zh) * 2019-07-01 2022-02-08 中国工商银行股份有限公司 分布式应用群组会话处理系统及方法
CN111030818A (zh) * 2020-01-09 2020-04-17 上海金仕达软件科技有限公司 一种基于微服务网关的统一会话管理方法及系统
CN111628965B (zh) * 2020-04-03 2022-09-30 北京奇艺世纪科技有限公司 一种跨域名登录方法及装置
CN111371811B (zh) * 2020-04-23 2022-08-09 Oppo广东移动通信有限公司 一种资源调用方法、资源调用装置、客户端及业务服务器
CN111814133A (zh) * 2020-05-27 2020-10-23 平安国际智慧城市科技股份有限公司 移动应用统一登录方法及装置
CN113132402B (zh) * 2021-04-27 2022-08-30 奇安信科技集团股份有限公司 单点登录方法和系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130086381A1 (en) * 2011-10-04 2013-04-04 Microsoft Corporation Multi-server authentication token data exchange
US20210377248A1 (en) * 2020-06-02 2021-12-02 Salesforce.Com, Inc. Authentication token refresh
CN113285811A (zh) * 2021-06-11 2021-08-20 智道网联科技(北京)有限公司 数据传输的验证方法和装置、系统和计算机可读存储介质
CN114866247A (zh) * 2022-04-18 2022-08-05 杭州海康威视数字技术股份有限公司 一种通信方法、装置、系统、终端及服务器

Also Published As

Publication number Publication date
CN114866247B (zh) 2024-01-02
CN114866247A (zh) 2022-08-05

Similar Documents

Publication Publication Date Title
US11218460B2 (en) Secure authentication for accessing remote resources
WO2017202312A1 (zh) 消息权限管理方法及设备、存储介质
US8799639B2 (en) Method and apparatus for converting authentication-tokens to facilitate interactions between applications
US10334056B2 (en) Hardware resource access systems and techniques
WO2021057889A1 (zh) 一种数据处理方法、装置、电子设备及存储介质
CN106341234B (zh) 一种授权方法及装置
US11829502B2 (en) Data sharing via distributed ledgers
US9232012B1 (en) Method and system for data usage accounting in a computing device
US20140075513A1 (en) Device token protocol for authorization and persistent authentication shared across applications
WO2019192129A1 (zh) 基于移动终端的客户数据安全访问方法及装置
WO2020233361A1 (zh) 基于网关的内部服务调用方法、装置及终端设备
US10834067B2 (en) Method of access by a telecommunications terminal to a database hosted by a service platform that is accessible via a telecommunications network
KR20140068964A (ko) 자원 액세스 허가 기법
KR101620254B1 (ko) 액세스 제어 방법, 장치, 프로그램 및 기록매체
WO2022001717A1 (zh) 基于区块链的用户信息处理方法及系统
WO2023202214A1 (zh) 一种通信方法、装置、系统、终端及服务器
US10218700B2 (en) Authorizations for computing devices to access a protected resource
CN111949959A (zh) Oauth协议中的授权认证方法及装置
US9455972B1 (en) Provisioning a mobile device with a security application on the fly
CN114978752A (zh) 弱密码检测方法、装置、电子设备及计算机可读存储介质
US20180288112A1 (en) Control system, communication control method, and program product
US20120284781A1 (en) System and method for user friendly detection of spammers
WO2023241331A1 (zh) 物联网系统及其认证与通信方法、相关设备
US20220353081A1 (en) User authentication techniques across applications on a user device
US10110683B2 (en) Systems and methods for maintaining ownership of and avoiding orphaning of communication sessions

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23790877

Country of ref document: EP

Kind code of ref document: A1