Access verification method and apparatus

By generating access condition expressions and using expression calculation tools to perform complex calculations, the high maintenance cost and inflexibility of existing permission verification methods are solved, enabling permission verification with multiple attributes and complex calculations.

CN115168831BActive Publication Date: 2026-11-17JINGDONG CITY BEIJING DIGITS TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210782604.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-05
Publication Date
2026-11-17
Estimated Expiration
2042-07-05

AI Technical Summary

Technical Problem

Existing permission verification methods are costly to maintain and inflexible, and cannot support complex calculations involving multiple attributes.

Method used

By obtaining permission verification requests, an access condition expression is generated based on the resource identifier. Complex calculations are then performed using an expression calculation tool, which supports the setting of custom functions to achieve flexible permission verification.

Benefits of technology

It reduces the maintenance cost of permission verification, supports multiple attributes and complex calculations, and improves the flexibility of permission verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168831B_ABST
    Figure CN115168831B_ABST
Patent Text Reader

Abstract

This invention discloses an access permission verification method and apparatus, relating to the field of computer technology. One specific embodiment of the method includes: obtaining an access permission verification request, the request including a resource identifier and parameter information to be accessed; obtaining an access condition expression corresponding to the resource based on the resource identifier, the access condition expression being generated based on the resource's access permission verification configuration information, the configuration information including parameters to be verified, verification rules for each parameter, and logical relationships between different parameters; and using an expression calculation tool to calculate the access condition expression based on the parameter information to obtain an access permission verification result. This embodiment saves maintenance costs and solves the technical problems of existing access permission verification methods being expensive and inflexible, and not supporting complex operations on multiple attributes for access permission verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method and apparatus for verifying access permissions. Background Technology

[0002] When a user needs to access resources in a business system, the system invokes the access control system to verify the user's permissions. Once the verification is successful, the user is authorized to access the resource, thus protecting the security of the business system's resources. Currently, a commonly used access control method is attribute-based access control (ABAC). ABAC verifies whether a user has permission to access a resource by dynamically calculating one or a set of attributes. Its core is the dynamic calculation of expressions. Currently, there are two main methods for judging ABAC permission expressions:

[0003] 1. Based on the scenarios and objects to be verified according to the agreement of the permission system, the business system passes in the attributes as agreed, and the permission system reads the specified attributes for judgment;

[0004] 2. The business system configures the verification of a certain attribute value in the permission system. When permission verification is required, it calls the permission system's service and retrieves the specific value through reflection for calculation and judgment.

[0005] In the process of realizing this invention, the inventors discovered at least the following problems in the prior art:

[0006] The first approach requires the permission system to be customized for the business system, resulting in high maintenance costs and insufficient flexibility. The second approach cannot support permission verification for calculations of multiple attributes or permission verification based on complex combination operations. Summary of the Invention

[0007] In view of this, embodiments of the present invention provide a method and apparatus for verifying access permissions, which can save maintenance costs and solve the technical problems of existing permission verification methods being costly and inflexible, as well as not supporting complex operations on multiple attributes for permission verification.

[0008] To achieve the above objectives, according to one aspect of the present invention, an access permission verification method is provided, comprising: obtaining an access permission verification request, the access permission verification request including a resource identifier to be accessed and parameter information; obtaining an access condition expression corresponding to the resource based on the resource identifier, the access condition expression being generated based on the resource's access permission verification configuration information, the access permission verification configuration information including parameters to be verified, verification rules for each parameter, and logical relationships between different parameters; and using an expression calculation tool to calculate the access condition expression based on the parameter information to obtain an access permission verification result.

[0009] Optionally, the validation rules for the parameters include validation rules based on custom functions.

[0010] Optionally, the logical relationship between the different parameters is represented based on operators with different priorities.

[0011] Optionally, an expression calculation tool is used to calculate the access condition expression based on the parameter information, including: splitting the access condition expression into a set of independent elements according to the predefined types of independent elements; converting the set of independent elements into a postfix expression according to the types of the independent elements; and calculating the postfix expression based on the parameter information to calculate the access condition expression.

[0012] Optionally, the types of the independent elements include operators, user-defined functions, and operands. Based on the predefined types of independent elements, the access condition expression is split to obtain a set of independent elements, including: looping through each character of the access condition expression, determining the type of the independent element to which a single character or string belongs based on the predefined types of independent elements, and determining the set of independent elements based on the determination result. Specifically, for the currently read character, if the current character is not an operator, it is stored in a pre-established string variable; if the current character is an operator, and not a left parenthesis operator, it is determined whether the current character and the next character to be read form a new operator; if so, the current character and the next character are added as an operator to the set of independent elements, and the data stored in the string variable is added as an independent element to the set of independent elements. If the current character is a left parenthesis operator, determine whether the string variable stores data. If so, use the current character and the data stored in the string variable as the left half of the user-defined function, and loop through the next character until the right parenthesis operator is encountered. Use the encountered character as the right half of the user-defined function, combine the left and right halves of the user-defined function into a single user-defined function, and add it to the set of independent elements. Otherwise, add the current character as an operator to the set of independent elements. If the string variable still stores data at the end of the loop, add the data stored in the string variable as an independent element to the set of independent elements.

[0013] Optionally, converting the set of independent elements into a postfix expression based on the type of the independent elements includes: looping through each element in the set of independent elements and adding the read elements to the postfix expression result set according to the type of the independent elements; wherein, for the current element being read, if the current element is an operand or a user-defined function, the current element is added to the postfix expression result set; if the current element is a left parenthesis operator, the current element is pushed onto a stack; if the current element is a right parenthesis operator and the top of the stack is not a left parenthesis operator, the elements in the stack are popped sequentially until the top of the stack is a left parenthesis operator, the left parenthesis operator at the top of the stack and the current element are discarded, and the popped elements are saved to the postfix expression result set according to the popping order; if the current element... If the current element is not a left or right parenthesis operator, and the stack is empty when the current element is read, then push the current element onto the stack. If the current element is not a left or right parenthesis operator, and the stack is not empty when the current element is read, then push the current element onto the stack if the priority of the current element is higher than the priority of the top element. If the priority of the current element is not higher than the priority of the top element, pop elements from the stack until the top element is a left parenthesis operator or the stack is empty, and save the popped elements to the postfix expression result set according to the popping order, then push the current element onto the stack. If the stack is not empty at the end of the loop, pop elements from the stack sequentially until the stack is empty, and save the popped elements to the postfix expression result set according to the popping order.

