HTML5-based network authentication method, device, equipment, and storage medium
By generating target objects and objective functions in HTML5 to manage authentication information, the problem of token coverage and short validity period between multiple service requests is solved, and the stability of authentication information and the reliability of service data acquisition is achieved.
Patent Information
- Application Number
- CN202211460223.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-17
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-11-17
Smart Images

Figure CN115766250B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security technology, and in particular to an HTML5-based network authentication method, device, equipment, and storage medium. Background Art
[0002] In the fifth generation Hypertext Markup Language 5 (HTML5), business requests involve user credentials. Before obtaining business data, each business request needs to obtain a token from the server first, and carry the token throughout the entire life cycle of obtaining and outputting business data, so that the backend can authenticate the business request.
[0003] However, when multiple business requests are initiated at the same time and call the token acquisition interface, it is very likely that the tokens of different business requests will overlap each other, causing business requests to frequently acquire tokens and waste network resources. In addition, tokens usually have an expiration date. If the business request acquires a lot of business data or takes a long time, the token is likely to expire, causing the business request to fail and affecting the acquisition of business data. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a network authentication method, device, equipment, and storage medium based on HTML5, aiming to ensure the stability of authentication information of business requests and improve the reliability of business data acquisition.
[0005] To achieve the above purpose, a first aspect of an embodiment of the present application proposes a network authentication method based on HTML5, the method comprising:
[0006] Obtaining a target service request based on HTML5, and generating a target object corresponding to the target service request, wherein the target object is used to record authentication information of the target service request;
[0007] Generating a target function corresponding to the target service request, wherein the target function is used to modify the authentication information recorded in the target object;
[0008] Obtaining target token information corresponding to the target service request, and calling the target function to modify the authentication information recorded in the target object to a state indicating successful authentication;
[0009] The target service request is authenticated based on the authentication information, and target service data is acquired according to the target service request.
[0010] In some embodiments, generating a target function corresponding to the target service request includes:
[0011] Determining target parameters of the target service request;
[0012] Generate an intermediate request function corresponding to the target business request, where input parameters of the intermediate request function include the target parameter;
[0013] The intermediate request function is configured as an input parameter of the target function.
[0014] In some embodiments, the number of the target service requests is multiple, and the acquiring of the target token information corresponding to the target service request and calling the target function to modify the authentication information recorded in the target object to a state indicating successful authentication include:
[0015] When the state representation of the token acquisition interface is occupied, writing the target function into the function pool;
[0016] When the status representation interface of the token acquisition interface is available, the target token information is obtained through the token acquisition interface, and the target token information is input into the function pool, triggering each of the target functions in the function pool, and modifying the authentication information recorded in the corresponding target object to a status representing successful authentication.
[0017] In some embodiments, the acquiring target token information through the token acquisition interface includes:
[0018] When the acquisition of the target token information fails, the occupied state of the token acquisition interface is maintained, and the target function of the newly initiated target service request is added to the function pool;
[0019] Re-initiate the acquisition of the target token information to the token acquisition interface.
[0020] In some embodiments, when the token acquisition interface is a remote interface, acquiring target token information through the token acquisition interface includes:
[0021] Generate a target identifier corresponding to the function pool;
[0022] The target token information is acquired from the token acquisition interface according to the target identifier.
[0023] In some embodiments, after acquiring the target token information corresponding to the target service request, the method further includes:
[0024] Determine the target token information as local token information and save it to local storage;
[0025] The available status of the local token information is updated in real time according to the validity period of the local token information.
[0026] In some embodiments, the obtaining of target token information corresponding to the target service request includes:
[0027] Determining an availability status of the local token information in the local storage;
[0028] When the local token information is available, the local token information is determined as the target token information.
[0029] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a network authentication device based on HTML5, the device comprising:
[0030] An object generation module, used to obtain a target service request based on HTML5, and generate a target object corresponding to the target service request, wherein the target object is used to record authentication information of the target service request;
[0031] A function generation module, used to generate a target function corresponding to the target service request, wherein the target function is used to modify the authentication information recorded in the target object;
[0032] A token acquisition module, used to acquire target token information corresponding to a target service request, and call the target function to modify the authentication information recorded in the target object to a state indicating successful authentication;
[0033] An authentication module is used to authenticate the target service request based on the authentication information and obtain target service data according to the target service request.
[0034] To achieve the above objectives, a third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0035] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium, and the storage medium stores a computer program. When the computer program is executed by a processor, the method described in the first aspect is implemented.
[0036] The HTML5-based network authentication method, device, equipment, and storage medium proposed in this application include: obtaining a target service request based on HTML5, generating a target object corresponding to the target service request, the target object is used to record the authentication information of the target service request; generating a target function corresponding to the target service request, the target function is used to modify the authentication information recorded in the target object; obtaining the target token information corresponding to the target service request, calling the target function to modify the authentication information recorded in the target object to a state representing successful authentication; authenticating the target service request based on the authentication information, and obtaining the target service data according to the target service request. According to the technical solution of this embodiment, the dynamic target token information can be replaced by static authentication information, so that the target service request can maintain authority when obtaining the target service data, improve the stability of the authentication information, and effectively improve the efficiency of obtaining the target service data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of a network authentication method based on HTML5 provided by an embodiment of the present application;
[0038] Figure 2 yes Figure 1 Flow chart of step S102 in FIG.
[0039] Figure 3 yes Figure 1 Flow chart of step S103 in FIG.
[0040] Figure 4 yes Figure 3 Flow chart of step S302 in FIG.
[0041] Figure 5 yes Figure 3 Flow chart of step S302 in FIG.
[0042] Figure 6 yes Figure 1 Flow chart of step S103 in FIG.
[0043] Figure 7 yes Figure 1 Flow chart of step S103 in FIG.
[0044] Figure 8 It is a schematic diagram of the structure of a network authentication device based on HTML5 provided in an embodiment of the present application;
[0045] Fig. 9 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0049] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with the relevant laws, regulations, and standards of the relevant countries and regions. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0050] First, some nouns involved in this application are analyzed:
[0051] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robots, language recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0052] Token: Token or invitation code.
[0053] HTML5: HTML5 is the specification of the core language (Hypertext Markup Language) in the World Wide Web.
[0054] Promise object: The promise object is an asynchronous programming solution in JavaScript, which can solve the callback region problem in the callback function solution. This object has two characteristics: 1. The state of the object is not affected by the outside world. 2. Once the state changes, it will not change again, and the result can be obtained at any time. In addition, it includes states such as in progress, successful, and failed, and functions such as resolve and reject. The function of the resolve function is to change the in progress state to the successful state.
[0055] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0056] It should be noted that the data of the embodiments of the present invention can be stored in a server. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0057] Based on this, the embodiments of the present application provide a network authentication method, apparatus, device, and storage medium based on HTML5, which aims to ensure the stability of authentication information of business requests and improve the reliability of business data acquisition.
[0058] The HTML5-based network authentication method, apparatus, device, and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the HTML5-based network authentication method in the embodiments of the present application is described.
[0059] The HTML5-based network authentication method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The HTML5-based network authentication method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or can be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the HTML5-based network authentication method, etc., but is not limited to the above forms.
[0060] Figure 1 This is an optional process of the HTML5-based network authentication method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S104.
[0061] Step S101, obtaining a target service request based on HTML5, generating a target object corresponding to the target service request, the target object being used to record authentication information of the target service request;
[0062] Step S102, generating a target function corresponding to the target service request, the target function being used to modify the authentication information recorded in the target object;
[0063] Step S103, obtaining target token information corresponding to the target service request, and calling the target function to modify the authentication information recorded in the target object to a state indicating successful authentication;
[0064] Step S104: authenticating the target service request based on the authentication information, and acquiring target service data according to the target service request.
[0065] It should be noted that the target business request based on HTML5 can be initiated through a client such as an APP of a smart terminal, and the target business data can be obtained from the local system or from an external system such as a server. This embodiment does not limit the specific ownership of the target business data.
[0066] It is worth noting that the target business request can be used to obtain one or more parameters, attributes, data, etc., and can also be used to obtain the output result obtained after executing a target function. This embodiment does not limit the specific method of obtaining the target business data corresponding to the target business request, and it can be obtained through HTML5 business.
[0067] In the related art, APP or client obtains target business data and obtains business data by calling native network requests. However, this will cause the target business request of HTML5 to rely strongly on the native implementation. For example, if other external clients or APP obtain target business data through target business requests, the external client or APP needs to implement operations such as token acquisition and network sending, thereby bringing unnecessary business coupling and development costs. In addition, if the target business request is sent between different system platforms, the business that depends on the native network cannot be used. On this basis, HTML5 is usually implemented through JavaScript. If multiple business requests are initiated at the same time, it will lead to multiple calls to obtain the token interface. On the one hand, there will be a problem of frequent token coverage, resulting in unnecessary network requests and wasting network resources. On the other hand, it is very likely that the first business request has just obtained the token, and then when the business request is sent, the back end has not yet processed it. The second business request initiates the acquisition of the token and then sends the business request. The back end receives two business requests, but the token of the first business request has expired and failed to verify, resulting in the failure of the first business request.
[0068] Based on this, after obtaining the target business request, this embodiment generates a target object corresponding to the target business request, records the authentication information of the target business request through the target object, and converts the authentication information from a dynamic token into static object information. The target object can use the Promise object in JavaScript, and use the fact that the state of the Promise object will not be affected by the outside world and the characteristics of maintaining after the state change as a guarantee of reliability. When the target business request is obtained, a Promise object corresponding to the target business request is generated, and the initial state is set to "in progress". When the target token information is obtained, the target function is triggered to switch the state of the Promise object to "completed", and the "completed" state cannot be changed. The state of the Promise object is used as the authentication information of the target business request. In the subsequent process of obtaining the target business data, when authentication is required, the state of the Promise object is identified as "completed", which means that the target business request has completed the authentication, and the target business data can be obtained. The state of the se object is static information and does not have an expiration date. Therefore, it can effectively solve the defect of data acquisition failure caused by the expiration of the target token information when authentication is performed through dynamic target token information.
[0069] It should be noted that when the target object is a Promise object, the target function can be a resolve function, which can be used to modify the state of the Promise object. In order to ensure that the state of the Promise object is modified at the right time, the resolve function can take the target token information of the target business request as an input parameter, that is, the resolve function is triggered after the target token information is obtained. It is worth noting that taking the target token information as an input parameter does not require obtaining a specific token, but only requires successfully obtaining the token corresponding to the target business request.
[0070] According to step S101 to step S104 of this embodiment, a target service request based on HTML5 is obtained, a target object corresponding to the target service request is generated, and the target object is used to record the authentication information of the target service request; a target function corresponding to the target service request is generated, and the target function is used to modify the authentication information recorded in the target object; the target token information corresponding to the target service request is obtained, and the target function is called to modify the authentication information recorded in the target object to a state representing successful authentication; the target service request is authenticated based on the authentication information, and the target service data is obtained according to the target service request. According to the technical solution of this embodiment, the dynamic target token information can be replaced by static authentication information, so that the target service request can maintain authority when obtaining the target service data, improve the stability of the authentication information, and effectively improve the efficiency of obtaining the target service data.
[0071] In addition, in one embodiment, referring to Figure 2 , Figure 1 Step S102 of the illustrated embodiment also includes but is not limited to the following steps:
[0072] Step S201, determining target parameters of a target service request;
[0073] Step S202, generating an intermediate request function corresponding to the target business request, the input parameters of the intermediate request function including the target parameters;
[0074] Step S203: configure the intermediate request function as an input parameter of the target function.
[0075] It should be noted that there are usually a large number of target business requests based on HTML5. In order to distinguish different requests, the target business requests can be distinguished by target parameters. The target parameters can be the identification information corresponding to the current target business request, which is used to identify different target business requests, so that after obtaining the target token information, the target function of the corresponding target business request is called for authentication; for example, the target parameter can also be the target business request, such as the specific data of the target business data that the target business request needs to obtain, which can distinguish different target business requests.
[0076] It should be noted that it is worth noting that the intermediate request function can be the Request function in JavaScript, that is, the request function for obtaining business data, and the target parameters and target token information are used as input parameters of the Request function. Since the target parameters can be determined after obtaining the target business request, when the target token information is obtained, the triggering of the Request function can be completed, thereby triggering the target function to modify the authentication information recorded in the target object.
[0077] In addition, in one embodiment, the number of target service requests is multiple, refer to Figure 3 , Figure 1 Step S103 of the illustrated embodiment also includes but is not limited to the following steps:
[0078] Step S301, when the state representation of the token acquisition interface is occupied, write the target function into the function pool;
[0079] Step S302, when the status representation interface of the token acquisition interface is available, the target token information is obtained through the token acquisition interface, and the target token information is input into the function pool, each target function in the function pool is triggered, and the authentication information recorded in the corresponding target object is modified to a status representing successful authentication.
[0080] It should be noted that due to the large number of target business requests, if token information is allocated for each target business request, it will cause repeated overwriting of tokens, resulting in failure of the business request. Based on this, this embodiment sets up a function pool. When the token acquisition interface is occupied, that is, there is a target business request applying for target token information, the corresponding target function can be written into the function pool. After obtaining the target token information, all target functions in the function pool are traversed to trigger them to modify the authentication information of the corresponding target business request, thereby realizing the authentication of multiple target business requests with one token information, thereby improving the efficiency of obtaining authentication information.
[0081] Exemplarily, when the target business request 1 is obtained, if the token acquisition interface is available, the target token information is obtained and the target function is triggered to complete the acquisition of authentication information; if the token acquisition interface is occupied by the target business request 2, the target function 1 of the target business request 1 is written into the function pool. At this time, the function pool includes the target function 1 and the target function 2 corresponding to the target business request 2. When the target business request 2 successfully obtains the target token information, the target token information is input into the function pool, and the target function 2 and the target function 1 are triggered by traversing, thereby simultaneously modifying the Promi se object corresponding to the target business request 1 and the Promi se object corresponding to the target business request 2, and completing the authentication of the target business request 1 and the target business request 2.
[0082] In addition, in one embodiment, referring to Figure 4 , Figure 3 Step S302 of the illustrated embodiment also includes but is not limited to the following steps:
[0083] Step S401, when the acquisition of target token information fails, the occupied state of the token acquisition interface is maintained, and the target function of the newly initiated target service request is added to the function pool;
[0084] Step S402: Re-initiate acquisition of target token information from the token acquisition interface.
[0085] It should be noted that, according to the description of the above embodiment, obtaining the target token information once can call all the target functions in the function pool, thereby realizing batch authentication. Therefore, when the target business request that is occupying the token acquisition interface fails to obtain the target token information, the occupied state of the interface can be maintained, and the newly added target business request can continue to add the target function to the function pool. When the target token information is retried successfully, batch authentication is performed according to the steps of the above embodiment.
[0086] It should be noted that in order to improve the efficiency of obtaining the target token information, the number of retries can also be set. For example, if the target business request 1 fails to obtain the target token information and still fails after retrying once, the acquisition of the target token information through the target business request is stopped, and the target token information is acquired through the target business request 2. Since the target function corresponding to the target business request 1 is stored in the function pool, after the target token information is obtained through the target business request 2, the target business request 1 is still authenticated, thereby improving the reliability and flexibility of business request authentication.
[0087] In addition, in one embodiment, when the token acquisition interface is a remote interface, refer to Figure 5 , Figure 3 Step S302 of the illustrated embodiment also includes but is not limited to the following steps:
[0088] Step S501, generating a target identifier corresponding to the function pool;
[0089] Step S502: acquiring target token information from a token acquisition interface according to the target identifier.
[0090] It should be noted that the target token information can be obtained not only locally, but also from the outside. For example, an APP installed in a mobile device obtains data from a remote server. As for the remote end, since there are many access devices, it is necessary to assign identification information to the access devices to ensure the correct distribution of the target token information. Based on this, this embodiment can generate a target identifier for the function pool, so that the obtained target token information can correspond to a specific function pool, and then be input into the function pool after successful acquisition to trigger each target function.
[0091] In addition, in one embodiment, referring to Figure 6 After executing Figure 1 After step S103 in the illustrated embodiment, the following steps are also included but not limited to:
[0092] Step S601, determining the target token information as local token information and saving it to local storage;
[0093] Step S602: updating the available status of the local token information in real time according to the validity period of the local token information.
[0094] It should be noted that after the client or APP obtains the target token information, it can be determined that the client or APP has the authority to obtain business data. Therefore, in order to avoid repeated acquisition of token information, the target token information can be saved locally as local token information, and try to update the available status according to its validity period. When the target token information needs to be obtained next time, if the local token information is available, the process of applying for token information from a remote end can be omitted, thereby improving authentication efficiency.
[0095] In addition, in one embodiment, referring to Figure 7 , Figure 1 Step S103 of the illustrated embodiment also includes but is not limited to the following steps:
[0096] Step S701, determining the availability status of local token information in local storage;
[0097] Step S702: When the local token information is available, the local token information is determined as the target token information.
[0098] It should be noted that each app can first check whether the local one is valid.
[0099] It should be noted that, according to the description of the above embodiment, since the target token information is saved locally as local token information each time it is obtained, after the target business request is obtained, authentication can be performed based on the validity of the local token information. When the local token information is valid, the local token information can be used directly to trigger the target function, eliminating the process of obtaining the target token information. When the local token information is invalid, the new target token information can be re-acquired according to the description of the above embodiment, and no further details will be given here.
[0100] See also Figure 8 The embodiment of the present application further provides a network authentication device based on HTML5, which can implement the above-mentioned network authentication method based on HTML5. The network authentication device based on HTML5 800 includes:
[0101] The object generation module 801 is used to obtain a target service request based on HTML5 and generate a target object corresponding to the target service request, where the target object is used to record the authentication information of the target service request;
[0102] Function generation module 802, used to generate a target function corresponding to the target service request, the target function is used to modify the authentication information recorded in the target object;
[0103] The token acquisition module 803 is used to acquire the target token information corresponding to the target service request, and call the target function to modify the authentication information recorded in the target object to a state indicating successful authentication;
[0104] The authentication module 804 is used to authenticate the target service request based on the authentication information and obtain the target service data according to the target service request.
[0105] The specific implementation of the HTML5-based network authentication device is basically the same as the specific implementation of the HTML5-based network authentication method described above, and will not be repeated here.
[0106] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned HTML5-based network authentication method when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0107] See also Fig. 9 , Fig. 9 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0108] The processor 901 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0109] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the HTML5-based network authentication method of the embodiment of this application;
[0110] Input / output interface 903, used to implement information input and output;
[0111] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized through wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WI FI, Bluetooth, etc.);
[0112] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);
[0113] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .
[0114] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned HTML5-based network authentication method is implemented.
[0115] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0116] The HTML5-based network authentication method, device, equipment, and storage medium provided in the embodiment of the present application obtain a target service request based on HTML5, generate a target object corresponding to the target service request, and the target object is used to record the authentication information of the target service request; generate a target function corresponding to the target service request, and the target function is used to modify the authentication information recorded in the target object; obtain the target token information corresponding to the target service request, and call the target function to modify the authentication information recorded in the target object to a state representing successful authentication; authenticate the target service request based on the authentication information, and obtain the target service data according to the target service request. According to the technical solution of this embodiment, the dynamic target token information can be replaced by static authentication information, so that the target service request can maintain authority when obtaining the target service data, improve the stability of the authentication information, and effectively improve the efficiency of obtaining the target service data.
[0117] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0118] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0119] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0120] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above and the functional modules / units in the system electronic devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0121] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0122] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0123] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0124] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0125] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0126] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0127] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation method of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing electronic device (which can be a personal computer, a server, a touch terminal, or a network electronic device, etc.) to execute the method according to the implementation method of the present application.
[0128] The electronic device of this embodiment may include: a radio frequency (RF) circuit, a memory, an input unit, a display unit, a sensor, an audio circuit, a wireless fidelity (Wi Fi) module, a processor, and a power supply. The RF circuit can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is sent to the processor for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the RF circuit can also communicate with the network and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc. The memory can be used to store software programs and modules, and the processor executes various functional applications and data processing of the electronic device by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The input unit may be used to receive input digital or character information, and to generate key signal inputs related to the settings and function control of the electronic device. Specifically, the input unit may include a touch panel and other input devices. A touch panel, also known as a touch screen, can collect touch operations on or near it (such as operations on or near the touch panel using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program.Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the touch position, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact coordinates, and then sends it to the processor, and can receive the command sent by the processor and execute it. In addition, the touch panel can be implemented in various categories such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel, the input unit can also include other input devices. Specifically, other input devices can include but are not limited to one or more of a physical keyboard, a function key (such as a volume control button, a switch button, etc.), a trackball, a mouse, a joystick, etc. The display unit can be used to display the input information or the information provided and various menus of the electronic device. The display unit may include a display panel, and optionally, a liquid crystal display (LCD), an organic light emitting diode (OLED), etc. can be used to configure the display panel. Furthermore, the touch panel may cover the display panel, and when the touch panel detects a touch operation on or near it, it is transmitted to the processor to determine the category of the touch event, and then the processor provides a corresponding visual output on the display panel according to the category of the touch event. The touch panel and the display panel are two independent components to realize the input and output functions of the electronic device, but in some embodiments, the touch panel and the display panel can be integrated to realize the input and output functions of the electronic device. The electronic device may also include at least one sensor, such as a light sensor, a motion sensor and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor can turn off the display panel and / or backlight when the electronic device is moved to the ear. As a kind of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of electronic devices (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that electronic devices can also be equipped with, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here. Audio circuits, speakers, and microphones can provide audio interfaces. The audio circuit can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal output by the speaker; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit and converted into audio data, and then the audio data is output to the processor for processing, and then sent to another electronic device through the RF circuit, or the audio data is output to the memory for further processing.The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0129] It should be noted that, although several modules or units of the electronic device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0130] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0131] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
[0132] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A network authentication method based on HTML5, characterized in that: The method comprises: Obtaining a target service request based on HTML5, and generating a target object corresponding to the target service request, wherein the target object is used to record authentication information of the target service request; Generating a target function corresponding to the target service request, wherein the target function is used to modify the authentication information recorded in the target object; Obtaining target token information corresponding to the target service request, and calling the target function to modify the authentication information recorded in the target object to a state indicating successful authentication; The target service request is authenticated based on the authentication information, and target service data is acquired according to the target service request.
2. According to the HTML5-based network authentication method of claim 1, it is characterized in that: The generating of the target function corresponding to the target service request includes: Determining target parameters of the target service request; Generate an intermediate request function corresponding to the target business request, where input parameters of the intermediate request function include the target parameter; The intermediate request function is configured as an input parameter of the target function.
3. The HTML5-based network authentication method according to claim 1, characterized in that: The number of the target service requests is multiple, and the acquiring of the target token information corresponding to the target service request and the calling of the target function to modify the authentication information recorded in the target object to a state indicating successful authentication include: When the state representation of the token acquisition interface is occupied, writing the target function into the function pool; When the status representation interface of the token acquisition interface is available, the target token information is obtained through the token acquisition interface, and the target token information is input into the function pool, triggering each of the target functions in the function pool, and modifying the authentication information recorded in the corresponding target object to a status representing successful authentication.
4. The HTML5-based network authentication method according to claim 3, characterized in that: The step of obtaining target token information through the token acquisition interface includes: When the acquisition of the target token information fails, the occupied state of the token acquisition interface is maintained, and the target function of the newly initiated target service request is added to the function pool; Re-initiate the acquisition of the target token information to the token acquisition interface.
5. The HTML5-based network authentication method according to claim 3, characterized in that: When the token acquisition interface is a remote interface, acquiring target token information through the token acquisition interface includes: Generate a target identifier corresponding to the function pool; The target token information is acquired from the token acquisition interface according to the target identifier.
6. The HTML5-based network authentication method according to claim 1, characterized in that: After acquiring the target token information corresponding to the target service request, the method further includes: Determine the target token information as local token information and save it to local storage; The available status of the local token information is updated in real time according to the validity period of the local token information.
7. The HTML5-based network authentication method according to claim 6, characterized in that: The obtaining of target token information corresponding to the target service request includes: Determining an availability status of the local token information in the local storage; When the local token information is available, the local token information is determined as the target token information.
8. A network authentication device based on HTML5, characterized in that: The device comprises: An object generation module, used to obtain a target service request based on HTML5, and generate a target object corresponding to the target service request, wherein the target object is used to record authentication information of the target service request; A function generation module, used to generate a target function corresponding to the target service request, wherein the target function is used to modify the authentication information recorded in the target object; A token acquisition module, used to acquire target token information corresponding to a target service request, and call the target function to modify the authentication information recorded in the target object to a state indicating successful authentication; An authentication module is used to authenticate the target service request based on the authentication information and obtain target service data according to the target service request.
9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the HTML5-based network authentication method described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the HTML5-based network authentication method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Authorization authentication system and method
CN111988318A
Authorization server, authentication cooperation system, and storage medium storing program
US20170163636A1