A non-intrusive service interface legality verification method, system and device

By extracting interface verification logic to public verification services in front-end applications, and using verification services and gateways to achieve interface request forwarding and verification, the invasive problem of microservice interface verification in the existing technology is solved, and non-invasive interfaces are realized Legality verification is suitable for multi-service and multi-interface scenarios, reducing the cost and risks of transformation.

CN116094773BActive Publication Date: 2024-11-01INSPUR TIANYUAN COMM INFORMATION SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211681768.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-26
Publication Date
2024-11-01
Estimated Expiration
2042-12-26

AI Technical Summary

Technical Problem

In the prior art, the legality verification of the resource capability center microservice interface is invasive, and the code logic needs to be modified, resulting in unstable interface services, and new problems are easily generated when there are many services, which violates the development code opening and closing. in principle.

Method used

By extracting interface verification logic to the public verification service in front-end applications, using verification services to realize interface request forwarding and verification, there is no need to intrude into the original service interface code, using the gateway and registration center to achieve interface interception and verification, and verify service verification After passing, forwarding to the specific service interface.

Benefits of technology

It realizes interface legality verification without modifying the original service code logic, reduces the cost of transformation, is suitable for large-scale interface scenarios, and reduces unpredictable problems and time-consuming caused by adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116094773B_ABST
    Figure CN116094773B_ABST
Patent Text Reader

Abstract

The present invention discloses a non-intrusive service interface legality verification method, system and device, which belongs to the field of microservice architecture technology. Based on the interface request of the front-end application, the interface verification logic that needs to be added is extracted into the public verification service, and the interface verification and interface request forwarding are realized through the verification service; the implementation of the method includes adding a verification service and request forwarding, without intruding the original service interface, adding a new interface verification service, and the verification service realizes interface information verification; the gateway forwards the request to the newly added verification service to realize interface interception, and after the verification service verification is completed, the request is forwarded to the gateway, and the service interface that needs to be called is specifically requested through the gateway. The present invention can realize the legality verification of the microservice interface of the resource capability center without intruding the original service interface code logic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of microservice architecture technology, and in particular to a non-intrusive service interface legitimacy verification method, system and device. Background Art

[0002] In the existing technology, the legitimacy check of the microservice interface of the resource capability center is somewhat invasive to the service interface code, which will modify the code implementation logic and re-release the version, resulting in unstable interface service. Modifying the verification logic when many services are involved is likely to cause a large number of new problems, which is not in line with the open and closed principle of development code. Summary of the invention

[0003] The technical task of the present invention is to address the above deficiencies and provide a non-intrusive service interface legitimacy verification method, system and device, which can realize the legitimacy verification of the resource capability center microservice interface without invading the original service interface code logic.

[0004] The technical solution adopted by the present invention to solve its technical problem is:

[0005] A non-intrusive service interface legitimacy verification method, based on the interface request of the front-end application, extracts the interface verification logic that needs to be added into the public verification service, implements interface verification through the verification service, and forwards the interface request;

[0006] The implementation of this method includes adding a new verification service and request forwarding, without intruding the original service interface, adding a new interface verification service, and the verification service implements interface information verification; the gateway forwards the request to the newly added verification service to implement interface interception. After the verification service is completed, the request is forwarded to the gateway, and the gateway requests the specific service interface that needs to be called.

[0007] This method is based on the resource capability center gateway and the microservice architecture registration center. It implements interface legitimacy verification without adjusting the service interface logic code structure requirements, that is, it can implement interface legitimacy verification without intruding into the original service code logic.

[0008] Preferably, the interface request is an http+JSON interface request.

[0009] Preferably, the newly added verification service, i.e., the interface information verification service, implements the interface parameter verification logic according to different service requirements and returns the parameter verification result;

[0010] Register the service to the registry;

[0011] Intercept all received requests in the verification service, and intercept and verify the request input parameters and special interfaces;

[0012] For interfaces that pass the verification, remove the request verification service prefix and forward it to the gateway service again.

[0013] Preferably, the verification service implements universal and personalized service interface verification logic.

[0014] Furthermore, the request forwarding uses nginx to forward the front-end request, modifies the calling service URL in the nginx service configuration, and forwards the request to the new verification service.

[0015] Furthermore, the request forwarding also includes front-end call address modification, adding a new verification service request path based on the original service call address URL.

[0016] Preferably, through this method, the interface call implementation process is as follows:

[0017] 1) The front-end application requests the gateway to forward the request through configuration;

[0018] 2) The verification service receives the interface request, intercepts the request, and verifies the interface information; after the verification passes, the request is forwarded to the gateway service again for implementation;

[0019] 3) The gateway forwards the request to the specific server according to the normal call logic and the registered service information;