[0014] Optionally, calculating the postfix expression based on the parameter information to calculate the access condition expression includes: cyclically reading each element of the postfix expression and performing the following operations until all elements have been read: if the current element is not an operator, then pushing the current element onto a stack; if the current element is an operator, then popping two elements from the stack in sequence as two operation parameters; performing calculations based on the operator and the two operation parameters, and pushing the calculation result onto a stack.

[0015] Optionally, before performing calculations based on the operator and the two operation parameters, the method further includes: if the popped element is a user-defined function, then splitting the user-defined function to obtain a user-defined function name and a parameter name of the user-defined function; obtaining the user-defined function expression based on the user-defined function name, and obtaining the parameter value of the user-defined function based on the parameter name of the user-defined function, wherein if the parameter of the user-defined function is not a constant, then finding the parameter value corresponding to the parameter name of the user-defined function from the parameter information as the parameter value of the user-defined function; performing calculations based on the user-defined function expression and the parameter value of the user-defined function, and using the calculation result as the operation parameter corresponding to the user-defined function.

[0016] Optionally, before performing calculations based on the operator and the two operation parameters, the method further includes: if the popped element is a variable, then splitting the variable according to the splitter to obtain the object identifier and parameter name of the resource to be accessed; and using reflection, searching for the parameter value corresponding to the object identifier and the parameter name from the parameter information, and using it as the operation parameter corresponding to the variable.

[0017] According to another aspect of the present invention, an access permission verification device is provided, comprising:

[0018] The request acquisition module is used to acquire the permission verification request, which includes the resource identifier and parameter information to be accessed;

[0019] The expression acquisition module is used to acquire the access condition expression corresponding to the resource based on the resource identifier. The access condition expression is generated based on the permission verification configuration information of the resource. The permission verification configuration information includes the parameter to be verified, the verification rule for each parameter, and the logical relationship between different parameters.

[0020] The expression calculation module is used to calculate the access condition expression based on the parameter information using an expression calculation tool, and obtain the permission verification result.

[0021] According to another aspect of the present invention, an access permission verification electronic device is provided, comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the access permission verification method provided in the embodiments of the present invention.

[0022] According to another aspect of the present invention, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the access permission verification method provided in the embodiments of the present invention.

[0023] One embodiment of the above invention has the following advantages or beneficial effects: By obtaining a permission verification request, which includes the identifier of the resource to be accessed and parameter information; obtaining the access condition expression corresponding to the resource based on the resource identifier, the access condition expression being generated based on the resource's permission verification configuration information, which includes the parameters to be verified, the verification rules for each parameter, and the logical relationships between different parameters; and using an expression calculation tool to calculate the access condition expression based on the parameter information to obtain the permission verification result, this technical solution can generate expressions supporting multiple attributes and complex calculation logic based on the resource's permission verification configuration information, and perform permission verification by calculating complex expressions. This eliminates the need for customized development for business systems, saving maintenance costs and solving the technical problems of high maintenance costs and inflexibility in existing permission verification methods, as well as the lack of support for complex calculations on multiple attributes for permission verification. Furthermore, the permission verification method of this invention also supports the setting of custom functions, enabling more flexible permission verification through custom functions.

[0024] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0025] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0026] Figure 1 This is a schematic diagram of the main steps of the access permission verification method according to an embodiment of the present invention;

[0027] Figure 2 This is a schematic diagram illustrating the implementation flow of an access permission verification method according to an embodiment of the present invention;

[0028] Figure 3 This is a schematic diagram illustrating the implementation process of splitting an expression into independent elements according to an embodiment of the present invention;

[0029] Figure 4 This is a schematic diagram illustrating the implementation process of generating a postfix expression from a set of independent elements according to an embodiment of the present invention;

[0030] Figure 5 This is a schematic diagram illustrating the calculation process of a postfix expression according to an embodiment of the present invention;

[0031] Figure 6 This is a schematic diagram of the main modules of an access permission verification device according to an embodiment of the present invention;

[0032] Figure 7 This is an exemplary system architecture diagram in which embodiments of the present invention can be applied;

[0033] Figure 8 This is a schematic diagram of the structure of a computer system suitable for implementing terminal devices or servers of the present invention. Detailed Implementation

[0034] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0035] To address the technical problems existing in the prior art, the present invention provides an access permission verification method and apparatus, which can generate an expression that supports complex calculations based on the access permission verification configuration information of the resource, and perform access permission verification by calculating the complex expression. This solves the technical problems of existing access permission verification methods being costly to maintain and inflexible, as well as not supporting access permission verification by performing complex calculations on multiple attributes.

[0036] Figure 1 This is a schematic diagram illustrating the main steps of an access permission verification method according to an embodiment of the present invention. Figure 1 As shown, the access permission verification method of this invention mainly includes the following steps S101 to S103.

[0037] Step S101: Obtain a permission verification request, which includes the resource identifier to be accessed and parameter information. The parameter information includes permission verification parameters required to access the resource, typically including parameter names and values. The parameter information required to access the resource can be obtained based on the configuration of the permission verification system. When a business system needs to access a resource stored on a resource storage server, it will send a permission verification request to invoke the permission verification system for permission verification. In this embodiment of the invention, the permission verification system is described using an ABAC system as an example.

[0038] Step S102: Obtain the access condition expression corresponding to the resource based on the resource identifier. The access condition expression is generated based on the resource's permission verification configuration information, which includes the parameters to be verified, the verification rules for each parameter, and the logical relationships between different parameters. After receiving a permission verification request from the business system, the permission verification system first obtains the resource identifier to be accessed, and then obtains the access condition expression corresponding to the resource based on the resource identifier.

