Information processing method and device

By adding custom annotations to the interfaces between software systems and using sectional programming technology, the problem of high coupling of interface preprocessing operations and business code is solved, and code complexity is reduced and system performance is improved.

CN119806869APending Publication Date: 2025-04-11BEIJING SHANGYIN MICRO CORE TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510006680.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, the interface preprocessing operations between software systems are highly coupled with business code, resulting in increased code complexity and difficulty in maintaining and modifying.

Method used

By adding custom annotations on the interface, the preprocessing operations and business code are separated, and the preprocessing logic is independent using sectional programming technology to avoid interleaving with business logic.

Benefits of technology

Reduces code complexity, improves system performance and maintainability, avoids writing a large number of repeated codes, and simplifies the preprocessing operation of the interface.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806869A_ABST
    Figure CN119806869A_ABST
Patent Text Reader

Abstract

The invention discloses an information processing method, and the method comprises the steps: receiving an access request for a target business interface, and obtaining a user-defined annotation corresponding to the target business interface; and if the value of the target attribute in the user-defined annotation corresponding to the target service interface is the first attribute value, determining that the access request needs to be preprocessed. For different pre-processing, according to a pre-processing sequence, determining indication information corresponding to target pre-processing to be executed currently from the user-defined annotation, if the indication information is a first indication, indicating that the target pre-processing needs to be executed on the access request, and if the indication information is a second indication, executing the target pre-processing on the access request; and performing target preprocessing on the access request based on the user-defined annotation corresponding to the target preprocessing. That is, the interleaving of the preprocessing for the access request and the processing for responding to the access request is avoided by adding the custom annotation on the interface. For different interfaces, if the preprocessing operations corresponding to the interfaces are different, the interfaces are distinguished through user-defined annotations, repeated code writing is not needed, and code redundancy is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to an information processing method and device. Background Art

[0002] During the software development process, a software system may need to exchange data with other software systems. Usually, two software systems exchange data through interfaces. Generally, multiple different interfaces need to be defined between two software systems, and different pre-processing operations such as parameter verification, signature verification, etc. are often required for different interfaces.

[0003] Currently, it is common that the code for preprocessing operations on interfaces is highly coupled with the business code. Modification or update of the preprocessing operations on interfaces may involve modification of multiple business codes, which increases the complexity of the code and makes maintenance and modification difficult. Summary of the invention

[0004] In view of this, an embodiment of the present application provides an information processing method and device to reduce the complexity of code and improve system performance.

[0005] To solve the above problems, the technical solutions provided in the embodiments of the present application are as follows:

[0006] In a first aspect of the present application, an information processing method is provided, the method comprising:

[0007] Receiving an access request for a target business interface and obtaining a custom annotation corresponding to the target business interface, wherein the target business interface provides a business;

[0008] If the value of the target attribute corresponding to the custom annotation is the first attribute value, it is determined that the access request needs to be preprocessed, and the preprocessing includes at least one of parameter verification, security verification, and permission verification;

[0009] For different preprocessing, according to the execution order, determining the indication information corresponding to the target preprocessing to be currently executed from the custom annotation, the indication information indicating whether the target preprocessing needs to be executed on the access request;

[0010] If the indication information is the first indication, the target preprocessing is performed on the access request based on the custom annotation corresponding to the target preprocessing, and the custom annotation corresponding to the target preprocessing indicates the processing logic of the target preprocessing.

[0011] In a second aspect of the present application, an information processing device is provided, the device comprising:

[0012] An acquisition unit, configured to receive an access request for a target business interface and acquire a custom annotation corresponding to the target business interface, wherein the target business interface provides a business;

[0013] a determining unit, configured to determine that the access request needs to be preprocessed if the value of the target attribute corresponding to the custom annotation is the first attribute value, wherein the preprocessing includes at least one of parameter verification, security verification, and permission verification;

[0014] The determining unit is further configured to determine, for different preprocessings, from the custom annotations according to the execution order, indication information corresponding to the target preprocessing to be currently executed, wherein the indication information indicates whether the target preprocessing needs to be executed on the access request;

[0015] A processing unit is used to perform the target preprocessing on the access request based on the custom annotation corresponding to the target preprocessing if the indication information is the first indication, and the custom annotation corresponding to the target preprocessing indicates the processing logic of the target preprocessing.