[0020] 4) Without changing the service, return data to the front-end application according to the interface request requirements.

[0021] Furthermore, the forwarding request is realized by checking the service name through the front-end configuration; both nginx configuration jump and gateway configuration jump can realize forwarding.

[0022] The present invention also claims to protect a non-intrusive service interface legitimacy verification system, including a front-end application, a gateway service, a verification service and a server, and implements interface legitimacy verification by setting a new verification service module and a request forwarding module.

[0023] A new verification service module is added to non-intrusive original service interfaces, and a new interface verification service is added. The verification service implements interface information verification;

[0024] The request forwarding module implements the gateway forwarding request to the newly added verification service, implements interface interception, and after the verification service is verified, forwards the request to the gateway, and requests the specific service interface to be called through the gateway;

[0025] The system implements the legitimacy verification of the interface input according to the above-mentioned non-intrusive service interface legitimacy verification method.

[0026] The present invention also claims a non-intrusive service interface legitimacy verification device, comprising: at least one memory and at least one processor;

[0027] The at least one memory is used to store a machine-readable program;

[0028] The at least one processor is used to call the machine-readable program to execute the above method.

[0029] Compared with the prior art, the non-intrusive service interface legitimacy verification method, system and device of the present invention have the following beneficial effects:

[0030] Non-intrusive service: It realizes universal and personalized interface verification without modifying the code logic of the interface service that is already running normally.

[0031] Low transformation cost: The newly developed verification logic does not need to pay too much attention to the original interface code logic, but only needs to focus on new business requirements to achieve new business demands.

[0032] Suitable for large quantities of interfaces: This method is suitable for scenarios involving many services and interfaces, reducing unpredictable problems caused by adjustments based on the original code, as well as the problem of difficult to assess the time required for transformation. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a diagram showing the implementation principle of the non-intrusive service interface legitimacy verification method provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0034] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0035] The embodiment of the present invention provides a non-intrusive service interface legitimacy verification method, which extracts the interface verification logic that needs to be added into the public verification service based on the interface request of the front-end application http+JSON, implements interface verification through the verification service, and forwards the interface request;

[0036] The implementation of this method includes adding a new verification service and request forwarding, without intruding the original service interface, adding a new interface verification service, and the verification service implements interface information verification; the gateway forwards the request to the newly added verification service to implement interface interception. After the verification service is completed, the request is forwarded to the gateway, and the gateway requests the specific service interface that needs to be called.

[0037] The newly added verification service, i.e., the interface information verification service, implements the interface parameter verification logic according to different service requirements and returns the parameter verification result;

[0038] Register the service to the registration center; verify the service to achieve universal and personalized service interface verification logic;

[0039] Intercept all received requests in the verification service, and intercept and verify the request input parameters and special interfaces;

[0040] For interfaces that pass the verification, remove the request verification service prefix and forward it to the gateway service again.

[0041] The request forwarding uses nginx to forward the front-end request, modifies the calling service URL in the nginx service configuration, and forwards the request to the new verification service.

[0042] Request forwarding also includes front-end call address modification, adding a new verification service request path based on the original service call address URL.

[0043] like Figure 1 As shown, through this method, the interface call implementation process is as follows:

[0044] 1) The front-end application requests the gateway to forward the request through configuration;

[0045] 2) The verification service receives the interface request, intercepts the request, and verifies the interface information; after the verification passes, the request is forwarded to the gateway service again for implementation;

[0046] 3) The gateway forwards the request to the specific server according to the normal call logic and the registered service information;

[0047] 4) Without changing the service, return data to the front-end application according to the interface request requirements.

[0048] Among them, the forwarding request described in step 1) is realized by checking the service name through the front-end configuration; nginx configuration jump and gateway configuration jump can both realize forwarding.

[0049] This method is based on the resource capability center gateway and the microservice architecture registration center. It implements interface legitimacy verification without adjusting the service interface logic code structure requirements, that is, it can implement interface legitimacy verification without intruding into the original service code logic.

[0050] The embodiment of the present invention also provides a non-intrusive service interface legitimacy verification system, including a front-end application, a gateway service, a verification service and a server, and implements interface legitimacy verification by setting a new verification service module and a request forwarding module.

[0051] A new verification service module is added to non-intrusive original service interfaces, and a new interface verification service is added. The verification service implements interface information verification;

[0052] Add a new verification service, that is, add an interface information verification service, implement the interface parameter verification logic according to different service requirements, and return the parameter verification results; register the service to the registration center; the verification service implements generalized and personalized service interface verification logic;

[0053] The verification service intercepts all received requests, intercepts and verifies the request input parameters and special interfaces; for interfaces that pass the verification, remove the request verification service prefix and forward it to the gateway service again.