[0039] In embodiments of the present invention, the access control system configures specific verification rules for each resource for which access control is required. When configuring resource verification rules in the access control system, an administrator logs into the system and configures the resources to be managed, such as meeting room reservations. The resource identifier for the configured resource is "meeting_reservation".

[0040] According to the technical solution of the present invention, in order to make the permission verification system configurable and support multiple attribute parameters and complex calculations for permission verification, the present invention improves the configuration module of the permission verification system. This module can configure at least one parameter required for resource verification, the verification rules for each parameter, and the complex logical relationships between these parameters. Furthermore, it can generate access condition expressions based on this configuration information. Additionally, access condition expressions can be directly set on the configuration interface.

[0041] According to one embodiment of the present invention, the parameter verification rules include verification rules implemented based on custom functions. The permission verification system of the present invention can support verification rules implemented through custom functions. To achieve this functionality, a custom function interface can be implemented. By calling this custom function interface, a custom function is defined, and a custom verification rule is implemented.

[0042] In embodiments of the present invention, the logical relationships between the different parameters are represented based on operators with different priorities. The permission verification system of the present invention implements an enumeration class of operators, dividing the supported operators into 5 levels according to priority, from highest to lowest: 1) left parenthesis, right parenthesis, user-defined function; 2) multiplication sign, division sign; 3) addition sign, subtraction sign; 4) greater than, less than, greater than or equal to, less than or equal to, not equal to, equal to; 5) AND, OR.

[0043] In addition, this invention also needs to implement an expression service class, mainly including: (1) a method for registering custom functions: used to register custom functions; (2) a method for adding parameters to expressions: used to set the value of expression variables; (3) a method for calculating expressions: the parameter is an expression used to calculate the value of the expression. Through this expression service class, access condition expressions can be generated based on the resource permission verification configuration information, and the access condition expressions can be calculated to perform permission verification.

[0044] According to one embodiment of the present invention, the access condition expression generated based on the configuration information is, for example: (user.level + dynamicLevel(user) > 6 && user.age >= 25) || (user.code == 'superAdmin') || adminCheck(user), which represents the business meaning that: the user's level is greater than 6 and their age is greater than or equal to 25, or the user's code is 'superAdmin', or the user is an administrator. Here, dynamicLevel(user) is a user-defined function. User-defined functions are generally used to process information related to a specific business function, such as the user's level. This user level is usually calculated based on the user's own information and is typically implemented using a user-defined function. If the user's level is needed in the permission verification of the ABAC system, the access condition expression of the ABAC system needs to be able to call this function.

[0045] After configuring permission verification for resources, the ABAC system provides the necessary authentication information to the business system, including the resource identifier, parameters required for the access condition expression, and user-defined function information. The business system then invokes the ABAC authentication service to perform permission verification based on the resource identifier, user-defined function information, and parameters provided by the ABAC system. The permission verification system can then obtain the corresponding access condition expression for the resource based on the resource identifier included in the permission verification request sent by the business system.

[0046] Step S103: Using an expression calculation tool, calculate the access condition expression based on the parameter information to obtain the permission verification result. The permission verification system uses an expression calculation tool to calculate the access condition expression for permission verification. First, the expression calculation tool needs to be initialized. The initialization process is as follows:

[0047] (1) Create an instance of the expression service class, that is, perform an instantiation operation on the expression service class;

[0048] (2) If a custom function needs to be created, the custom function passed in by the business system (dynamically loaded into the JVM, and it will be checked whether it has been loaded before. If it has not been loaded, it will be loaded) will be registered in the service instance of the expression.

[0049] (3) Call the method to add parameters to the expression, adding the parameter information passed from the business system to the expression calculation tool. This method has two parameters: a parameter name key (usually a string) and a parameter value (object). For example, the parameter 'user' mentioned in the previous example has the parameter name key 'user' and the parameter value 'user' when passed in. Note that the parameter name key here must be consistent with the parameter in the expression.

[0050] After initializing the expression calculation tool, you can use it to calculate access condition expressions.

[0051] Figure 2 This is a schematic diagram illustrating the implementation flow of an access permission verification method according to an embodiment of the present invention. Figure 2 As shown, it illustrates the implementation process of the ABAC permission verification system, from configuring resource permission verification information to calculating access condition expressions, mainly including the following steps:

[0052] 1. Configure resource permission verification information in the ABAC system;

[0053] 2. Generate access condition expressions for resources in the ABAC system, where the access condition expressions are generated based on permission verification configuration information;

[0054] 3. The ABAC system provides the resource identifier and permission verification parameters to the business system;

[0055] 4. The business system generates an access verification request based on the resource identifier, custom function information (this must be included if access verification is based on a custom function), and parameter information, and calls the access verification service of the ABAC system based on the access verification request;

[0056] 5. The ABAC system obtains the access condition expression for the corresponding resource based on the permission verification request;

[0057] 6. ABAC system initialization expression calculation tool;

[0058] 7. The ABAC system uses an expression calculation tool to calculate the access condition expression based on the parameter information and obtain the permission verification result.

[0059] According to one embodiment of the present invention, when using an expression calculation tool to calculate the access condition expression based on the parameter information, the specific steps may include: splitting the access condition expression into a set of independent elements according to the predefined types of independent elements; converting the set of independent elements into a postfix expression according to the types of the independent elements; and calculating the postfix expression based on the parameter information to calculate the access condition expression.

[0060] In embodiments of the present invention, the types of independent elements include operators, user-defined functions, and operands. In embodiments of the present invention, the access condition expression is calculated based on the modified postfix expression. First, the access expression is split to obtain a set of independent elements. Postfix expression, also known as Reverse Polish Notation, is a mature algorithm, but it only supports simple operations, such as "1+2," which consists of simple numbers and operators. However, when the ABAC system calculates the access condition expression, it is not simply numbers and operators. Since the access condition expression has variables and user-defined functions, and the operators are not limited to simple operators, the present invention defines independent elements, defining variables (e.g., user.age), user-defined functions (e.g., dynamicLevel(user)), etc., as independent elements. Therefore, the independent elements of the present invention include: an operator, such as the aforementioned five priority operators; a complete user-defined function, including a function name and parameters, such as dynamicLevel(user); and an operand, such as a variable user.level, a number 25, and a string constant 'superAdmin', etc.