[0016] In a third aspect of the present application, an electronic device is provided, including: a processor, a memory;

[0017] The memory is used to store computer-readable instructions or computer programs;

[0018] The processor is used to read the computer-readable instructions or the computer program so that the electronic device implements the information processing method described in the first aspect.

[0019] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium. When the instructions are executed on a device, the device executes the information processing method described in the first aspect or the second aspect.

[0020] In a fifth aspect of the present application, a computer program product is provided. When the computer program product is run on a computer, the computer executes the information processing method described in the first aspect.

[0021] It can be seen that the embodiments of the present application have the following beneficial effects:

[0022] In the present application, in order to avoid the preprocessing of access requests and the processing of responding to access requests being intertwined, the preprocessing process is implemented by adding custom annotations to the interface. Specifically, an access request for a target business interface is received, and the custom annotation corresponding to the target business interface is obtained. If the value of the target attribute in the custom annotation corresponding to the target business interface is the first attribute value, it is determined that the access request needs to be preprocessed. For different preprocessing, according to the order of preprocessing, the indication information corresponding to the target preprocessing to be performed is determined from the custom annotation. If the indication information is the first indication, indicating that the target preprocessing needs to be performed on the access request, the target preprocessing is performed on the access request based on the custom annotation corresponding to the target preprocessing. Among them, the custom annotation corresponding to the target preprocessing indicates the processing logic of the target preprocessing. Based on this, for different interfaces, if the corresponding preprocessing operations are different, they can be distinguished by custom annotations, without the need to repeatedly write a large amount of code, reducing system code redundancy and improving system performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 A framework diagram of information processing technology provided for an embodiment of the present application;

[0024] Figure 2 A flow chart of an information processing method provided in an embodiment of the present application;

[0025] Figure 3 A structural diagram of an information processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0027] Currently, in Java software systems, it is necessary to perform preprocessing such as parameter verification, log printing, signature verification, encryption and decryption, and data permission isolation on the interface. Due to business development needs, if you want to modify the specific processing of parameter verification, encryption and decryption methods, or data permission isolation, because the preprocessing logic is intertwined with the business logic, it will involve the modification of multiple business codes, which greatly increases the difficulty and workload of the change. Secondly, if you need to add new business interfaces, you also need to copy a large amount of public processing logic, which leads to code redundancy and extremely poor code readability in the later stages of R&D.

[0028] In addition, since each interface requires hard coding such as different parameter filtering and character encoding, the flexibility is very low and does not conform to the design concept of aspect-oriented programming.

[0029] Based on this, the present application provides an information processing method, which uses custom annotations and aspect programming to implement the above-mentioned preprocessing operations, which are isolated from the business code. If the preprocessing operations need to be updated later, the business code will not be involved, thereby improving the maintainability of the code.

[0030] Predefined annotations refer to annotations that have been defined in the Java language and can be used directly.

[0031] Custom annotations are annotations defined by developers themselves, and they can freely specify annotation names, attributes, values, and other information as needed. Custom annotations allow developers to mark code in a declarative way, enhancing the readability and maintainability of the code. At the same time, custom annotations can separate concerns from business logic, and can flexibly add additional behaviors to specific methods or classes without changing the original code of the method or class.

[0032] Aspect-Oriented Programming (AOP) is a programming paradigm that separates cross-cutting concerns from business logic. In this way, the same code logic that was originally scattered in multiple places can be centrally managed and reused, which not only reduces code redundancy, but also enhances code modularity, simplifies maintenance, and improves code reusability.

[0033] In this application, cross-cutting concerns (such as parameter verification, security verification, permission management, etc.) are declared in the code through custom annotations, and then the corresponding processing operations are performed at the annotations.

[0034] To facilitate understanding of this application, the code for executing information processing is modularized below, and the function of each module is explained. Figure 1 As shown, the information processing implementation framework may include an interception module 101 , a parameter verification module 102 , a security verification module 103 , a permission verification module 104 and an exception handling module 105 .

[0035] The interception module 101 is used to determine whether the access request is intercepted according to the source address corresponding to the access request, and obtain the custom annotation on the target business interface to be accessed by the access request, and determine whether it is necessary to perform preprocessing operations on the access request according to the switch status corresponding to the custom annotation.

