A method, device, electronic device and storage medium for requesting signature
By automatically obtaining and matching the signature behavior of browser request methods, the browser request signature is automated, and the problem of time-consuming, labor-intensive and inconvenient signatures in the existing technology is solved, and the development efficiency and consistency are improved.
Patent Information
- Application Number
- CN202110927910.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-11
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-08-11
AI Technical Summary
In the prior art, request methods for different browsers require manual addition of digital encrypted signatures, which makes the signature process time-consuming and laborious, and different developers may define different signature methods, which leads to inconvenience in subsequent maintenance and repeated development.
By obtaining the target request sent by the user terminal, the target signature behavior that matches the target request method based on the pre-stored alternative signature behavior, and inject it into the request header, realizing the automatic signature process and adapting to the signature behavior of different request methods .
The signature process can be completed without manual operations, saving time and human resources, ensuring that the signature behavior of the same request method is consistent, and facilitating subsequent maintenance and repeated development.
Smart Images

Figure CN113660096B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a signature request method, device, electronic device and storage medium. Background Art
[0002] In order to ensure data security and convenient transmission of system data during the request exchange process, the request needs to be signed and the signature is sent together with the request as an additional parameter to prevent illegal requests.
[0003] In the prior art, different browsers have different request methods, including Ajax (Asynchronous Javascript And XML) method and fetch method, etc. In the prior art, when adding a digitally encrypted request signature, the developer needs to manually add the signature according to the request method of the currently used browser.
[0004] However, the manual signing method makes the signing process time-consuming and laborious; and different developers will define different signing methods, which is not conducive to subsequent maintenance and requires repeated development. Summary of the invention
[0005] The embodiments of the present invention provide a signature request method, device, electronic device and storage medium to realize the signature process without manual operation, saving a lot of time and human resources; and, alternative signature behaviors are pre-stored, so that the same request method can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development.
[0006] In a first aspect, an embodiment of the present invention provides a method for requesting a signature, which may include:
[0007] Obtaining a target request sent by a user terminal for requesting a browser;
[0008] Based on the target request mode corresponding to the target request, determining a target signature behavior matching the target request mode from pre-stored candidate signature behaviors;
[0009] A request header is injected into the target request based on the target signing behavior to sign the target request.
[0010] In a second aspect, an embodiment of the present invention further provides a signature requesting device, which may include:
[0011] An acquisition module, used for acquiring a target request sent by a user terminal for requesting a browser;
[0012] A determination module, configured to determine, based on a target request mode corresponding to the target request, a target signature behavior matching the target request mode from pre-stored candidate signature behaviors;
[0013] A signature module is used to inject a request header into the target request based on the target signature behavior to sign the target request.
[0014] In a third aspect, an embodiment of the present invention further provides an electronic device, which may include:
[0015] one or more processors;
[0016] A memory for storing one or more programs;
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the signature request method provided by any embodiment of the present invention.
[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the signature request method provided by any embodiment of the present invention is implemented.
[0019] A request signature method provided by an embodiment of the present invention obtains a target request sent by a user terminal for requesting a browser; based on a target request mode corresponding to the target request, a target signature behavior matching the target request mode is determined in pre-stored alternative signature behaviors, and by pre-storing alternative signature behaviors, corresponding signature behaviors can be adapted to requests of different request modes; based on the target signature behavior, a request header is injected into the target request to sign the target request. It can be seen that the signing process does not require manual operation, saving a lot of time and human resources; and, if alternative signature behaviors are pre-stored, the same request mode can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development.
[0020] In addition, a signature requesting device, electronic device and storage medium provided by the present invention correspond to the above method and have the same beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 A flowchart of a signature request method provided by an embodiment of the present invention;
[0023] Figure 2 A flowchart of another method for requesting a signature provided by an embodiment of the present invention;
[0024] Figure 3 A flowchart of a method for requesting a signature in an application scenario provided by an embodiment of the present invention;
[0025] Figure 4 A structural diagram of a signature requesting device provided by an embodiment of the present invention;
[0026] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. It is understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for the convenience of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0028] The core of the present invention is to provide a method, device, electronic device and storage medium for requesting a signature, so as to realize the signature process without manual operation, saving a lot of time and human resources; and, by pre-storing alternative signature behaviors, the same request method can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development. In order to enable personnel in the technical field to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0029] Embodiment 1
[0030] Figure 1 A flowchart of a signature request method provided by an embodiment of the present invention. The method can be executed by a signature request device provided by an embodiment of the present invention, which can be implemented by software and / or hardware, and can be integrated in various user terminals or servers.
[0031] like Figure 1 As shown, the method of the embodiment of the present invention specifically includes the following steps:
[0032] S101: Obtain a target request sent by a user terminal for requesting a browser.
[0033] Optionally, when a target request for requesting a browser sent by a user terminal is detected, the target request is obtained. Specifically, the request sent by a designated user terminal may be determined as the target request, or each received request may be determined as the target request.
[0034] Further, based on the request content of the request, it can be determined whether the request is a target request to be obtained, and if so, the request is obtained. Further, based on the request mode of the request sent by the user terminal, it can be determined whether the request mode is a preset request mode, and if so, it indicates that the request is a target request.
[0035] S102: Based on the target request mode corresponding to the target request, determine a target signature behavior that matches the target request mode from pre-stored candidate signature behaviors.
[0036] Specifically, different browsers have different request modes, and the request modes include at least one of an Ajax mode and a fetch mode. Based on the target request, the target request mode used when the target request accesses the browser can be determined. Exemplarily, the target request mode of the target request is determined based on the data structure of the target request.
[0037] Optionally, different request methods need to correspond to different signature behaviors to complete the signing operation of the request. It should be noted that the signature behavior is a way to insert a request header into the request. For different request methods, the way to insert the request header when signing is also different.
[0038] In a specific implementation, at least one alternative signature behavior may be pre-stored for different request methods. For example, a signature behavior corresponding to the Ajax method and a signature behavior corresponding to the fetch method may be pre-stored as alternative signature behaviors.
[0039] Exemplarily, for the same request method, a corresponding alternative signature behavior can be pre-stored; or two or more alternative signature behaviors can be pre-stored for the same request method based on the request content, request terminal and request browser. Those skilled in the art can set it according to the actual application situation, and the embodiments of the present invention are not limited to this.
[0040] Specifically, based on the target request mode corresponding to the determined target request, a target signature behavior corresponding to the target request mode can be determined from various pre-stored alternative signature behaviors, and the signing operation of the target request can be completed through the target signature behavior.
[0041] Furthermore, the correspondence between each candidate signature behavior and each request method can be preset. When the target request method is determined, the candidate signature behavior corresponding to the request method consistent with the target request method can be determined based on the correspondence between the candidate signature behavior and each request method, and the candidate signature behavior can be determined as the target signature behavior.
[0042] S103. Inject a request header into the target request based on the target signature behavior to sign the target request.
[0043] In a specific implementation, the process of signing a request is the process of injecting a request header into the request. The target signature behavior is a method of injecting a request header into the target request. The target request can be injected into the request header according to the determined target signature behavior, thereby completing the operation of signing the target request.
[0044] A request signature method provided by an embodiment of the present invention obtains a target request sent by a user terminal for requesting a browser; based on a target request mode corresponding to the target request, a target signature behavior matching the target request mode is determined in pre-stored alternative signature behaviors, and by pre-storing alternative signature behaviors, corresponding signature behaviors can be adapted to requests of different request modes; based on the target signature behavior, a request header is injected into the target request to sign the target request. It can be seen that the signing process does not require manual operation, saving a lot of time and human resources; and, if alternative signature behaviors are pre-stored, the same request mode can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development.
[0045] Embodiment 2
[0046] Figure 2 A flowchart of another request signature method provided by an embodiment of the present invention. This embodiment is optimized based on the above-mentioned technical solutions. Optionally, obtaining a target request sent by a user terminal for requesting a browser includes: monitoring the access request of the browser's access attribute definition interface, determining whether the request method for initiating the access request is a preset request method; if it is a preset request method, intercepting the access request, and determining the access request as a target request. Optionally, injecting a request header into the target request based on the target signature behavior to sign the target request includes: determining the signing time of the target request; generating a request header corresponding to the target request based on the request information, target signature behavior, signing time, preset encryption algorithm and attribute information of the user terminal of the target request; injecting the request header into the target request to sign the target request. Optionally, based on the target request method corresponding to the target request, determining a target signature behavior that matches the target request method in the pre-stored alternative signature behaviors, including: determining the request method identifier of the target request method; determining the alternative signature behavior that matches the request method identifier in the signature identifiers of each alternative signature behavior; and determining the matching alternative signature behavior as the target signature behavior. The explanations of the terms that are the same as or corresponding to the above embodiments are not repeated here.
[0047] like Figure 2 As shown, the method of the embodiment of the present invention specifically includes the following steps:
[0048] S201. Listen to the access request of the access attribute definition interface of the browser, and determine whether the request method for initiating the access request is a preset request method; if it is the preset request method, enter S202.
[0049] In a specific implementation, the access attribute definition interface of the browser may be monitored, and the access attribute definition interface includes the Object.defineProperty interface. When the access attribute definition interface of the browser is monitored to receive an access request, the request mode of the access request is determined.
[0050] Furthermore, the request method corresponding to the alternative signature behavior can be determined in advance, and the request method can be determined as the preset request method. When the request method of the currently monitored access request is determined, the request method is compared with each preset request method to determine whether the request method is the preset request method. If so, it means that the current access request can be signed by the alternative signature behavior.
[0051] Furthermore, if it is not a preset request method, a prompt message including the request method of the access request is generated and recorded in the system log. The prompt message can be used to indicate that there is currently no signature behavior corresponding to the request method, so that the operation and maintenance personnel can add an alternative signature behavior corresponding to the request method.
[0052] S202: Intercept the access request and determine the access request as a target request.
[0053] Specifically, if the request method of the access request is a preset request method, the access request can be intercepted and determined as a target request. The target signature behavior corresponding to the target request method of the target request is determined from the pre-stored alternative signature behaviors to complete the signing of the target request.
[0054] S203, determining a request method identifier of a target request method; determining an alternative signature behavior that matches the request method identifier from signature identifiers of each alternative signature behavior; and determining the matching alternative signature behavior as a target signature behavior.
[0055] Optionally, determine the target request mode of the target request and the request mode identifier of the target request mode. Specifically, the request mode identifier can be set for different request modes. Accordingly, the signature identifier can be set in advance for each candidate signature behavior. Exemplarily, the request mode identifier of the request mode is set in advance, and the signature identifier of the signature behavior matching the request mode is set to be the same as the request mode identifier.
[0056] It should be noted that there is a corresponding relationship between the request method identifier and the signature identifier. The corresponding signature identifier can be determined through the request method identifier, thereby further determining the signature behavior corresponding to the request method of the request method identifier. Specifically, the signature identifier that matches the request method identifier is determined from the signature identifiers of the candidate signature behaviors, and the candidate signature behavior corresponding to the matching signature identifier is determined as the target signature behavior.
[0057] S204, determining the signing time of the target request; generating a request header corresponding to the target request based on the request information of the target request, the target signing behavior, the signing time, the preset encryption algorithm and the attribute information of the user terminal.
[0058] Optionally, determining the signing time of the target request includes: obtaining the standard time for initiating the target request based on a standard timing interface; obtaining the local time for initiating the target request, and determining whether the standard time is consistent with the local time; if not, determining the standard time as the signing time of the target request.
[0059] Specifically, the signing time includes the time when the target request is initiated. The signing time can be based on the local time. When there is an error in the local time, the signing time must be based on the standard time obtained from the standard timing interface.
[0060] Furthermore, if the standard time is inconsistent with the local time, the local time is corrected to the standard time, and the correction process is recorded in the system log to facilitate subsequent operation and maintenance personnel to view and trace.
[0061] S205. Inject the request header into the target request to sign the target request.
[0062] In a specific implementation, a request header of a target request can be generated based on a preset encryption algorithm for encryption, and the request header is inserted into the target request according to the target signature behavior to complete the signature of the target request. Optionally, a request header corresponding to the target request is generated based on the request information of the target request, the target signature behavior, the signature time, the SHA256 algorithm, and the attribute information of the user terminal.
[0063] Specifically, the request information includes at least one of a requested service identifier and a requested network address; the attribute information includes at least one of a gateway identifier of a user terminal and a network environment parameter. The service identifier is used to reflect the service type described in the target request.
[0064] The request signature method provided in the embodiment of the present invention can intercept access requests through the access attribute definition interface of the browser, so that the access requests determined as target requests are signed using the alternative signature behavior provided by the present invention; and the signature operation of the target request is completed based on the standard time to prevent signature failure due to inaccurate signature time.
[0065] Embodiment 3
[0066] The above describes in detail the embodiments corresponding to the request signature method. In order to make the technical solution of the method further clear to those skilled in the art, a specific application scenario is given below.
[0067] Figure 3 A flowchart of a method for requesting a signature in an application scenario provided by an embodiment of the present invention; Figure 3 As shown, when the user terminal sends a user request, the user request needs to complete the request setting through the Object.defineProperty interface, and the Object.defineProperty interface can hijack the request data of the browser page. In the specific implementation, the Object.defineProperty interface can be monitored to obtain each request to access the Object.defineProperty interface. When the browser's access property definition interface is monitored to receive a user request, the request method of the user request is determined.
[0068] Further, when the request mode of the currently monitored user request is determined, the request mode is compared with the preset request mode corresponding to each candidate signature behavior to determine whether the request mode is the preset request mode. If so, it means that the current user request can be signed through the candidate signature behavior. The user request is intercepted and determined as a target request. The target signature behavior corresponding to the target request mode of the target request is determined from the pre-stored candidate signature behaviors to complete the signing of the target request.
[0069] Specifically, the preset request methods include Ajax method and fetch method. Those skilled in the art may also preset other request methods according to the actual application situation, and this is not limited by the embodiment of the present invention. For example, determine whether the request method of the user request is Ajax method or fetch method. If it is Ajax method, the signature behavior corresponding to the preset Ajax method is determined as the target signature behavior adopted for the user request; if it is fetch method, the signature behavior corresponding to the set fetch method is determined as the target signature behavior adopted for the user request. If it is neither fetch method nor Ajax method, it means that the current alternative signature methods cannot perform the signature operation on the user request, and a prompt message containing the user request can be generated for prompting, so that the operation and maintenance personnel can add and improve the backup signature behavior.
[0070] Optionally, the signature time of the user request can be calibrated with the help of the standard timing interface. Specifically, during initialization, the standard timing interface can be requested to obtain the standard time, and the local time can be calibrated based on the standard time. Furthermore, during initialization, the local time is obtained; the standard time is obtained based on the standard authorization interface, and the local time and the standard time are compared. If the two are consistent, it means that the local time is accurate and can be used directly to sign the user request. If the two are inconsistent, the local time needs to be modified to the standard time, so that the user request is signed based on the standard time to prevent signature failure due to inaccurate signature time.
[0071] Furthermore, a unified request signature algorithm may be used to sign the user request. Exemplarily, the request signature algorithm includes the SHA256 algorithm. A request header of the user request is generated based on the SHA256 algorithm for encryption, and the request header is inserted into the user request according to the signature behavior corresponding to the user request to complete the signature of the target request, and a security request is initiated using the signed user request.
[0072] The request signature method provided in the embodiment of the present invention can intercept access requests through the access attribute definition interface of the browser, so that the access requests determined as target requests are signed using the alternative signature behavior provided by the present invention; and the signature operation of the target request is completed based on the standard time to prevent signature failure due to inaccurate signature time.
[0073] Embodiment 4
[0074] Figure 4 The structure diagram of a signature request device provided in an embodiment of the present invention; the device is used to execute the signature request method provided in any of the above embodiments. The device and the signature request method of the above embodiments belong to the same inventive concept. For details not described in detail in the signature request device embodiment, please refer to the signature request method embodiment. Figure 4 As shown, the device may specifically include:
[0075] The acquisition module 10 is used to acquire the target request sent by the user terminal for requesting the browser;
[0076] A determination module 11, configured to determine a target signature behavior matching the target request mode from pre-stored candidate signature behaviors based on the target request mode corresponding to the target request;
[0077] The signature module 12 is used to inject a request header into the target request based on the target signature behavior to sign the target request.
[0078] Optionally, the acquisition module 10 includes:
[0079] The monitoring unit is used to monitor the access request of the access attribute definition interface of the browser, determine whether the request method for initiating the access request is a preset request method; if it is the preset request method, intercept the access request and determine the access request as a target request.
[0080] Optionally, the device further comprises:
[0081] The generating module is used for generating prompt information including the request mode of the access request if it is not the preset request mode, and recording the prompt information in the system log.
[0082] Optionally, the signature module 12 includes:
[0083] The injection request header unit is used to determine the signing time of the target request; based on the request information of the target request, the target signing behavior, the signing time, the preset encryption algorithm and the attribute information of the user terminal, the request header corresponding to the target request is generated; the request header is injected into the target request to sign the target request.
[0084] Optionally, inject request headers, including:
[0085] Obtain the signature time unit, which is used to obtain the standard time for initiating the target request based on the standard timing interface; obtain the local time for initiating the target request and determine whether the standard time is consistent with the local time; if not, determine the standard time as the signature time of the target request.
[0086] Optionally, inject request headers, including:
[0087] A request header generation unit is used to generate a request header corresponding to a target request based on the request information of the target request, the target signature behavior, the signature time, the SHA256 algorithm and the attribute information of the user terminal; wherein the request information includes at least one of the requested service identifier and the requested network address; and the attribute information includes at least one of the gateway identifier and the network environment parameters of the user terminal.
[0088] Optionally, the determining module 11 includes:
[0089] A target signature behavior unit is determined, which is used to determine a request method identifier of a target request method; an alternative signature behavior that matches the request method identifier is determined from signature identifiers of various alternative signature behaviors; and the matching alternative signature behavior is determined as a target signature behavior.
[0090] A request signature method provided by an embodiment of the present invention obtains a target request sent by a user terminal for requesting a browser; based on a target request mode corresponding to the target request, a target signature behavior matching the target request mode is determined in pre-stored alternative signature behaviors, and by pre-storing alternative signature behaviors, corresponding signature behaviors can be adapted to requests of different request modes; based on the target signature behavior, a request header is injected into the target request to sign the target request. It can be seen that the signing process does not require manual operation, saving a lot of time and human resources; and, if alternative signature behaviors are pre-stored, the same request mode can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development.
[0091] The signature requesting device provided in the embodiment of the present invention can execute the signature requesting method provided in any embodiment of the present invention.
[0092] It is worth noting that in the embodiment of the above-mentioned request signature device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0093] Embodiment 5
[0094] Figure 5 A structural diagram of an electronic device provided by an embodiment of the present invention. Figure 5 A block diagram of an exemplary electronic device 20 suitable for implementing an embodiment of the present invention is shown. The electronic device 20 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0095] like Figure 5 As shown, the electronic device 20 is in the form of a general computing device. The components of the electronic device 20 may include but are not limited to: one or more processors or processing units 201, a system memory 202, and a bus 203 connecting different system components (including the system memory 202 and the processing unit 201).
[0096] Bus 203 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0097] The electronic device 20 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 20, including volatile and non-volatile media, removable and non-removable media.
[0098] The system memory 202 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 204 and / or cache memory 205. The electronic device 20 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 206 may be used to read and write non-removable, non-volatile magnetic media. A disk drive for reading and writing removable non-volatile disks (such as "floppy disks"), and an optical disk drive for reading and writing removable non-volatile optical disks (such as CD-ROM, DVD-ROM or other optical media) may be provided. In these cases, each drive may be connected to the bus 203 via one or more data medium interfaces. The memory 202 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of various embodiments of the present invention.
[0099] A program / utility 208 having a set (at least one) of program modules 207 may be stored, for example, in the memory 202, such program modules 207 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 207 generally perform the functions and / or methods of the embodiments described herein.
[0100] The electronic device 20 may also communicate with one or more external devices 209 (e.g., keyboards, pointing devices, displays 210, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 20, and / or may communicate with any device that enables the electronic device 20 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 211. Furthermore, the electronic device 20 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 212. As shown, the network adapter 212 communicates with other modules of the electronic device 20 via a bus 203. It should be understood that other hardware and / or software modules may be used in conjunction with the electronic device 20, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0101] The processing unit 201 executes various functional applications and data processing by running programs stored in the system memory 202 .
[0102] An electronic device provided by the present invention can implement the following method: obtain a target request sent by a user terminal for requesting a browser; based on the target request mode corresponding to the target request, determine a target signature behavior that matches the target request mode in pre-stored alternative signature behaviors, and by pre-storing alternative signature behaviors, requests of different request modes can be adapted to corresponding signature behaviors; based on the target signature behavior, inject a request header into the target request to sign the target request. It can be seen that the signing process does not require manual operation, saving a lot of time and human resources; and, if the alternative signature behaviors are pre-stored, the same request mode can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development.
[0103] Embodiment 6
[0104] An embodiment of the present invention provides a storage medium containing computer executable instructions, wherein the computer executable instructions are used to execute a signature request method when executed by a computer processor, the method comprising:
[0105] Obtain the target request sent by the user terminal for requesting the browser; based on the target request method corresponding to the target request, determine the target signature behavior that matches the target request method from the pre-stored alternative signature behaviors. By pre-storing the alternative signature behaviors, requests with different request methods can be adapted to the corresponding signature behaviors; based on the target signature behavior, inject the request header into the target request to sign the target request. It can be seen that the signing process does not require manual operation, saving a lot of time and human resources; and, if the alternative signature behaviors are pre-stored, the same request method can be adapted to a fixed signature behavior, which is convenient for subsequent maintenance and repeated development.
[0106] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided by an embodiment of the present invention are not limited to the method operations described above, and can also execute related operations in the signature request method provided by any embodiment of the present invention.
[0107] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.
[0108] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0109] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0110] Computer program code for performing the operation of embodiments of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0111] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for requesting a signature, characterized in that: include: Obtaining a target request sent by a user terminal for requesting a browser; Determining a target request mode of the target request based on a data structure of the target request; Based on the target request mode corresponding to the target request, determining a target signature behavior matching the target request mode from pre-stored candidate signature behaviors; Injecting a request header into the target request based on the target signing behavior to sign the target request; The injecting a request header into the target request based on the target signature behavior to sign the target request includes: Determining a signing time of the target request; Generate a request header corresponding to the target request based on the request information of the target request, the target signing behavior, the signing time, the preset encryption algorithm and the attribute information of the user terminal; Injecting the request header into the target request to sign the target request; Determining the signing time of the target request includes: Based on the standard timing interface, obtain the standard time for initiating the target request; Obtain the local time when the target request is initiated, and determine whether the standard time is consistent with the local time; If they are inconsistent, the standard time is determined as the signing time of the target request, the local time is corrected to the standard time, and the correction process is recorded in the system log.
2. The method according to claim 1, characterized in that: The step of obtaining a target request sent by a user terminal for requesting a browser includes: Monitoring the access request of the access attribute definition interface of the browser, and determining whether the request mode for initiating the access request is a preset request mode; If it is the preset request mode, the access request is intercepted and the access request is determined as the target request.
3. The method according to claim 2, characterized in that Also includes: If it is not the preset request mode, a prompt message including the request mode of the access request is generated, and the prompt message is recorded in a system log.
4. The method according to claim 1, characterized in that: The generating a request header corresponding to the target request based on the request information of the target request, the target signature behavior, the signature time, the preset encryption algorithm and the attribute information of the user terminal includes: Generate a request header corresponding to the target request based on the request information of the target request, the target signature behavior, the signature time, the SHA256 algorithm and the attribute information of the user terminal; The request information includes at least one of a requested service identifier and a requested network address; and the attribute information includes at least one of a gateway identifier of the user terminal and a network environment parameter.
5. The method according to claim 1, characterized in that The step of determining a target signature behavior matching the target request mode from pre-stored candidate signature behaviors based on the target request mode corresponding to the target request includes: Determine a request method identifier of the target request method; Determine, from the signature identifiers of the candidate signature behaviors, the candidate signature behavior that matches the request method identifier; The matched candidate signature behavior is determined as the target signature behavior.
6. A signature requesting device, characterized in that: include: An acquisition module, used for acquiring a target request sent by a user terminal for requesting a browser; Determining a target request mode of the target request based on a data structure of the target request; A determination module, configured to determine, based on a target request mode corresponding to the target request, a target signature behavior matching the target request mode from pre-stored candidate signature behaviors; A signature module, used for injecting a request header into the target request based on the target signature behavior to sign the target request; The signature modules include: The injection request header unit is used to determine the signing time of the target request; based on the request information of the target request, the target signing behavior, the signing time, the preset encryption algorithm and the attribute information of the user terminal, generate a request header corresponding to the target request; inject the request header into the target request to sign the target request; Inject request header unit, including: Obtain the signature time unit, which is used to obtain the standard time for initiating the target request based on the standard timing interface; obtain the local time for initiating the target request and determine whether the standard time is consistent with the local time; if they are inconsistent, determine the standard time as the signature time of the target request, correct the local time to the standard time, and record the correction process in the system log.
7. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the signature request method as described in any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the signature request method as described in any one of claims 1 to 5 is implemented.