[0061] According to an embodiment of the present invention, the access condition expression is split into a set of independent elements based on a predefined type of independent element, specifically including:

[0062] The algorithm iterates through each character of the access condition expression, determines the type of the independent element to which a single character or string belongs based on the predefined type of independent element, and determines the set of independent elements based on the determination result. For the currently read character,

[0063] If the current character is not an operator, then the current character is stored in a pre-established string variable;

[0064] If the current character is an operator, and not a left parenthesis operator, then determine whether the current character and the next character to be read form a new operator; if so, add the current character and the next character as an operator to the independent element set, and add the data stored in the string variable as an independent element to the independent element set; otherwise, add the current character as an operator to the independent element set, and add the data stored in the string variable as an independent element to the independent element set.

[0065] If the current character is a left parenthesis operator, determine whether the string variable stores data; if so, use the current character and the data stored in the string variable as the left half of the user-defined function, and loop to read the next character until the right parenthesis operator is read, use the read character as the right half of the user-defined function, combine the left and right halves of the user-defined function into a single user-defined function, and add it to the set of independent elements; otherwise, add the current character as an operator to the set of independent elements.

[0066] If the string variable still stores data at the end of the loop, then the data stored in the string variable is added as an independent element to the set of independent elements.

[0067] In the specific implementation process, each character of the expression (in the embodiment description of the present invention, each expression refers to the access condition expression) is read in a loop, and then it is determined which type of independent element the read single character or string belongs to. Then, the set of independent elements is determined based on the determination result.

[0068] Figure 3 This is a schematic diagram illustrating the implementation process of splitting an expression into independent elements according to an embodiment of the present invention. For example... Figure 3 As shown, the process of splitting an expression into independent elements mainly includes the following steps:

[0069] 1. A string variable `str` is defined to store the characters that have been read, but it fails to determine which type of independent element they belong to. Independent elements include operators, user-defined functions, and operands. Only operators can be directly identified as belonging to a specific independent element type. Operands and user-defined functions, due to their variable length, cannot be directly identified when only one or a few characters are read.

[0070] 2. Determine if there are any unread characters in the expression. If so, proceed to step 3; otherwise, end the loop and proceed to step 12.

[0071] 3. Read one character from the expression in the order of the characters, and then proceed to step 4;

[0072] 4. Determine if the current character being read is an operator. If it is, proceed to step 5; otherwise, save the current character to the string variable str and then proceed to step 2.

[0073] 5. Determine if the current character is a left parenthesis. If it is, proceed to step 6; otherwise, proceed to step 9.

[0074] 6. Determine whether the string variable str contains data. If yes, proceed to step 7; otherwise, proceed to step 8.

[0075] 7. Read characters according to the rules for determining custom functions until a custom function is obtained, and add it to the independent element set. Specifically, use the current character and the data stored in the string variable str as the left half of the custom function, and loop to read the next character until the right parenthesis operator is read. Use the read character as the right half of the custom function, combine the left and right halves of the custom function into a single custom function, and add it to the independent element set. Then, execute step 2;

[0076] 8. Add the current character as an operator to the set of independent elements, and then proceed to step 2;

[0077] 9. Determine whether the current character and the next character to be read can be combined to form a new operator. If yes, proceed to step 10; otherwise, proceed to step 11. Operators have a maximum length of two characters, such as the operators && and >=. Therefore, when judging operators, it is necessary to determine whether the currently read operator and the next character to be read can be combined to form a new operator.

[0078] 10. Extract the next character from the expression, treat the current character and the next character as an operator, add them to the independent element set, and add the data stored in the string variable str as an independent element to the independent element set. Then, execute step 2;

[0079] 11. Add the current character as an operator to the independent element set, and add the data stored in the string variable as an independent element to the independent element set. Then, execute step 2;

[0080] 12. Determine whether the string variable str still stores data. If yes, proceed to step 13. Otherwise, the expression splitting ends, and the set of independent elements obtained after splitting is returned.

[0081] 13. Add the data stored in the string variable str as an independent element to the independent element set. The expression splitting ends, and the resulting independent element set is returned.

[0082] According to an embodiment of the present invention, based on Figure 3 The implementation process shown is to split the expression into independent elements. After splitting the expression (user.level+dynamicLevel(user)>6&&user.age>=25)||(user.code=='superAdmin')||adminCheck(user), the resulting set of independent elements (separated by commas) is: "(,user.level,+,dynamicLevel(user),>,6,&&,user.age,>=,25,),||,(,user.code,==,'superAdmin',),||,adminCheck(user)".

[0083] According to the technical solution of the present invention, after the access condition expression is split into a set of independent elements, the set of independent elements can be converted into the modified postfix expression of the present invention according to the type of the independent elements.

[0084] According to one embodiment of the present invention, converting the set of independent elements into a postfix expression based on the type of the independent elements may specifically include:

[0085] Iterate through each element in the set of independent elements, and add the read element to the postfix expression result set according to the type of the independent element. For the current element being read,

[0086] If the current element is an operand or a user-defined function, then add the current element to the postfix expression result set;

[0087] If the current element is a left parenthesis operator, then push the current element onto the stack;

[0088] If the current element is a right parenthesis operator and the top of the stack is not a left parenthesis operator, then pop the elements from the stack in sequence until the top of the stack is a left parenthesis operator. Discard the left parenthesis operator at the top of the stack and the current element. Save the popped elements into the postfix expression result set according to the popping order.

[0089] If the current element is not a left parenthesis operator or a right parenthesis operator, and the stack is empty when the current element is read, then the current element is pushed onto the stack;

[0090] If the current element is not a left parenthesis operator or a right parenthesis operator, and the stack is not empty when the current element is read, then if the priority of the current element is higher than the priority of the top element of the stack, the current element is pushed onto the stack; if the priority of the current element is not higher than the priority of the top element of the stack, elements in the stack are popped until the top of the stack is a left parenthesis operator or the stack is empty, and the popped elements are saved to the postfix expression result set according to the popping order, and the current element is pushed onto the stack.