[0036] If the switch state corresponding to the custom annotation is on, it indicates that a preprocessing operation needs to be performed on the access request; if the switch state corresponding to the custom annotation is off, it indicates that a preprocessing operation does not need to be performed on the access request.

[0037] Among them, the preprocessing operation includes parameter verification, security verification, permission verification, etc. Specifically, parameter verification includes whether it is allowed to be empty, length verification, type verification, regular expression verification, etc. Security verification includes signature verification, decryption, etc.; permission verification includes whether there is permission to access the target business interface. There are different verification modules for the above different verification logics.

[0038] The parameter verification module 102 implements its verification logic by customizing annotations. For example, a custom annotation @ValidParam is created and its verification logic is implemented in the predefined annotation @ControllerAdvice.

[0039] The security verification module 103 is used to perform security verification on the data in the access request.

[0040] The authority verification module 104 is used to verify the access rights of the interface, that is, to verify whether the user who sends the access request has the authority to operate the target business interface.

[0041] The exception handling module 105 is used to handle global exceptions, including exceptions in the preprocessing stage and exceptions in the target business interface responding to the access request node. Since this module can capture exceptions globally, there is no need to repeatedly write exception handling logic for different interfaces, reducing system code redundancy. In addition, this module can define processing methods for specific exception types. In specific implementation, this module can be implemented in combination with the two predefined annotations @ControllerAdvice and @ExceptionHandler.

[0042] The log printing module 106 is used to record the information received or generated at different stages. For example, after receiving an access request, the access request and the parameters in the access request are recorded; when the verification of each of the above verification modules fails, the reasons and results of the failure are recorded.

[0043] It should be noted that Figure 1 This is only an example and does not limit the specific functions that can be achieved by information processing. More functional modules can be defined according to actual needs.

[0044] Based on the functions of the above modules, the information processing method provided by this application will be described below.

[0045] See also Figure 2 , which is a flow chart of an information processing method provided by an embodiment of the present application, such as Figure 2 As shown, the method includes:

[0046] S201: Receive an access request for a target business interface, and obtain a custom annotation corresponding to the target business interface.

[0047] S202: If the value of the target attribute corresponding to the custom annotation is the first attribute value, determine that the access request is to be pre-processed.

[0048] The execution subject of the above method may be a software processing system, which may include multiple interfaces, different services are implemented by different interfaces, and one service may need to be implemented by multiple service interfaces. In this embodiment, the target service interface provides a service.

[0049] In this embodiment, an interception operation may be performed for each access request received. After intercepting the access request, a custom annotation corresponding to the target business interface is obtained to determine whether a preprocessing operation needs to be performed on the access request based on the value of the target attribute corresponding to the custom annotation.

[0050] In the specific implementation, considering that some access requests do not need to be intercepted, in order to reduce the interception operation, it is possible to pre-judge whether the access request needs to be intercepted. Specifically, an access request for a target business interface is received, and whether the access request needs to be intercepted is determined according to the source address corresponding to the access request; if the access request needs to be intercepted, the custom annotation corresponding to the target business interface is obtained.

[0051] For example, a blacklist may be predefined. After receiving an access request, it is determined whether the source address corresponding to the access request is in the blacklist. If it is in the blacklist, it indicates that the access request needs to be intercepted; otherwise, the access request does not need to be intercepted and is directly forwarded to the target service interface, which responds to the access request.

[0052] Among them, different values ​​of the target attribute in the custom annotation corresponding to the target business interface indicate whether the access request needs to be preprocessed. When the value of the target attribute is the first attribute value, it indicates that the access request needs to be preprocessed, and S203 is executed; if the value of the target attribute is the second attribute value, it indicates that the access request does not need to be preprocessed, and the access request is forwarded to the target business interface so that the target business interface responds to the access request and generates a response result.

[0053] In this embodiment, the value of the target attribute being the first attribute value can be understood as the switch state of the custom annotation being on; the value of the target attribute being the second attribute value can be understood as the switch state of the custom annotation being off.

[0054] S203: For different preprocessings, according to the execution order, the instruction information corresponding to the target preprocessing to be executed currently is determined from the custom annotations.

[0055] S204: If the indication information is the first indication, target preprocessing is performed on the access request based on the custom annotation corresponding to the target preprocessing.

