Label-based authorization method and device
Through the tag-based authorization method, tags are built and encoded to achieve the unification of interface functions and service call relationships in the microservice mode, solving the problem of complexity of authorization management in the microservice mode and improving the accuracy and efficiency of authorization control.
Patent Information
- Application Number
- CN202411061076.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-11-15
AI Technical Summary
In the microservice mode, the consistency of interface functions and service call relationships and the accuracy and efficiency of authorization control are low, resulting in complex authorization management.
The tag-based authorization method is adopted to construct first-level, second-level and third-level tags, combining user authorization data and Session key values, functionalization and coding are achieved, and precise authorization control is completed.
It significantly improves the accuracy and efficiency of authorization control, realizes the unity of interface functions and service call relationships in the microservice mode, and realizes accurate, reliable, flexible and controllable permission management.
Smart Images

Figure CN118963754A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a tag-based authorization method and device. Background Art
[0002] In traditional web development, the front-end and back-end are tightly coupled, with the front-end directly relying on the pages and data interfaces provided by the back-end. However, in the practice of a front-end and back-end separation architecture under microservices, the operational details of business splitting and technical integration differ significantly from the original approach: according to the calling relationship between the system function interface and the RestFul interface, there are cases where a single interface calls multiple microservice interfaces, and a single function requires a combination of multiple microservice interfaces to implement. This situation has led to a significant increase in the number of interfaces and interface combinations, as well as a significant increase in the uncertainty of interface permission control based on business functions. At the same time, the complex calling relationship between business functions and microservice interfaces has led to a significant increase in the difficulty of authorization management and control, resulting in a decrease in the consistency of interface functions and service calling relationships, as well as the accuracy and efficiency of authorization control under the microservice model. Summary of the Invention
[0003] The purpose of the present invention is to provide a tag-based authorization method and device, which can achieve the unification of interface functions and service call relationships in the microservice model, as well as realize accurate, reliable, flexible and controllable permission management, and significantly improve the accuracy and efficiency of authorization control.
[0004] The technical solution of the present invention is: In a first aspect, the present application provides a tag-based authorization method, which comprises the following steps: S1. Build a first-level tag based on the key values of the URL request collected according to the configuration; S2, forming a secondary tag by functionalizing the primary tag; S3. Match the secondary tag with the user authorization data, and combine and encode them according to function and user authority to form a tertiary tag; S4. Use the Session key value to call out the current user permissions, and arrange and uniformly number the current user permissions in a three-level tag format to form a combined tag; S5. Locate the combined tag of the URL accessed by the current user to obtain the functional permissions, and complete the authorization control through the functional permissions of the current user.
[0005] Furthermore, in step S1, the relevant key values of the above URL request include basic fields, keywords and relevant attribute values defined and managed by the system.
[0006] Furthermore, in step S2, the process of functionalizing the first-level labels includes: constructing dynamic labels using expressions, integrating and simplifying the dynamic labels with the first-level labels, eliminating duplicate and invalid labels, and constructing second-level labels according to business functions and categories.
[0007] Furthermore, in step S3, the above-mentioned process of combining and encoding by function and user authority includes: incorporating user role-related attributes and user authority into the tag sequence, and arranging the tag sequence by function in a combined manner based on the secondary tag to form a tertiary tag.
[0008] Furthermore, in step S5, before locating the combined tag according to the URL accessed by the current user to obtain functional permissions, it also includes: matching the third-level tags according to the URL accessed by the current user, and filtering the third-level tags matched by the user through the combined tags to obtain the functional permissions of the current user, thereby completing authorization control.
[0009] Furthermore, the authorization control process includes: performing authorization matching on the user's functional permissions according to the permission set code containing the user permission control attribute serialized in a Session buffer manner when the user logs into the system, so as to implement authorization control.
[0010] In a second aspect, the present application provides a tag-based authorization device, comprising: The tag collection module is used to collect the relevant key values of the URL request according to the configuration to build the first-level tag; A tag building module, used to form a secondary tag by functionalizing the primary tag; The tag integration module is used to match the secondary tags with the user authorization data and merge and encode them according to the function and user authority to form the tertiary tags; The label arrangement module is used to call out the current user permissions using the Session key value, and arrange and uniformly number the current user permissions in a three-level label format to form a combined label; The authorization control module is used to locate the combined tag of the URL accessed by the current user to obtain functional permissions and complete authorization control through the functional permissions of the current user.
[0011] In a third aspect, the present application provides an electronic device, comprising: a memory for storing one or more programs; processor; When the one or more programs are executed by the processor, a tag-based authorization method as described in any one of the first aspects is implemented.
[0012] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a tag-based authorization method as described in any one of the first aspects above.
[0013] Compared with the prior art, the present invention has at least the following advantages or beneficial effects: (1) The present invention provides a tag-based authorization method and device, which adopts a three-level dynamic tag classification and arrangement method. On the basis of integrating dynamic tags, it realizes the unified coding and arrangement of tags, authorization attributes and roles, which significantly improves the efficiency of authorization. (2) The present invention integrates dynamic processing capabilities while extracting specific functions, and uses expressions to achieve separation from business logic. While realizing the organization of microservices into business functions, it simplifies the authorization control logic and improves the efficiency of authorization control. On the basis of achieving the control of system function permissions, it realizes the customized control of system data and business permissions in a high-precision manner; (3) The present invention completes authorization control by locating the combined tag of the URL accessed by the current user and obtaining the functional permissions, thereby realizing the unification of the interface function and service call relationship under the microservice model, and realizing accurate, reliable, flexible and controllable permission management, which significantly improves the accuracy and efficiency of authorization control. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0015] Figure 1 A step diagram of a tag-based authorization method of the present invention; Figure 2 A schematic diagram of a model indicator system of a tag-based authorization method of the present invention; Figure 3 The figure is a schematic structural block diagram of an electronic device according to an embodiment of the present invention.
[0016] Icon: 101, memory; 102, processor; 103, communication interface. DETAILED DESCRIPTION
[0017] To make the objectives, technical solutions, and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0018] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in the present application without creative work are within the scope of protection of the present application.
[0019] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0020] It should be noted that, in this document, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or apparatus that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article, or apparatus. In the absence of further limitations, the elements defined by the phrase "comprises..." do not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the elements.
[0021] The following describes some embodiments of the present application in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features thereof may be combined with each other.
[0022] Example 1 See also Figure 1 , Figure 1 Shown is a step diagram of a tag-based authorization method provided in an embodiment of the present application.
[0023] In a first aspect, the present application provides a tag-based authorization method, which comprises the following steps: S1. Build a first-level tag based on the key values of the URL request collected according to the configuration; S2, forming a secondary tag by functionalizing the primary tag; S3. Match the secondary tag with the user authorization data, and combine and encode them according to function and user authority to form a tertiary tag; S4. Use the Session key value to call out the current user permissions, and arrange and uniformly number the current user permissions in a three-level tag format to form a combined tag; S5. Locate the combined tag of the URL accessed by the current user to obtain the functional permissions, and complete the authorization control through the functional permissions of the current user.
[0024] As a preferred implementation, in step S1, the relevant key values of the URL request include basic fields, keywords, and relevant attribute values defined and managed by the system.
[0025] As a preferred embodiment, in step S2, the process of functionalizing the first-level label includes: constructing a dynamic label using an expression method, integrating and simplifying the dynamic label with the first-level label, eliminating duplicate and invalid labels, and constructing a second-level label according to business functions and categories.
[0026] It should be noted that for tags that are dynamically adapted, that is, adapted to connect to external resources, dynamic tags are constructed using expressions.
[0027] As a preferred implementation, in step S3, the process of merging and encoding by function and user authority includes: incorporating user role-related attributes and user authority into the label sequence, and arranging the label sequence by function in a combined manner based on the secondary label to form a tertiary label.
[0028] As a preferred implementation, in step S5, before locating the combined tag according to the URL accessed by the current user to obtain functional permissions, it also includes: matching the third-level tags according to the URL accessed by the current user, and filtering the third-level tags matched by the user through the combined tags to obtain the functional permissions of the current user, thereby completing authorization control.
[0029] As a preferred embodiment, the authorization control process includes: performing authorization matching on the user's functional permissions according to the permission set encoding containing the user permission control attributes serialized in a Session buffer manner when the user logs into the system, so as to implement authorization control.
[0030] Example 2 In a second aspect, the present application provides a tag-based authorization device, comprising: The tag collection module is used to collect the relevant key values of the URL request according to the configuration to build the first-level tag; A tag building module, used to form a secondary tag by functionalizing the primary tag; The tag integration module is used to match the secondary tags with the user authorization data and merge and encode them according to the function and user authority to form the tertiary tags; The label arrangement module is used to call out the current user permissions using the Session key value, and arrange and uniformly number the current user permissions in a three-level label format to form a combined label; The authorization control module is used to locate the combined tag of the URL accessed by the current user to obtain functional permissions and complete authorization control through the functional permissions of the current user.
[0031] In summary, the present invention provides a tag-based authorization device, which constructs a first-level tag by configuring and collecting relevant key values of URL requests through a tag collection module, then functionalizes the first-level tag through a tag construction module to form a second-level tag, and then matches the second-level tag with the user authorization data through a tag integration module, and merges and encodes them according to functions and user permissions to form a third-level tag, and then uses a tag arrangement module to call out the current user permissions using the Session key value, and arranges and uniformly number the current user permissions in the form of three-level tags to form a combined tag, and finally uses an authorization control module to locate the combined tag according to the URL accessed by the current user to obtain functional permissions, and completes authorization control through the functional permissions of the current user, thereby realizing the unification of interface functions and service call relationships under the microservice mode, as well as realizing accurate, reliable, flexible and controllable permission management, and significantly improving the accuracy and efficiency of authorization control.
[0032] Example 3 See also Figure 2 , Figure 2 This is a schematic diagram of a model indicator system for a tag-based authorization method of the present invention, which describes the model components and main calculation contents: Level 1 tags: In the microservice mode, level 1 tags use filters to dynamically collect common key values such as URL path parameters and URL request header parameters when they are first accessed, and automatically decompose the relevant content into the smallest unit according to the URL to form the original tag; in addition, additional tags are supported, and extended tags can be extracted through configuration to form a level 1 tag as a whole.
[0033] Level 2 tags: Building on Level 1 tags, Level 2 tags process and simplify system functions and dynamic data. Finally, system functions and URLs are tagged and numbered according to unique numbers. System functions are adapted and synthesized around user interface functionality. Dynamically variable key values are defined using custom expressions. This supports the dynamic invocation of external interfaces during subsequent authorization. Dynamic authorization is then performed after secondary tag arrangement.
[0034] Level 3 tags: Level 3 tags integrate user permission tags based on level 2 tags, integrate and encode the permissions of system URLs and functions, and build buffering and synchronization functions that support permissions to facilitate accurate and fast authorization.
[0035] User Authorization: User authorization organizes user permissions according to the composition of the three-level user permission tags, and updates these arrangements when a user logs in or their permissions change. When a user accesses a specific URL, authorization control is implemented by matching permissions with the three-level tags based on functional positioning. If the tag containing the current URL contains an expression, authorization control is performed by calling an external interface according to a custom formula to form a new three-level tag.
[0036] Example 4 See also Figure 3 , Figure 3 A schematic structural block diagram of an electronic device provided in an embodiment of the present application.
[0037] An electronic device includes a memory 101, a processor 102, and a communication interface 103. The memory 101, processor 102, and communication interface 103 are electrically connected to each other directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines. The memory 101 can be used to store software programs and modules, and the processor 102 executes the software programs and modules stored in the memory 101 to perform various functional applications and data processing. The communication interface 103 can be used to communicate signaling or data with other node devices.
[0038] The memory 101 may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0039] Processor 102 can be an integrated circuit chip with signal processing capabilities. Processor 102 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0040] It is understood that the structure shown in the figure is for illustration only, and a tag-based authorization method and apparatus may include more or fewer components than shown in the figure, or have a different configuration than shown in the figure. Each component shown in the figure may be implemented using hardware, software, or a combination thereof.
[0041] In the embodiments provided in this application, it should be understood that the disclosed methods can also be implemented in other ways. The embodiments described above are merely illustrative. For example, the flowcharts or block diagrams in the accompanying drawings show the possible implementation architectures, functions and operations of the methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a portion of code, and the module, program segment or a portion of code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions.
[0042] In addition, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0043] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.
[0044] In summary, the embodiments of the present application provide a tag-based authorization method and device. By using a three-level tag system, on the basis of integrating the interface and business function call relationship, on the one hand, the hierarchical tag encoding is used to realize the sorting of complex interfaces to business functions. On the other hand, the tags are used to integrate the authorization relationship, simplify the authorization control logic, and improve the efficiency and quality of authorization control.
[0045] The above description is merely a preferred embodiment of the present application and is not intended to limit the present application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
[0046] It will be apparent to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above and that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the present application is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.
Claims
1. A tag-based authorization method, characterized in that: The following steps are involved: S1. Construct a first-level tag according to the key values of the URL request according to the configuration; S2, forming a secondary tag by functionalizing the primary tag; S3, matching the secondary tag with the user authorization data, and combining and encoding them according to the function and user authority to form a tertiary tag; S4. Use the Session key value to call out the current user permissions, and arrange and uniformly number the current user permissions in a three-level label format to form a combined label; S5. Locate the combined tag of the URL accessed by the current user to obtain the functional permission, and complete the authorization control through the functional permission of the current user.
2. A tag-based authorization method as claimed in claim 1, characterized in that: In step S1, the relevant key values of the URL request include basic fields, keywords and relevant attribute values defined and managed by the system.
3. The tag-based authorization method according to claim 1, characterized in that: In step S2, the process of functionalizing the primary label includes: constructing dynamic labels by expression, integrating and simplifying the dynamic labels with the primary labels, eliminating duplicate and invalid labels, and constructing secondary labels according to business functions and categories.
4. The tag-based authorization method according to claim 1, characterized in that: In step S3, the process of combining and encoding by function and user authority includes: incorporating user role-related attributes and user authority into a tag sequence, and arranging the tag sequence by function in a combined manner based on the secondary tag to form a tertiary tag.
5. The tag-based authorization method according to claim 1, characterized in that: In step S5, before locating the combined tag according to the URL accessed by the current user to obtain functional permissions, it also includes: matching the third-level tags with the URL accessed by the current user, and filtering the third-level tags matched by the user through the combined tags to obtain the functional permissions of the current user, thereby completing authorization control.
6. A tag-based authorization method as claimed in claim 5, characterized in that: The authorization control process includes: performing authorization matching on the user's functional authority according to the authority set code containing the user authority control attribute serialized in the Session buffer mode when the user logs into the system, so as to realize authorization control.
7. A tag-based authorization device, characterized in that: include: The tag collection module is used to construct the first-level tag according to the relevant key values of the configured collection URL request; A tag building module, used for forming a secondary tag by functionalizing the primary tag; The tag integration module is used to match the secondary tags with the user authorization data, and merge and encode them according to the functions and user permissions to form the tertiary tags; The label arrangement module is used to call out the current user permissions using the Session key value, and arrange and uniformly number the current user permissions in a three-level label manner to form a combined label; The authorization control module is used to locate the combined tag of the URL accessed by the current user to obtain the functional permissions, and complete the authorization control through the functional permissions of the current user.
8. An electronic device, characterized in that: include: A memory for storing one or more programs; processor; When the one or more programs are executed by the processor, a tag-based authorization method as described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the tag-based authorization method as described in any one of claims 1 to 6 is implemented.