[0091] If the stack is not empty at the end of the loop, pop the elements from the stack one by one until the stack is empty, and save the popped elements into the result set of the postfix expression according to the popping order.

[0092] In the specific implementation process, each element in the set of independent elements (in the embodiments of the present invention, the element is the independent element) is read in a loop, and then the read element is added to the postfix expression result set (in the embodiments of the present invention, it is also referred to as the result set) according to the type of the independent element.

[0093] Figure 4 This is a schematic diagram illustrating the implementation process of generating a postfix expression from a set of independent elements according to an embodiment of the present invention. Figure 4 As shown, the process of generating a postfix expression from a set of independent elements mainly includes the following steps:

[0094] 1. Define a stack and a list. The stack is used to store read operations and has the properties of Last-In-First-Out (LIFO) and Last-In-First-Out (LIFO). The list is used to store the result set of postfix expressions.

[0095] 2. Determine if there are any unread elements in the set of independent elements. If yes, proceed to step 3; otherwise, end the loop and proceed to step 13.

[0096] 3. Following the order of the independent elements in the set of independent elements, read an element from the set of independent elements and proceed to step 4;

[0097] 4. Determine whether the current element being read is an operator. If it is, proceed to step 5. Otherwise, the current element is either an operand or a user-defined function. Add the current element directly to the result set and then proceed to step 2.

[0098] 5. Determine if the current element is a left parenthesis. If it is, push the current element onto the stack and then execute step 2; otherwise, execute step 6.

[0099] 6. Determine if the current element is a right parenthesis. If it is, proceed to step 7; otherwise, proceed to step 10.

[0100] 7. Determine if the top of the stack is a left parenthesis. If it is, proceed to step 8; otherwise, proceed to step 9.

[0101] 8. Discard the left parenthesis at the top of the stack and the current element, then execute step 2;

[0102] 9. Pop elements from the stack one by one until the top of the stack is a left parenthesis. Discard the left parenthesis and the current element. Save the popped elements to the result set according to the popping order. Then execute step 2.

[0103] 10. Determine if the current stack is empty (an empty stack means there is no data stored in the stack). If so, push the current element onto the stack and then execute step 2; otherwise, execute step 11.

[0104] 11. Determine if the priority of the current element is higher than the priority of the top element of the stack. If so, push the current element onto the stack and then execute step 2; otherwise, execute step 12.

[0105] 12. Pop elements from the stack until the top element is a left parenthesis or the stack is empty, and save the popped elements to the result set according to the popping order. Push the current element back onto the stack, and then execute step 2.

[0106] 13. Determine if the current stack is empty. If it is, the process of generating the postfix expression ends and the result set storing the postfix expression is returned; otherwise, proceed to step 14.

[0107] 14. Pop elements from the stack until the stack is empty, and save the popped elements to the result set according to the popping order. Return the result set storing the postfix expression.

[0108] According to an embodiment of the present invention, based on Figure 4 The implementation process shown for generating a postfix expression from a set of independent elements is as follows: The set of independent elements (separated by commas) "(,user.level,+,dynamicLevel(user),>,6,&&,user.age,>=,25,),||,(,user.code,==,'superAdmin',),||,adminCheck(user)" is processed, and the resulting postfix expression set (separated by commas) is: "user.level,dynamicLevel(user),+,6,>,user.age,25,>=,&&,user.code,'superAdmin',==,||,adminCheck(user),||".

[0109] According to the technical solution of the present invention, after converting the set of independent elements into a postfix expression, the postfix expression can be calculated based on the parameter information included in the permission verification request to calculate the access condition expression, obtain the permission verification result, and realize the permission verification of the user.

[0110] According to one embodiment of the present invention, calculating the postfix expression based on the parameter information to calculate the access condition expression may specifically include: cyclically reading each element of the postfix expression and performing the following operations until all elements have been read: if the current element is not an operator, then pushing the current element onto a stack; if the current element is an operator, then popping two elements from the stack in sequence as two operation parameters; performing calculations based on the operator and the two operation parameters, and pushing the calculation result onto a stack.

[0111] Before performing calculations based on the operator and the two operation parameters, it is necessary to determine the popped element. If the popped element is a constant, it can be directly used as an operation parameter for subsequent calculations. Otherwise, if the popped element is a user-defined function or variable, it needs to be processed to convert the popped element into a constant for subsequent calculations.

[0112] In one embodiment of the present invention, if the popped element is a user-defined function, the user-defined function is split to obtain a user-defined function name and a user-defined function parameter name; the user-defined function expression is obtained based on the user-defined function name, and the user-defined function parameter value is obtained based on the user-defined function parameter name. If the user-defined function parameter is not a constant, the parameter value corresponding to the user-defined function parameter name is found in the parameter information and used as the user-defined function parameter value; a calculation is performed based on the user-defined function expression and the user-defined function parameter value, and the calculation result is used as the operation parameter corresponding to the user-defined function.

[0113] In another embodiment of the present invention, if the popped element is a variable, the variable is split according to the delimiter to obtain the object identifier and parameter name of the resource to be accessed; the parameter value corresponding to the object identifier and parameter name is found from the parameter information by reflection and used as the operation parameter corresponding to the variable.

[0114] Figure 5 This is a schematic diagram illustrating the calculation process of a postfix expression according to an embodiment of the present invention. For example... Figure 5 As shown, in an embodiment of the present invention, the calculation process of the postfix expression mainly includes the following steps:

[0115] 1. Define a stack to store operands and user-defined functions;

[0116] 2. Determine if there are any unread elements in the result set of the postfix expression. If yes, proceed to step 3; otherwise, end the loop and proceed to step 13.

[0117] 3. Following the order of elements in the result set of the postfix expression, read one element from the result set and execute step 4;

[0118] 4. Determine if the current element being read is an operator. If it is, proceed to step 5; otherwise, push the current element onto the stack and then proceed to step 2.

[0119] 5. Pop two elements from the stack one by one, and for each popped element, execute step 6.