[0056] The preprocessing includes at least one of parameter verification, security verification, and permission verification. In specific implementation, more types of verification can be added according to actual business needs, which is not limited in this embodiment. The indication information is used to indicate whether a target preprocessing operation needs to be performed on the access request.

[0057] Usually, when checking an access request, if one check fails, the check will not be executed further. Therefore, the execution order of different types of checks can be preset, and the above checks are performed on the access request in sequence according to the execution order.

[0058] In this embodiment, whether a certain preprocessing operation is to be performed for a certain access request can be indicated by a custom annotation. Specifically, if the indication information for a certain preprocessing in the custom annotation is the first indication, indicating that the operation corresponding to the preprocessing needs to be performed on the access request, the custom annotation corresponding to the preprocessing is obtained, and the custom annotation is used to perform the operation corresponding to the preprocessing on the access request. Among them, the custom annotation corresponding to the preprocessing indicates the processing logic of the preprocessing, that is, the custom annotation is used to indicate how to implement the preprocessing operation.

[0059] If the indication information is the second indication, indicating that there is no need to perform target preprocessing on the access request, then the next target preprocessing to be executed is determined according to the execution order, and the indication information corresponding to the next target preprocessing to be executed is determined from the custom annotation, and based on the indication information, it is determined whether to perform the target preprocessing on the access request.

[0060] Among them, the indication information is the first indication, which can be understood as the switch state of the target preprocessing in the custom annotation corresponding to the target business interface is on; the indication information is the second indication, which can be understood as the switch state of the target preprocessing in the custom annotation corresponding to the target business interface is off.

[0061] The specific implementation of S204 may include:

[0062] One is that if the target preprocessing is parameter verification, each input parameter is obtained from the access request; for any input parameter, the input parameter is verified using the custom annotation added to the field corresponding to the input parameter. The custom annotation added to the field is used to verify at least one of whether the field is allowed to be empty, the length of the input parameter corresponding to the field, and the regular expression of the input parameter corresponding to the field. Specifically, the parameter verification process can be implemented by the parameter verification module 102.

[0063] Among them, input parameters refer to the parameters received by the called function or method when calling a function or method (the so-called interface). In this embodiment, custom annotations are added to different fields in the input parameters, such as the verification of the parameters corresponding to the field is realized through the custom annotations. For example, the input parameters include user identification fields, unit price fields, quantity fields, etc., and a custom annotation for verifying the field can be added for each field. For the parameters corresponding to each field, various verifications can be realized, such as whether it is allowed to be empty, whether the length meets the preset length, and whether the expression of the parameter meets the regular expression.

[0064] In this embodiment, if the parameter verification passes, the next preprocessing is performed, such as security verification. When the target preprocessing is security verification, S204 includes: obtaining a user identifier from the access request; obtaining a key based on the user identifier, and performing signature verification and / or decryption on the data in the access request based on the key. The user identifier is used to identify the user who sent the access request. Specifically, the security verification process can be implemented by the security verification module 103.

[0065] If the security verification passes, the next preprocessing is performed, such as permission verification. When the target preprocessing is permission verification, S204 includes: obtaining a user identifier from the access request, querying an access list based on the user identifier; and determining whether the target user has permission to access the target business interface based on the access list. Among them, the access list includes an interface identifier that allows the user indicated by the user identifier to access. That is, after querying the access list corresponding to the user identifier, determine whether the access list includes the interface identifier of the target business interface. If included, it indicates that the user corresponding to the user identifier has permission to access the target business interface; otherwise, the user does not have permission to access the target business interface. Specifically, the processing of permission verification can be implemented by the permission verification module 104.

[0066] When the permission check passes, if there are other check operations, the next check operation will be executed until all checks pass, and the access request will be forwarded to the target business interface. If one check fails, the subsequent check operations will be stopped and the abnormal result will be returned.

[0067] In this embodiment, whether an exception occurs in the preprocessing process or an exception occurs in the target business interface when responding to the access request, a unified process can be performed. Specifically, if the processing result or response result of the target preprocessing is abnormal, the abnormal information is obtained; a response message is generated based on the abnormal information, and the response message is sent. Among them, the response message includes at least the content corresponding to the coding field and the information field. That is, the abnormal information is standardized through the exception handling module 105, so that the user can know the specific cause of the abnormality through the response message, thereby improving readability.