[0054] The request forwarding module implements the gateway forwarding request to the newly added verification service, implements interface interception, and after the verification service is verified, forwards the request to the gateway, and requests the specific service interface to be called through the gateway;

[0055] The request forwarding uses nginx to forward the front-end request, modifies the calling service URL in the nginx service configuration, and forwards the request to the new verification service. The front-end calling address is modified, and the new verification service request path is added based on the original service calling address URL.

[0056] The system implements the legitimacy verification of the interface input according to the non-intrusive service interface legitimacy verification method described in the above embodiment.

[0057] The interface call implementation process is as follows:

[0058] 1) The front-end application requests the gateway to forward the request through configuration;

[0059] The forwarding request is realized by checking the service name through the front-end configuration; both nginx configuration jump and gateway configuration jump can realize forwarding;

[0060] 2) The verification service receives the interface request, intercepts the request, and verifies the interface information; after the verification passes, the request is forwarded to the gateway service again for implementation;

[0061] 3) The gateway forwards the request to the specific server according to the normal call logic and the registered service information;

[0062] 4) Without changing the service, return data to the front-end application according to the interface request requirements.

[0063] The embodiment of the present invention also provides a non-intrusive service interface legitimacy verification device, comprising: at least one memory and at least one processor;

[0064] The at least one memory is used to store a machine-readable program;

[0065] The at least one processor is used to call the machine-readable program to execute the non-intrusive service interface legitimacy verification method described in the above embodiment.

[0066] Through the above specific implementations, those skilled in the art can easily implement the present invention. However, it should be understood that the present invention is not limited to the above specific implementations. On the basis of the disclosed implementations, those skilled in the art can arbitrarily combine different technical features to achieve different technical solutions.

[0067] Except for the technical features described in the specification, all other technical features are known technologies to those skilled in the art.

Claims

1. A non-intrusive service interface legitimacy verification method, characterized in that: Based on the interface request of the front-end application, the interface verification logic that needs to be added is extracted to the public verification service, and the interface verification and interface request forwarding are implemented through the verification service; The implementation of this method includes adding a new verification service and request forwarding, without intruding the original service interface, adding a new interface verification service, and the verification service implements interface information verification; the gateway forwards the request to the newly added verification service to implement interface interception, and after the verification service is verified, the request is forwarded to the gateway, and the gateway requests the specific service interface to be called; The newly added verification service, namely the interface information verification service, implements the interface parameter verification logic according to different service requirements and returns the parameter verification results; registers the service to the registration center; intercepts all received requests in the verification service, intercepts and verifies the request input parameters and special interfaces; for the interfaces that pass the verification, removes the request verification service prefix and forwards it to the gateway service again; The interface call implementation process is as follows: 1) The front-end application requests the gateway to forward the request through configuration; 2) The verification service receives the interface request, intercepts the request, and verifies the interface information; After the verification is passed, the request is forwarded to the gateway service implementation again; 3) The gateway forwards the request to the specific server according to the normal calling logic and the registered service information; 4) Without changing the service, return data to the front-end application according to the interface request.

2. A non-intrusive service interface legitimacy verification method according to claim 1, characterized in that: The interface request is an http+JSON interface request.

3. A non-intrusive service interface legitimacy verification method according to claim 1, characterized in that: The verification service implements universal and personalized service interface verification logic.

4. A non-intrusive service interface legitimacy verification method according to claim 1, characterized in that: The request forwarding uses nginx to forward the front-end request, modifies the calling service URL in the nginx service configuration, and forwards the request to the new verification service.

5. A non-intrusive service interface legitimacy verification method according to claim 4, characterized in that: The request forwarding also includes front-end call address modification, adding a new verification service request path based on the original service call address URL.

6. A non-intrusive service interface legitimacy verification method according to claim 1, characterized in that: The forwarding request is realized by checking the service name through the front-end configuration; both nginx configuration jump and gateway configuration jump can realize forwarding.

7. A non-intrusive service interface legitimacy verification system, characterized in that: It includes front-end application, gateway service, verification service and server, and implements interface legitimacy verification by setting up new verification service module and request forwarding module. A new verification service module is added to non-intrusive original service interfaces, and a new interface verification service is added. The verification service implements interface information verification; The request forwarding module implements the gateway forwarding request to the newly added verification service, implements interface interception, and after the verification service is verified, forwards the request to the gateway, and requests the specific service interface to be called through the gateway; The system implements the legitimacy verification of interface input according to the non-intrusive service interface legitimacy verification method described in any one of claims 1 to 6.

8. A non-intrusive service interface legitimacy verification device, characterized in that include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 6.