[0120] 6. Determine if the popped element is a constant (e.g., a number 25, or a string constant 'superAdmin', etc.). If it is, use the popped element as the operation parameter and execute step 12; otherwise, execute step 7.

[0121] 7. Determine if the popped element is a user-defined function. If yes, proceed to step 8; otherwise, if the popped element is a variable, proceed to step 11.

[0122] 8. Split the user-defined function to obtain the user-defined function name and the user-defined function parameter name. For example, for the user-defined function dynamicLevel(user), its user-defined function name is dynamicLevel and its parameter name is user. Then, obtain the user-defined function expression based on the user-defined function name, and determine whether the parameter is a constant based on the parameter name. If it is, proceed to step 9; otherwise, proceed to step 10.

[0123] 9. The parameter name is the parameter value. Calculate the function value based on the user-defined function expression and the parameter value, and use the function value as the operation parameter of the user-defined function. Then execute step 12.

[0124] 10. Obtain the parameter value from the parameter information included in the permission verification request based on the parameter name, calculate the function value based on the custom function expression and the parameter value, and use the function value as the operation parameter of the custom function. Then execute step 12.

[0125] 11. Split the variable using the delimiter to obtain the object identifier and parameter name of the resource to be accessed. For example, the variable user.level is split using the delimiter ".", yielding two parts: the object identifier user and the parameter name level. Based on the split data, it can be determined that this variable is to read the value of the level property of the user object. Then, using reflection, find the parameter value corresponding to the object identifier and parameter name from the parameter information included in the permission verification request, and use it as the operation parameter for the variable, then execute step 12.

[0126] 12. Perform calculations based on the operator and two parameters, push the result onto the stack, and then execute step 2.

[0127] 13. Pop the calculation result from the stack and use it as the calculation result of the postfix expression.

[0128] According to the technical solution of the present invention, the calculation result of the postfix expression is the calculation result of the access condition expression, which determines whether access to the resource is allowed or not. The calculation result can then be returned to the business system that invokes the permission verification system.

[0129] Figure 6 This is a schematic diagram of the main modules of an access permission verification device according to an embodiment of the present invention. Figure 6 As shown, the access permission verification device 600 of this embodiment mainly includes a request acquisition module 601, an expression acquisition module 602, and an expression calculation module 603.

[0130] The request acquisition module 601 is used to acquire a permission verification request, which includes the resource identifier and parameter information to be accessed;

[0131] The expression acquisition module 602 is used to acquire the access condition expression corresponding to the resource based on the resource identifier. The access condition expression is generated based on the permission verification configuration information of the resource. The permission verification configuration information includes the parameters to be verified, the verification rules for each parameter, and the logical relationship between different parameters.

[0132] The expression calculation module 603 is used to calculate the access condition expression based on the parameter information using an expression calculation tool to obtain the permission verification result.

[0133] According to one embodiment of the present invention, the verification rules for the parameters include verification rules implemented based on custom functions.

[0134] According to another embodiment of the present invention, the logical relationship between the different parameters is represented based on operators with different priorities.

[0135] According to another embodiment of the present invention, the expression calculation module 603 can also be used to: split the access condition expression into a set of independent elements according to the type of predefined independent elements; convert the set of independent elements into a postfix expression according to the type of the independent elements; and calculate the postfix expression according to the parameter information to calculate the access condition expression.

[0136] According to another embodiment of the present invention, the types of the independent elements include operators, user-defined functions, and operands. When the expression calculation module 603 decomposes the access condition expression to obtain a set of independent elements according to the predefined types of independent elements, it can also be used to: cyclically read each character of the access condition expression, and determine the type of the independent element to which a single character or string belongs according to the predefined types of independent elements, and determine the set of independent elements according to the determination result. Specifically, for the currently read character, if the current character is not an operator, the current character is stored in a pre-established string variable; if the current character is an operator and not a left parenthesis operator, it is determined whether the current character and the next character to be read form a new operator; if so, the current character and the next character are added as an operator to the set of independent elements, and the data stored in the string variable is used as an independent element. If the current character is an operator, add it to the set of independent elements; otherwise, add the current character as an operator to the set of independent elements, and add the data stored in the string variable as an independent element to the set of independent elements. If the current character is a left parenthesis operator, determine whether the string variable stores data. If so, use the current character and the data stored in the string variable as the left half of the user-defined function, and loop to read the next character until the right parenthesis operator is read. Use the read character as the right half of the user-defined function, combine the left and right halves of the user-defined function into a single user-defined function, and add it to the set of independent elements. Otherwise, add the current character as an operator to the set of independent elements. If the string variable still stores data at the end of the loop, add the data stored in the string variable as an independent element to the set of independent elements.

[0137] According to another embodiment of the present invention, when the expression calculation module 603 converts the set of independent elements into a postfix expression based on the type of the independent elements, it can also be used to: cyclically read each element in the set of independent elements, and add the read elements to the postfix expression result set according to the type of the independent elements, wherein, for the current element being read, if the current element is an operand or a user-defined function, the current element is added to the postfix expression result set; if the current element is a left parenthesis operator, the current element is pushed onto a stack; if the current element is a right parenthesis operator, and the top of the stack is not a left parenthesis operator, the elements in the stack are popped sequentially until the top of the stack is a left parenthesis operator, the left parenthesis operator at the top of the stack and the current element are discarded, and the popped elements are saved to the postfix table according to the popping order. In the postfix expression result set; if the current element is not a left parenthesis operator or a right parenthesis operator, and the stack is empty when the current element is read, then push the current element onto the stack; if the current element is not a left parenthesis operator or a right parenthesis operator, and the stack is not empty when the current element is read, then push the current element onto the stack if the priority of the current element is higher than the priority of the top element of the stack; if the priority of the current element is not higher than the priority of the top element of the stack, pop elements from the stack until the top element is a left parenthesis operator or the stack is empty, and save the popped elements to the postfix expression result set according to the popping order, and push the current element onto the stack; if the stack is not empty at the end of the loop, pop elements from the stack sequentially until the stack is empty, and save the popped elements to the postfix expression result set according to the popping order.