[0068] Among them, the coding field is used to indicate whether a certain processing result is abnormal. For example, if the coding field is 0, it means that the processing is successful; if the coding field is 1, it means that the processing is abnormal. The information field is used to indicate the cause of the abnormality, such as the parameter length does not meet the preset length, which is convenient for quickly locating the problem. In addition, in order to facilitate tracing when an abnormal situation occurs, data at different stages can be recorded. For example, after intercepting an access request, the original parameters in the access request are recorded; if the above verification is abnormal, the abnormal result is recorded, which is convenient for R&D to trace the source and troubleshoot problems.

[0069] It can be seen that in order to avoid the interweaving of the preprocessing of access requests and the processing of responses to access requests, the preprocessing process is implemented by adding custom annotations to the interface. If different interfaces have different corresponding preprocessing operations, they can be distinguished by custom annotations, without the need to repeatedly write a large amount of code, reducing system code redundancy and improving system performance.

[0070] Based on the above method embodiment, the embodiment of the present application also provides an information processing device, which will be described below in conjunction with the accompanying drawings.

[0071] See also Figure 3 , which is a structural diagram of an information processing device provided in an embodiment of the present application, such as Figure 3 As shown, the device 300 includes:

[0072] The acquisition unit 301 is used to receive an access request for a target business interface and acquire a custom annotation corresponding to the target business interface, where the target business interface provides a service;

[0073] A determining unit 302 is configured to determine that the access request needs to be preprocessed if the value of the target attribute corresponding to the custom annotation is the first attribute value, wherein the preprocessing includes at least one of parameter verification, security verification, and permission verification;

[0074] The determining unit 302 is further configured to determine, for different preprocessings, from the custom annotations according to the execution order, indication information corresponding to the target preprocessing to be currently executed, wherein the indication information indicates whether the target preprocessing needs to be executed on the access request;

[0075] The processing unit 303 is configured to, if the indication information is the first indication, perform the target preprocessing on the access request based on the custom annotation corresponding to the target preprocessing, wherein the custom annotation corresponding to the target preprocessing indicates the processing logic of the target preprocessing.

[0076] In some embodiments, the acquisition unit 301 is specifically used to receive an access request for a target business interface; determine whether the access request needs to be intercepted based on a source address corresponding to the access request; if the access request needs to be intercepted, obtain a custom annotation corresponding to the target business interface.

[0077] In some embodiments, the processing unit 303 is specifically used to obtain each input parameter from the access request if the target preprocessing is the parameter verification; for any input parameter, the input parameter is verified using the custom annotation added to the field corresponding to the input parameter, and the custom annotation added to the field is used to verify at least whether the field is allowed to be empty, the length of the input parameter corresponding to the field, and one of the regular expressions corresponding to the input parameter of the field.

[0078] In some embodiments, the processing unit 303 is specifically used to obtain a user identifier from the access request if the target preprocessing is the security verification, and the user identifier indicates the user who sent the access request; obtain a key based on the user identifier, and perform signature verification and / or decryption on the data in the access request based on the key.

[0079] In some embodiments, the processing unit 303 is specifically used to obtain a user identifier from the access request if the target is preprocessed as the permission check, the user identifier indicating the user who sent the access request; query an access list based on the user identifier, the access list including interface identifiers that the target user corresponding to the user identifier is allowed to access; and determine whether the target user has permission to access the target business interface based on the access list.

[0080] In some embodiments, the apparatus further comprises: a sending unit;

[0081] The sending unit is further configured to forward the access request to the target service interface if the value of the target attribute is a second attribute value, so that the target service interface responds to the access request and generates a response result.

[0082] In some embodiments, the determination unit 302 is further used to determine the indication information corresponding to the next target preprocessing to be executed according to the execution order if the indication information is the second indication, and determine whether to execute the target preprocessing for the access request based on the indication information.

[0083] It should be noted that the information execution process of each unit in the above-mentioned device and other contents can be specifically referred to the description in the method embodiment shown in the above-mentioned application, and will not be repeated here.

[0084] In addition, an embodiment of the present application provides an electronic device, including: a processor, a memory;