[0138] According to another embodiment of the present invention, when the expression calculation module 603 calculates the postfix expression based on the parameter information to calculate the access condition expression, it can also be used to: cyclically read each element of the postfix expression and perform the following operations until all elements are read: if the current element is not an operator, push the current element onto the stack; if the current element is an operator, pop two elements from the stack in sequence as two operation parameters; perform calculation based on the operator and the two operation parameters, and push the calculation result onto the stack.

[0139] According to another embodiment of the present invention, before performing calculations based on the operator and the two operation parameters, the expression calculation module 603 may further be configured to: if the popped element is a user-defined function, split the user-defined function to obtain a user-defined function name and a parameter name of the user-defined function; obtain the user-defined function expression based on the user-defined function name, and obtain the parameter value of the user-defined function based on the parameter name of the user-defined function, wherein if the parameter of the user-defined function is not a constant, find the parameter value corresponding to the parameter name of the user-defined function from the parameter information and use it as the parameter value of the user-defined function; perform calculations based on the user-defined function expression and the parameter value of the user-defined function, and use the calculation result as the operation parameter corresponding to the user-defined function.

[0140] According to another embodiment of the present invention, before the expression calculation module 603 performs calculations based on the operator and the two operation parameters, it can also be used to: if the popped element is a variable, split the variable according to the splitter to obtain the object identifier and parameter name of the resource to be accessed; and search for the parameter value corresponding to the object identifier and the parameter name from the parameter information by reflection, and use it as the operation parameter corresponding to the variable.

[0141] According to the technical solution of this invention, a permission verification request is obtained, which includes the identifier of the resource to be accessed and parameter information. An access condition expression corresponding to the resource is obtained based on the resource identifier. This access condition expression is generated based on the resource's permission verification configuration information, which includes the parameters to be verified, the verification rules for each parameter, and the logical relationships between different parameters. An expression calculation tool is used to calculate the access condition expression based on the parameter information to obtain the permission verification result. This technical solution can generate expressions supporting multiple attributes and complex calculation logic based on the resource's permission verification configuration information, and perform permission verification by calculating these complex expressions. It eliminates the need for customized development for business systems, saving maintenance costs. This solves the technical problems of existing permission verification methods, such as high maintenance costs, lack of flexibility, and inability to support complex calculations of multiple attributes for permission verification. Furthermore, the permission verification method of this invention also supports the setting of custom functions, enabling more flexible permission verification.

[0142] Figure 7 An exemplary system architecture 700 is shown that can be applied to the access permission verification method or access permission verification device of the present invention embodiments.

[0143] like Figure 7As shown, system architecture 700 may include terminal devices 701, 702, and 703, a network 704, and a server 705. Network 704 serves as the medium for providing communication links between terminal devices 701, 702, and 703 and server 705. Network 704 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.

[0144] Users can use terminal devices 701, 702, and 703 to interact with server 705 via network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as resource access applications, web browser applications, search applications, instant messaging tools, social platform software, etc. (for example only).

[0145] Terminal devices 701, 702, and 703 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0146] Server 705 can be a server providing various services, such as a backend management server supporting access permission verification websites sent by users using terminal devices 701, 702, and 703 (for example only). The backend management server can process the received resource access permission verification request, including the resource identifier and parameter information; obtain the access condition expression corresponding to the resource based on the resource identifier, which is generated based on the resource's access permission verification configuration information, including the parameters to be verified, the verification rules for each parameter, and the logical relationships between different parameters; use an expression calculation tool to calculate the access condition expression based on the parameter information, and feed back the processing result (e.g., access permission verification result, authorization information—for example only) to the terminal device.

[0147] It should be noted that the access permission verification method provided in this embodiment of the invention is generally executed by server 705, and correspondingly, the access permission verification device is generally set in server 705.

[0148] It should be understood that Figure 7 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0149] The following is for reference. Figure 8 It shows a schematic diagram of the structure of a computer system 800 suitable for implementing terminal devices or servers of the present invention. Figure 8The terminal device or server shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0150] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 802 or programs loaded from storage section 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the system 800. The CPU 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0151] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 810 as needed so that computer programs read from it can be installed into storage section 808 as needed.

[0152] In particular, according to the embodiments disclosed in this invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit (CPU) 801, it performs the functions defined above in the system of this invention.

[0153] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0154] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0155] The units or modules described in the embodiments of the present invention can be implemented in software or hardware. The described units or modules can also be housed in a processor; for example, a processor can be described as including a request acquisition module, an expression acquisition module, and an expression calculation module. The names of these units or modules do not necessarily limit the specific unit or module itself; for example, a request acquisition module can also be described as "a module for acquiring permission verification requests."

[0156] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, which, when executed by the device, cause the device to include: obtaining a permission verification request, the permission verification request including a resource identifier and parameter information to be accessed; obtaining an access condition expression corresponding to the resource based on the resource identifier, the access condition expression being generated based on the resource's permission verification configuration information, the permission verification configuration information including parameters to be verified, verification rules for each parameter, and logical relationships between different parameters; and using an expression calculation tool to calculate the access condition expression based on the parameter information to obtain a permission verification result.

[0157] According to the technical solution of this invention, a permission verification request is obtained, which includes the identifier of the resource to be accessed and parameter information. An access condition expression corresponding to the resource is obtained based on the resource identifier. This access condition expression is generated based on the resource's permission verification configuration information, which includes the parameters to be verified, the verification rules for each parameter, and the logical relationships between different parameters. An expression calculation tool is used to calculate the access condition expression based on the parameter information to obtain the permission verification result. This technical solution can generate expressions supporting multiple attributes and complex calculation logic based on the resource's permission verification configuration information, and perform permission verification by calculating these complex expressions. It eliminates the need for customized development for business systems, saving maintenance costs. This solves the technical problems of existing permission verification methods, such as high maintenance costs, lack of flexibility, and inability to support complex calculations of multiple attributes for permission verification. Furthermore, the permission verification method of this invention also supports the setting of custom functions, enabling more flexible permission verification.

[0158] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method of verifying access rights, characterized by, include: Obtain a permission verification request, the permission verification request including the resource identifier and parameter information to be accessed; The access condition expression corresponding to the resource is obtained based on the resource identifier. The access condition expression is generated based on the resource's permission verification configuration information. The permission verification configuration information includes the parameters to be verified, the verification rules for each parameter, and the logical relationship between different parameters. Using an expression calculation tool, the access condition expression is calculated based on the parameter information to obtain the permission verification result; The process of using an expression calculation tool to calculate the access condition expression based on the parameter information includes: splitting the access condition expression into a set of independent elements according to the types of predefined independent elements, wherein the types of the independent elements include operators, user-defined functions, and operands; converting the set of independent elements into a postfix expression according to the types of the independent elements; and calculating the postfix expression based on the parameter information to calculate the access condition expression.

2. The method of claim 1, wherein, The validation rules for the parameters include validation rules based on custom functions.

3. The method according to claim 1, characterized in that, The logical relationships between the different parameters are represented based on operators with different priorities.

4. The method according to claim 1, characterized in that, Based on the predefined types of independent elements, the access condition expression is split to obtain a set of independent elements, including: The algorithm iterates through each character of the access condition expression, determines the type of the independent element to which a single character or string belongs based on the predefined type of independent element, and determines the set of independent elements based on the determination result. For the currently read character, If the current character is not an operator, then the current character is stored in a pre-established string variable; If the current character is an operator, and not a left parenthesis operator, then determine whether the current character and the next character to be read form a new operator; if so, add the current character and the next character as an operator to the independent element set, and add the data stored in the string variable as an independent element to the independent element set; otherwise, add the current character as an operator to the independent element set, and add the data stored in the string variable as an independent element to the independent element set. If the current character is a left parenthesis operator, determine whether the string variable stores data; if so, use the current character and the data stored in the string variable as the left half of the user-defined function, and loop to read the next character until the right parenthesis operator is read, use the read character as the right half of the user-defined function, combine the left and right halves of the user-defined function into a single user-defined function, and add it to the set of independent elements; otherwise, add the current character as an operator to the set of independent elements. If the string variable still stores data at the end of the loop, then the data stored in the string variable is added as an independent element to the set of independent elements.

5. The method according to claim 4, characterized in that, Based on the type of the independent elements, the set of independent elements is converted into a postfix expression, including: Iterate through each element in the set of independent elements, and add the read element to the postfix expression result set according to the type of the independent element. For the current element being read, If the current element is an operand or a user-defined function, then add the current element to the postfix expression result set; If the current element is a left parenthesis operator, then push the current element onto the stack; If the current element is a right parenthesis operator and the top of the stack is not a left parenthesis operator, then pop the elements from the stack in sequence until the top of the stack is a left parenthesis operator. Discard the left parenthesis operator at the top of the stack and the current element. Save the popped elements into the postfix expression result set according to the popping order. If the current element is not a left parenthesis operator or a right parenthesis operator, and the stack is empty when the current element is read, then the current element is pushed onto the stack; If the current element is not a left parenthesis operator or a right parenthesis operator, and the stack is not empty when the current element is read, then if the priority of the current element is higher than the priority of the top element of the stack, the current element is pushed onto the stack; if the priority of the current element is not higher than the priority of the top element of the stack, elements in the stack are popped until the top of the stack is a left parenthesis operator or the stack is empty, and the popped elements are saved to the postfix expression result set according to the popping order, and the current element is pushed onto the stack. If the stack is not empty at the end of the loop, pop the elements from the stack one by one until the stack is empty, and save the popped elements into the result set of the postfix expression according to the popping order.

6. The method according to claim 5, characterized in that, Calculating the postfix expression based on the parameter information to evaluate the access condition expression includes: Loop through each element of the postfix expression and perform the following operations until all elements have been read: If the current element is not an operator, then push the current element onto the stack; If the current element is an operator, then pop two elements from the stack in sequence as the two operation parameters; The calculation is performed based on the operator and the two operation parameters, and the calculation result is pushed onto the stack.

7. The method according to claim 6, characterized in that, Before performing calculations based on the operator and the two operational parameters, the following steps are also included: If the popped element is a user-defined function, then the user-defined function is split to obtain the user-defined function name and the parameter names of the user-defined function; The custom function expression is obtained based on the custom function name, and the parameter value of the custom function is obtained based on the parameter name of the custom function. If the parameter of the custom function is not a constant, the parameter value corresponding to the parameter name of the custom function is found in the parameter information and used as the parameter value of the custom function. The calculation is performed based on the custom function expression and the parameter values ​​of the custom function, and the calculation result is used as the operation parameter corresponding to the custom function.

8. The method according to claim 6, characterized in that, Before performing calculations based on the operator and the two operational parameters, the following steps are also included: If the popped element is a variable, then the variable is split according to the splitter to obtain the object identifier and parameter name of the resource to be accessed; By using reflection, the parameter value corresponding to the object identifier and the parameter name is found from the parameter information and used as the operation parameter for the variable.

9. An access permission verification device, characterized in that, include: The request acquisition module is used to acquire the permission verification request, which includes the resource identifier and parameter information to be accessed; The expression acquisition module is used to acquire the access condition expression corresponding to the resource based on the resource identifier. The access condition expression is generated based on the permission verification configuration information of the resource. The permission verification configuration information includes the parameter to be verified, the verification rule for each parameter, and the logical relationship between different parameters. The expression calculation module is used to calculate the access condition expression based on the parameter information using an expression calculation tool to obtain the permission verification result; The expression calculation module is further configured to: split the access condition expression into a set of independent elements according to the types of predefined independent elements, wherein the types of the independent elements include operators, user-defined functions, and operands; convert the set of independent elements into a postfix expression according to the types of the independent elements; and calculate the postfix expression according to the parameter information to calculate the access condition expression.

10. An electronic device for verifying access rights, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-8.

11. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Access control system and process for managing and enforcing an attribute based access control policy

    US20190258811A1

  • Policy-based triggering of revision of access control information

    US20200396222A1