[0085] The memory is used to store computer-readable instructions or computer programs;

[0086] The processor is used to read the computer-readable instructions or the computer program so that the device implements the information processing method.

[0087] An embodiment of the present application provides a computer-readable storage medium, including instructions or computer programs, which, when executed on a computer, enable the computer to execute the above-mentioned information processing method.

[0088] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0089] 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.

[0090] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0091] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0092] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An information processing method, characterized in that: The method comprises: Receiving an access request for a target business interface and obtaining a custom annotation corresponding to the target business interface, wherein the target business interface provides a business; If the value of the target attribute corresponding to the custom annotation is the first attribute value, it is determined that the access request needs to be preprocessed, and the preprocessing includes at least one of parameter verification, security verification, and permission verification; For different preprocessing, according to the execution order, determining the indication information corresponding to the target preprocessing to be currently executed from the custom annotation, the indication information indicating whether the target preprocessing needs to be executed on the access request; If the indication information is the first indication, the target preprocessing is performed on the access request based on the custom annotation corresponding to the target preprocessing, and the custom annotation corresponding to the target preprocessing indicates the processing logic of the target preprocessing.

2. The method according to claim 1, characterized in that The receiving an access request for a target business interface and obtaining a custom annotation corresponding to the target business interface includes: Receive access requests for target business interfaces; Determining whether the access request needs to be intercepted according to the source address corresponding to the access request; If the access request needs to be intercepted, obtain the custom annotation corresponding to the target business interface.

3. The method according to claim 1 or 2, characterized in that: If the indication information is the first indication, performing the target preprocessing on the access request based on the custom annotation corresponding to the target preprocessing includes: If the target preprocessing is the parameter verification, obtaining each input parameter from the access request; For any input parameter, the input parameter is verified using the custom annotation added to the field corresponding to the input parameter. The custom annotation added to the field is used to verify at least one of whether the field is allowed to be empty, the length of the input parameter corresponding to the field, and the regular expression of the input parameter corresponding to the field.

4. The method according to any one of claims 1 to 3, characterized in that: If the indication information is the first indication, performing the target preprocessing on the access request based on the custom annotation corresponding to the target preprocessing includes: If the target preprocessing is the security verification, obtaining a user identifier from the access request, the user identifier indicating a user sending the access request; A key is obtained based on the user identifier, and signature verification and / or decryption is performed on the data in the access request based on the key.

5. The method according to any one of claims 1 to 4, characterized in that: If the indication information is the first indication, performing the target preprocessing on the access request based on the custom annotation corresponding to the target preprocessing includes: If the target preprocessing is the permission verification, obtaining a user identifier from the access request, the user identifier indicating the user who sent the access request; Querying an access list based on the user identifier, the access list including interface identifiers that are allowed to be accessed by a target user corresponding to the user identifier; Determine whether the target user has permission to access the target service interface based on the access list.

6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: If the value of the target attribute is the second attribute value, the access request is forwarded to the target service interface, so that the target service interface responds to the access request and generates a response result.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: If the indication information is the second indication, the indication information corresponding to the next target preprocessing to be executed is determined according to the execution order, and based on the indication information, it is determined whether to execute the target preprocessing for the access request.

8. An information processing device, characterized in that: The device comprises: An acquisition unit, configured to receive an access request for a target business interface and acquire a custom annotation corresponding to the target business interface, wherein the target business interface provides a business; a determining unit, configured to determine that the access request needs to be preprocessed if the value of the target attribute corresponding to the custom annotation is the first attribute value, wherein the preprocessing includes at least one of parameter verification, security verification, and permission verification; The determining unit is further configured to determine, for different preprocessings, from the custom annotations according to the execution order, indication information corresponding to the target preprocessing to be currently executed, wherein the indication information indicates whether the target preprocessing needs to be executed on the access request; A processing unit is used to perform the target preprocessing on the access request based on the custom annotation corresponding to the target preprocessing if the indication information is a first indication, and the custom annotation corresponding to the target preprocessing indicates the processing logic of the target preprocessing.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a device, the device executes the information processing method according to any one of claims 1 to 7.

10. A computer program product, characterized in that When the computer program product is run on a computer, the computer is enabled to execute the information processing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Method for realizing interface authentication based on Springboot aspect

    CN121644136A