Authority control method and device, storage medium and computer program product
By introducing a role caching mechanism and dynamic permission verification process, user authentication and permission allocation are decoupled, and the duplicate development problem of permission modules caused by business adjustment is solved, computing resources are reduced, and the system maintainability and scalability is improved.
Patent Information
- Application Number
- CN202411031336.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-07-30
AI Technical Summary
During business adjustments of the business platform, the direct reuse permission module cannot meet the customized needs, resulting in repeated development of permission modules and wasting computing resources.
Introduce a role caching mechanism and dynamic permission verification process to decouple user authentication from permission allocation, only update role permission information without changing the authentication logic, simplify the permission management process, and reduce duplicate development.
It reduces the problem of repeated development of permission modules caused by business adjustments, reduces dependence and waste on computing resources, and improves the maintainability and scalability of the system.
Smart Images

Figure CN119066673A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of system operation and maintenance technology, and in particular to permission control methods, devices, storage media and computer program products. Background Art
[0002] The permission module is a core component in the business platform, responsible for controlling and managing users' ability to access system resources, ensuring that each user can only access the functions or data they are authorized to. The design of the permission module usually needs to be closely integrated with specific business logic to meet the specific needs of users with different roles, such as administrators, ordinary employees, customers, etc. Each role can see and operate different content.
[0003] The business platform may require different permission control granularity and rules in different business scenarios. When a new business is launched or an existing business is adjusted, directly reusing the existing permission modules of the business platform may not meet all customized requirements. Therefore, when the business platform undergoes business adjustments, it is usually necessary to redevelop the permission modules. This process involves repeatedly creating similar infrastructure components, such as resetting the database table structure, recreating authentication services, etc. This process of repeatedly creating permission modules requires computing resources, resulting in a waste of computing resources.
[0004] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0005] The main purpose of this application is to provide a permission control method, device, storage medium and computer program product, aiming to solve the technical problem of resource waste when building a permission module of a business platform.
[0006] To achieve the above purpose, the present application proposes a permission control method, which includes:
[0007] Obtaining user login information of a target user, and performing user authentication based on the user login information;
[0008] When the target user passes authentication, creating a role cache;
[0009] Acquire user authority information of the target user, and store the user authority information in the role buffer;
[0010] When an access request initiated by the target user is detected, the access request is intercepted and a request authority of the access request is obtained;
[0011] The user authority information is obtained from the role cache, and when the requested authority is consistent with the user authority information, resource access is performed according to the access request.
[0012] In one embodiment, the step of performing user authentication based on the user login information includes:
[0013] Sending the user login information to a security manager;
[0014] Sending a verification request to the authenticator through the security manager;
[0015] Querying a relational database based on the user identifier carried in the verification request by the authenticator;
[0016] If the authenticator finds the user authority information corresponding to the user identifier, it is determined that the target user identity authentication is passed;
[0017] If the authenticator fails to find the user authority information, it is determined that the target user identity authentication fails.
[0018] In one embodiment, after the step of querying the relational database based on the user identifier carried in the verification request by the authenticator, the method further comprises:
[0019] Sending the user authority information to a cache database through the authenticator;
[0020] Before the step of obtaining the user authority information from the role buffer, the method further comprises:
[0021] The user authority information is obtained from the cache database according to a first preset period, and the most recently obtained user authority information is stored in the role cache.
[0022] In one embodiment, after the step of sending the user authority information to the cache database through the authenticator, the method further comprises:
[0023] When it is detected that the user authority information reaches a preset life cycle, migrating the user authority information to the relational database;
[0024] The data in the cache database is backed up to a distributed search engine or a data warehouse according to a second preset period.
[0025] In one embodiment, the method further comprises:
[0026] Obtain and save the login operation log and permission operation log of the target user according to a third preset period;
[0027] In the case where it is determined that the permission check is triggered, the login operation information and the permission operation information are obtained from the login operation log and the permission operation log;
[0028] Performing a permission check on the target user based on the login operation information and the permission operation information;
[0029] If the permission check fails, the role permission is processed.
[0030] In one embodiment, the step of performing authority recheck on the target user based on the login operation information and the authority operation information includes:
[0031] Determine a user login operation of the target user based on the login operation information, and determine a user authority operation of the target user based on the authority operation information;
[0032] If the user login operation or the user authority operation is consistent with the preset abnormal behavior, it is determined that the target user authority check fails;
[0033] If both the user login operation and the user authority operation are inconsistent with the preset abnormal behavior, it is determined that the target user authority check has passed.
[0034] In one embodiment, the step of processing the role authority includes:
[0035] Determining an abnormal operation consistent with the preset abnormal behavior from the user login operation and the user authority operation;
[0036] An operation type of the abnormal operation is determined, and the target user is processed according to the operation type.
[0037] In addition, to achieve the above-mentioned purpose, the present application also proposes a permission control device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the permission control method described above.
[0038] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the permission control method described above are implemented.
[0039] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the permission control method described above are implemented.
[0040] In the present application, user login information of a target user is obtained, and user authentication is performed based on the user login information; if the target user is authenticated, a role cache is created; user permission information of the target user is obtained, and the user permission information is stored in the role cache; when an access request initiated by the target user is detected, the access request is intercepted and the request permission of the access request is obtained; the user permission information is obtained from the role cache, and if the request permission is consistent with the user permission information, resource access is performed according to the access request.
[0041] In this application, by introducing a role caching mechanism and a dynamic permission verification process, user authentication and permission allocation are decoupled. Even if business adjustments lead to changes in role permissions, it is only necessary to update the permission information corresponding to the role without changing the authentication logic. This simplifies the permission management process and reduces the possibility of reconstructing the permission module due to business adjustments, thereby effectively reducing the problem of repeated development of permission modules caused by business adjustments and reducing dependence on and waste of computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0043] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0044] Figure 1 A flowchart of the first embodiment of the permission control method of this application is provided;
[0045] Figure 2 A flowchart of the second embodiment of the permission control method of this application is provided;
[0046] Figure 3 A schematic diagram of a business platform architecture provided for an implementation method of the present application;
[0047] Figure 4 An authentication timing diagram of a centralized authentication mechanism provided in one embodiment of the present application;
[0048] Figure 5 A schematic diagram of the authorization and interface level control process provided for one embodiment of the present application;
[0049] Figure 6 A schematic diagram of the architecture of a permission system provided for one embodiment of the present application;
[0050] Figure 7 A schematic diagram of a permission check process provided for an implementation method of the present application;
[0051] Figure 8 A schematic diagram of the microservice architecture provided for one embodiment of the present application;
[0052] Fig. 9 A schematic diagram of the structure of data storage provided in one embodiment of the present application;
[0053] Fig.10 A schematic diagram of a configuration center process provided in one embodiment of the present application;
[0054] Fig.11 A schematic diagram of an interface for editing a grayscale publishing task provided in an embodiment of the present application;
[0055] Fig.12 Schematic diagram of the device structure of the hardware operating environment involved in the permission control method in the embodiment of the present application.
[0056] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0057] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0058] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0059] The main solution of the embodiment of the present application is: obtaining user login information of the target user, and performing user authentication based on the user login information; creating a role cache when the target user is authenticated; obtaining user permission information of the target user, and saving the user permission information in the role cache; when an access request initiated by the target user is detected, intercepting the access request and obtaining the request permission of the access request; obtaining the user permission information from the role cache, and when the request permission is consistent with the user permission information, performing resource access according to the access request.
[0060] In this embodiment, for ease of description, the following description is made with the permission control device as the execution subject.
[0061] With the continuous expansion of the bank's business platform and the construction of developer tool platforms, how to quickly access the bank's permission system is a very difficult problem. The permission module is a core component in the business platform, responsible for controlling and managing the user's ability to access system resources, ensuring that each user can only access the functions or data they are authorized to. The design of the permission module usually needs to be closely integrated with the specific business logic to meet the specific needs of users with different roles, such as administrators, ordinary employees, customers, etc. Each role can see and operate different content.
[0062] The business platform may require different permission control granularity and rules in different business scenarios. When a new business is launched or an existing business is adjusted, directly reusing the existing permission modules of the business platform may not meet all customized requirements. Therefore, when the business platform undergoes business adjustments, it is usually necessary to redevelop the permission modules. This process involves repeatedly creating similar infrastructure components, such as resetting the database table structure, recreating authentication services, etc. This process of repeatedly creating permission modules requires computing resources, resulting in a waste of computing resources.
[0063] In addition, since the permission module is too deeply coupled with the business module, it is difficult to configure and take effect immediately after the permission module is built, and permission management is prone to confusion and lacks a flexible permission governance solution.
[0064] In the embodiment of the present application, by introducing a role caching mechanism and a dynamic permission verification process, user authentication and permission allocation are decoupled. Even if business adjustments lead to changes in role permissions, it is only necessary to update the permission information corresponding to the role without changing the authentication logic. This simplifies the permission management process and reduces the possibility of needing to reconstruct the permission module due to business adjustments, thereby effectively reducing the problem of repeated development of permission modules due to business adjustments and reducing dependence on and waste of computing resources.
[0065] In addition, since the logic of user authentication, role management, and permission verification is separated, the system can more flexibly add and modify roles and permission configurations when facing the launch of new businesses or adjustments to existing businesses, without the need to build permission modules from scratch each time. This enhances the maintainability and scalability of the system and the timeliness of permission configuration.
[0066] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a permission control device, etc. The following takes the permission control device as an example to illustrate this embodiment and the following embodiments.
[0067] Based on this, the present application embodiment provides a permission control method, referring to Figure 1This is a flowchart of the first embodiment of the permission control method of this application.
[0068] In this embodiment, the permission control method includes steps S10 to S50.
[0069] Step S10, obtaining user login information of the target user, and performing user authentication based on the user login information.
[0070] It should be noted that the target user is any user who logs into the service platform, and the user login information is the identity information provided by the target user when logging into the service platform, such as user name and password.
[0071] When a user attempts to log into the system, the permission control device first receives and verifies the login information provided by the user, and then authenticates the user login information to confirm the authenticity of the user's identity, ensuring that legitimate users can access the business platform, thereby enhancing the security of the business platform and preventing unauthorized access.
[0072] The method of performing user authentication based on user login information is not described in detail here, and the conventional user authentication process can be referred to. In a feasible implementation, the process of performing user authentication based on user login information can be:
[0073] a1, send the user login information to the security manager.
[0074] When a user attempts to log in, the permission control device collects the user login information entered by the user, and then forwards the user login information to the security manager in the permission control device. The security manager, as a central coordination component, is responsible for handling security-related tasks. By centrally handling security affairs through the security manager, unified security policy management can be achieved, the system architecture can be simplified, and security can be improved.
[0075] a2, send a verification request to the authenticator through the security manager.
[0076] After receiving the user login information, the security manager sends a verification request to the authenticator. The verification request usually contains user identification information for subsequent permission queries.
[0077] By setting up separation of duties between the security manager and the authenticator, each component can focus on its own functional area, improving the maintainability and scalability of the system.
[0078] a3, query the relational database based on the user ID carried in the verification request through the authenticator.
[0079] After receiving the verification request, the authenticator uses the user identifier (such as user name) in the verification request to search the corresponding user record in the relational database. This query process is intended to verify whether the user exists and obtain the user's preset permission information.
[0080] a4. If the authenticator finds the user authority information corresponding to the user ID, it is determined that the target user identity authentication is successful.
[0081] If the database query result shows that the user exists and has the corresponding permission record, the authenticator will determine that the user's identity authentication is successful and the target user can continue to access the system.
[0082] a5. If the authenticator fails to find the user permission information, it is determined that the target user identity authentication fails.
[0083] If no record matching the submitted user ID is found in the database, or the found record lacks necessary permission information, the authenticator will determine that the authentication has failed.
[0084] It should be noted that by setting up a user login authentication mechanism, it can be ensured that only users with legitimate accounts and corresponding permissions can enter the system, effectively preventing unregistered users or users whose permissions have been revoked from accessing the system, further strengthening the security of the system and preventing illegal intrusions.
[0085] Step S20: When the target user passes authentication, a role cache is created.
[0086] When the target user successfully authenticates, the permission control device will create a role cache for the target user to temporarily store the role information associated with the user. This is done to facilitate subsequent quick access and permission verification and reduce database query overhead.
[0087] It should be noted that by creating a role cache, after the user's first successful authentication, his or her role information is saved in the cache. Subsequent access requests only need to query the cache instead of the database, which reduces the pressure on the database, improves the system response speed, reduces dependence on the database, and improves user experience and system efficiency.
[0088] Step S30, obtaining the user authority information of the target user, and storing the user authority information in a role buffer.
[0089] The system queries the corresponding role based on the user ID of the authenticated user and writes the role information into the role cache created previously.
[0090] It should be noted that the role defines the scope of the user's authority within the system. The target user can be assigned to roles and positions, and can have multiple roles and multiple positions. Positions are abstract collections of roles. One position can be assigned multiple roles, and each role corresponds to different permission resources (such as pages, buttons, etc.), thereby achieving the decoupling of user permissions and roles, facilitating the management and adjustment of permission allocation, and simplifying the complexity of permission management.
[0091] Step S40: When an access request initiated by a target user is detected, the access request is intercepted and the request authority of the access request is obtained.
[0092] When an authenticated user attempts to access specific resources or perform an operation, the permission control device will first intercept the request through the middleware or permission control module and analyze the permission requirements contained in the request, that is, determine what permissions are required for the resources the user is trying to access or the operation he is trying to perform.
[0093] Step S50, obtaining user authority information from the role cache, and performing resource access according to the access request when the requested authority is consistent with the user authority information.
[0094] The permission control device compares the permission required by the access request with the permission possessed by the user permission information in the role buffer. If a match is successful, it means that the user has the permission to perform the operation and the system allows access; otherwise, the access request is denied.
[0095] It should be noted that this embodiment can implement fine-grained permission control, ensuring that each user can only access and operate the resources for which they are authorized, effectively preventing permission abuse and data leakage, and maintaining the safe and stable operation of the system.
[0096] In this embodiment, by introducing a role caching mechanism and a dynamic permission verification process, even if business adjustments lead to changes in role permissions, it is only necessary to update the permission information corresponding to the role without changing the authentication logic. This simplifies the permission management process, reduces the possibility of reconstructing the permission module due to business adjustments, effectively reduces the problem of repeated development of permission modules caused by business adjustments, and reduces dependence on and waste of computing resources.
[0097] In addition, since the logic of user authentication, role management, and permission verification is separated, the system can more flexibly add and modify roles and permission configurations when new businesses are launched or existing businesses are adjusted, without the need to build permission modules from scratch each time, which enhances the maintainability and scalability of the system.
[0098] In a feasible implementation manner, after the step of querying the relational database based on the user identifier carried in the verification request by the authenticator, the permission control method further includes:
[0099] Step S60: Send the user authority information to the cache database through the authenticator.
[0100] The authenticator queries the user permission information corresponding to the user ID in the relational database, and sends the queried user permission information to the cache database for storage. The cache database is usually an in-memory database or a high-speed cache system, designed to quickly read data and reduce direct access to the main database. By storing frequently queried user permission information in the cache database, the speed of subsequent permission verification can be significantly improved, system latency can be reduced, and user experience can be improved.
[0101] It should be noted that user authority information refers to information that characterizes the scope of user authority, including at least the user role, and may also include the authority resources of the user role, etc., which is not limited here.
[0102] In this implementation, before step S40: obtaining user authority information from the role buffer, the authority control method further includes step S70.
[0103] Step S70: acquiring user authority information from the cache database according to a first preset period, and storing the most recently acquired user authority information in the role cache.
[0104] A fixed period (ie, the first preset period) is pre-set, during which user authority information is automatically retrieved from the cache database and the content in the role cache is updated to ensure that the user authority information stored in the role cache is the latest and can be reflected in a timely manner even if the user's role authority changes in the background.
[0105] By updating the user permission information in the role cache, dynamic updating of user permission information is achieved, ensuring the real-time and accuracy of permission control, reducing the frequency of direct queries to the main database, further optimizing system performance, and ensuring the flexibility and security of permission management. Through regular synchronization, the system can adapt to the immediate adjustment of user permissions, avoiding misjudgment of permissions due to information lag, and improving the reliability and responsiveness of the system.
[0106] In a feasible implementation manner, after the user authority information is sent to the cache database through the authenticator in step S60, the authority control method further includes steps S80 to S90.
[0107] Step S80: When it is detected that the user authority information reaches a preset life cycle, the user authority information is migrated to a relational database.
[0108] In order to maintain data consistency and persistence, a preset life cycle is pre-set, which is the effective period of user permission information in the cache database. When the user permission information is stored in the cache database for a preset life cycle, the user permission information is moved from the cache database to the relational database for storage.
[0109] It should be noted that by migrating user permission information to a relational database, it is ensured that even if the cache database loses data for some reason, it will not affect the long-term record of user permissions, thus enhancing data reliability. At the same time, by cleaning up expired cache data, it helps to optimize the use efficiency of cache space and maintain the efficiency of system operation.
[0110] Step S90: backing up the data in the cache database to the distributed search engine or data warehouse according to a second preset period.
[0111] A second preset period is pre-set, and the data in the cache database is backed up to a distributed search engine or data warehouse (Elasticsearch, ES) at regular intervals according to this period.
[0112] In this implementation, an additional layer of data security is provided by backing up data to ES. Even in extreme cases, such as when both the main database and the cache database fail, permission information can be quickly restored through backup data, reducing the risk of data loss. In addition, ES's efficient retrieval capabilities also facilitate data analysis and auditing, helping system administrators better understand permission usage and promptly identify potential security threats or abnormal behaviors, thereby improving the overall security management level and decision-making efficiency of the system. In summary, these two steps jointly improve the performance of the permission control system in terms of data management, security, and operational efficiency by enhancing data persistence, recoverability, and analysis capabilities.
[0113] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. Figure 2 The permission control method also includes steps A10 to A40.
[0114] Step A10: Obtain and save the target user's login operation log and permission operation log according to a third preset period.
[0115] The authority control device obtains and saves the target user's login operation log and authority operation log according to the third preset period, and specifically, may save them in the ES.
[0116] The login operation log is a record of the target user's login activities, such as login time, IP address (Internet Protocol Address), etc. The permission operation log is a record of the target user's permission operations, such as the resources the user attempted to access, the type of operation, etc. Log data is crucial for monitoring user behavior, auditing, and security analysis.
[0117] By storing operation logs, it is easy to review user activities afterwards, detect abnormal logins or unauthorized operations, and enhance the security and compliance of the system.
[0118] Step A20, when it is determined that the permission check is triggered, the login operation information and the permission operation information are obtained from the login operation log and the permission operation log.
[0119] When the permission control device detects a situation that requires permission review, for example, triggering a preset rule, a specific time point, or discovering suspicious behavior, it will extract the target user's operation information from the login operation log and the permission operation log, that is, the login operation information and the permission operation information. The login operation information includes but is not limited to the frequency, time, and location of the login, and the permission operation information includes but is not limited to the user's specific permission operations.
[0120] It should be noted that by proactively identifying scenarios that require review, we can respond to potential risks in a timely manner, reduce the occurrence of security vulnerabilities, and improve the speed of response to abnormal behavior.
[0121] Step A30: Perform a permission check on the target user based on the login operation information and the permission operation information.
[0122] Using the collected login and permission operation information, the permission control device re-evaluates whether the user's behavior is consistent with the permissions granted to it, realizes dynamic permission management, ensures the correctness and timeliness of user permissions, prevents permission abuse, and increases the security of the system.
[0123] It should be noted that the permission check process is not limited here and can be set according to actual needs. For example, in one feasible implementation, the login operation information and the permission operation information can be compared with the preset abnormal behavior to perform permission check; in another feasible implementation, the login operation information and the permission operation information can also be input into a pre-trained abnormal recognition model, which uses the login operation information (hereinafter referred to as historical login information) and the permission operation information (hereinafter referred to as historical permission information) with known abnormal detection results as input data, and is trained with the abnormal detection results corresponding to the historical login information and the historical permission information as training labels.
[0124] Specifically, in a feasible implementation, the process of performing permission check on the target user based on the login operation information and the permission operation information may be:
[0125] b1, determining a user login operation of the target user based on the login operation information, and determining a user permission operation of the target user based on the permission operation information.
[0126] Analyze information in the login operation log, such as login time, login location (IP address), login device, etc., to identify the user's login pattern. For example, if a user usually logs in from the company network during working hours, and suddenly there is a login attempt from a remote location late at night, this may be considered an anomaly.
[0127] Review the permission operation logs to see if the operations actually performed by users match the permissions they are granted. For example, if a normal user attempts to access sensitive data that only administrators can view, this will be marked as a permission operation anomaly.
[0128] b2. If the user login operation or the user permission operation is consistent with the preset abnormal behavior, it is determined that the target user permission check fails.
[0129] If any login behavior or permission operation of the user matches the pre-set abnormal behavior pattern (such as frequent failed login attempts, logging in during non-working hours, operations beyond the scope of permission, etc.), the permission control device will determine that the permission check has failed, which means that there may be security risks or violations.
[0130] b3. If both the user login operation and the user permission operation are inconsistent with the preset abnormal behavior, it is determined that the target user permission backcheck has passed.
[0131] If the user's login and permission operation records show normal behavior and do not violate any preset abnormal behavior rules, the permission control device will consider that the permission check has passed successfully, indicating that the user's login and operation permission use are compliant and safe.
[0132] Step A40: If the permission check fails, the role permission is processed.
[0133] If the permission review finds that the user's behavior exceeds the scope of their authority, or the user's status does not meet the requirements (such as the account has expired), the permission control device will take corresponding measures to ensure system security. The measures include but are not limited to: restricting or revoking some permissions, forcing users to re-authenticate, recording illegal operations and issuing alarms, etc.
[0134] It should be noted that permission backchecking can promptly correct permission abuse or improper use, protect system resources from unauthorized access threats, and strengthen internal security management and control to ensure stable system operation and data security. And by continuously monitoring and analyzing user behavior, timely discover and respond to potential unauthorized access and permission abuse, and effectively prevent security threats. Ensure that user activities comply with the organization's security policies and compliance requirements, reduce illegal operations, and improve the organization's compliance level. In addition, this implementation method can improve the system's adaptability and defense capabilities by dynamically adjusting the permission review strategy and adjusting the security threshold according to actual operation behavior.
[0135] In one feasible implementation, step A10, processing the role authority, includes:
[0136] Step A101, determining abnormal operations consistent with preset abnormal behaviors from user login operations and user authority operations.
[0137] The permission control device first analyzes the login operation log and permission operation log to identify those operations that match the preset abnormal behavior pattern. Abnormal operations may include but are not limited to frequent failed login attempts, logins at unusual time periods (such as late at night), logins from unknown or high-risk areas, attempts to access unauthorized resources, etc. Through algorithms or preset rules, the system automatically filters out these operations that deviate from normal behavior patterns and marks them as abnormal operations.
[0138] Step A102, determining the operation type of the abnormal operation, and processing the target user according to the operation type.
[0139] When abnormal operations are identified, the permission control device will further classify the nature or type of these operations. For example, abnormal operations can be classified into different categories such as login-related abnormalities and permission abuse abnormalities. Depending on the type of abnormal operation, the permission control device will take different processing measures.
[0140] For example, if it is a login-related exception, the account may be temporarily locked and the user may be required to reactivate through secondary verification; if it is a permission abuse exception, the permission control device may immediately revoke or restrict the user's specific permissions, and notify the permission control device administrator or security team to intervene in the investigation.
[0141] This implementation automatically identifies and classifies abnormal operations when an abnormality is detected during permission rechecking, so that the system can quickly take targeted measures to effectively curb potential security threats and reduce losses. In addition, customized processing plans are provided based on the specific type of abnormal operation, which can effectively prevent accidental harm to normal users and accurately combat malicious behavior, thereby improving the effectiveness of security measures.
[0142] For example, in order to help understand the technical concept or technical principle of the permission control after the present embodiment is combined with the above-mentioned embodiment 1 and embodiment 2, the business platform in the present embodiment can provide a distributed stress testing engine service. Figure 3 The overall framework of the business platform can include: user center, resource center, authority management center, approval center, audit center, open capability modules and basic services.
[0143] User Center: This area mainly includes functions such as permission search, self-service permission application, intelligent permission recommendation, and unified permission view. Among them, permission search may be used to find and manage user permission information; self-service permission application allows users to apply for the required permissions by themselves; intelligent permission recommendation may be based on a certain algorithm to automatically recommend appropriate permissions to users; and the unified permission view provides a comprehensive perspective to view and manage all permissions.
[0144] Resource Center: This section covers menu resources, button resources, URL (Uniform Resource Locator) resources, data resources, and custom resources. These are objects that can be accessed and controlled within the system. For example, menu resources may refer to various functional options within the application, button resources refer to specific interactive elements, URL resources represent accessible web addresses, data resources involve system data access permissions, and custom resources may refer to some special resources that users can customize according to their own needs.
[0145] Permission Management Center: This part consists of user system, functional permissions and data permissions. The user system may involve the creation, management and maintenance of user accounts; functional permissions restrict the operations that users can perform; data permissions focus on the user's access and operation permissions to specific data. In addition, there is ETL (Extract-Transform-Load, full data synchronization) full synchronization, which is usually used in the construction of data warehouses to extract and transform data from different sources and then load it into the target storage.
[0146] Approval Center: This provides functions for approval template management, role and position approval, API (Application Programming Interface) approval, and approval process viewing. Approval template management may be used to set and manage standard templates for approval processes; role and position approval may involve setting approval permissions for different roles and positions; API approval may be used to approve access to application programming interfaces; and approval process viewing allows users to understand and track the approval process.
[0147] Audit Center: Audit rules, audit log reporting, audit alerts, and audit result queries constitute the main content of the Audit Center. Audit rules define how to monitor and evaluate system activities; audit log reporting is responsible for collecting and reporting logs of these activities; audit alerts will issue warnings when abnormal situations are found; and audit result queries allow users to query and analyze the results of audits.
[0148] Open capability module: displays the interfaces and services provided by the system, including authentication services, role permissions, job roles, micro front-ends, style isolation, permission configuration, one-stop data management, one-number access, operating organizations, and interface authentication. These functions may be used to integrate with other systems or be provided to third-party developers.
[0149] Basic services: Finally, the basic services include tenant isolation, front-end component packaging, interface authentication, and StarterKit toolkit (a collection of basic components, documents, sample codes, and tutorials provided to help users quickly start a project, use a platform, or use a technology). Tenant isolation is a security measure in a multi-tenant architecture that ensures data and resource isolation between different users; front-end component packaging may be used to build and deploy front-end interfaces; interface authentication is to authorize and authenticate system interfaces; and StarterKit toolkit may be a set of tools to help developers quickly get started and use.
[0150] 1.1. The business platform adopts a centralized authorization mechanism and interface authority control with zero business code intrusion. Specifically:
[0151] (1) Please refer to Figure 4 , the authentication process of the centralized authentication mechanism can be:
[0152] The user initiates a login request (Login) and sends a message to the unified login.
[0153] After receiving the request, the unified login forwards the request to the security manager for authentication (that is, sends the user login information to the security manager).
[0154] After receiving the authentication request, the security manager sends a verification request to the authenticator (that is, sends a verification request to the authenticator through the security manager).
[0155] The authenticator obtains user authority information from the relational database, performs authentication based on the user authority information, and returns the result to the security manager (that is, the authenticator queries the relational database based on the user identifier carried in the verification request).
[0156] If the authentication is successful, the security manager returns a Token to the target user; if the authentication fails, the security manager returns 401 (that is, if the authenticator queries the user permission information corresponding to the user ID, it is determined that the target user identity authentication is successful; if the authenticator does not query the user permission information, it is determined that the target user identity authentication is unsuccessful).
[0157] At the same time, the authenticator will cache the user authority information from the relational database to the cache database. If the authentication is successful, the security manager creates a Session (role cache), and the Session manager caches the user authority information from the cache database to the role cache (that is, the user authority information is sent to the cache database through the authenticator, the user authority information is obtained from the cache database according to the first preset period, and the most recently obtained user authority information is stored in the role cache).
[0158] (2) Please refer to Figure 5 , the process of authorization and interface level control can be:
[0159] 1) Access the system interface. 2) The authorizer intercepts the access request. 3) Determine whether the user carried in the access request is in the whitelist. If in the whitelist, access is allowed. 4) If not in the whitelist, determine whether a session exists. If no session exists, access is denied. 5) If a session exists, check whether the session user has permission annotations for the corresponding resources, positions, and roles. 6) If the session user does not have permission annotations for the corresponding resources, positions, or roles, access is denied; if the session user has permission annotations for the corresponding resources, positions, and roles, access is allowed. (That is, when an access request initiated by the target user is detected, the access request is intercepted and the request permission for the access request is obtained; the user permission information is obtained from the role cache, and if the request permission is consistent with the user permission information, resource access is performed according to the access request).
[0160] When the access system backend service is called, the authorizer of the SDK (Software Development Kit) security manager will intercept it to implement interface-level verification. All interfaces other than the whitelist interface (configured by the access party) need to verify the Session, that is, the user who has passed the authentication. The SDK provides interface-level permission annotations @RequiresRoles (having roles), @RequiresPosts (having posts), and @RequiresPermissions (having resource permissions), and implements interface permission control by adding different annotations to the interface. In order to improve authorization efficiency, a permission distributed cache is introduced to cache the user's personal permissions, and finally returns whether the access is successful or unauthorized after the permission verification.
[0161] 1.2. In this implementation, the permission module of the business platform also includes an intelligent permission audit strategy, specifically:
[0162] (1) The permission operation log is automatically expanded. Please refer to Figure 6 ,The architecture of the general permission background system mainly includes the following parts:
[0163] SDKs: There are three different SDKs (SDK1, SDK2, SDK3), which are integrated into different applications to interact with the general permission background system.
[0164] Kafka (open source distributed stream processing platform) log reporting: When an application uses the SDK to perform operations, corresponding log records will be generated and sent to the Kafka message queue.
[0165] Log collection service: It consists of Server1, Server2 and Server3 (Sever: service), which consume log messages from Kafka and process them.
[0166] Audit monitoring: Analyze the collected logs, including alarm rule configuration, abnormal login detection, duplicate login detection, and operation auditing.
[0167] Type in ES index: The processed logs are stored in Elasticsearch. A new index is automatically generated for each application every month, and a type is automatically generated for each type of operation log.
[0168] ES: As the underlying data storage and service provider, it saves all log data and provides search and analysis functions for upper-level applications.
[0169] The main workflow based on this system architecture is: the application communicates with the general permission background through the SDK, and the generated logs are transmitted through Kafka; the log collection server receives and processes these logs, and then sends the processing results to the audit monitoring link; finally, all log data is stored in Elasticsearch for subsequent query and analysis.
[0170] The platform provides a general login and permission operation log storage service to facilitate subsequent audit needs. The SDK automatically reports the login operation log asynchronously through kafka. The permission operation is uniformly reported by the general permission system background, and the log is stored in Elasticsearch according to the type. In order to meet the continuous growth of the docking system, the log data model layer supports automatic expansion: each docking system corresponds to an appKey (Application Key), and each appkey automatically creates an index according to the template and date, which supports automatic expansion; each type of log corresponds to a type in the Elasticsearch index. When a new permission operation log is added, the type is automatically created.
[0171] (2) Intelligent permission check. Please refer to Figure 7As shown, the authority information of the system access party is reviewed at the end of the day. The review rules include: cleaning up resigned personnel, abnormal personnel login, data authority and organization mismatch, and authority duplication. Specifically, the authority review process can be:
[0172] 1) Permission review rule configuration, default support: cleanup of resigned personnel, abnormal personnel login, data permission and organization mismatch, and permission duplication. 2) Scheduled scheduler schedules task review. 3) Rule parser obtains permission information and determines whether the review rule is hit. 4) Notify the target user. 5) Access party confirmation (that is, when it is determined that the permission review is triggered, the login operation information and permission operation information are obtained from the login operation log and permission operation log; the target user is reviewed based on the login operation information and permission operation information; if the permission review fails, the role permission is processed).
[0173] 1.3. The permission module of the business platform can also achieve high availability and stability of the permission API interface. Specifically,
[0174] (1) Microservice architecture, please refer to Figure 8 In order to ensure the stability and high availability of the permission API service module, the general permission platform splits the module into microservices and separates the core external API interface services from the internal non-core services. Microservices are deployed in multiple AZs (Availability Zones) and multiple instances to prevent service unavailability due to a single instance failure.
[0175] (2) High-performance solution for permission data. For details, please refer to Fig. 9 The structural diagram of the data storage shown in the figure shows that the data of each microservice is stored in a Mysql (relational database) sub-database, and mycat (the name of the source database middleware project, used for database sub-database and table sub-database, read-write separation, data routing, etc.) is used for read-write separation, and service circuit breaking and degradation are supported to ensure high availability of the service. Hot data such as roles and resources are cached in Redis to improve the performance of the API interface, and are automatically queried in Mysql when the Redis (cache) cache is unavailable. Inactive data such as permission operation records, login operation logs, and daily historical backup data are stored in Elasticsearch for auditing and downgrade protection. Circuit breaking is also supported when the service is unavailable to ensure the availability of core services.
[0176] (3) Implement high-performance gateway grayscale based on Nacos. Specifically, implement high-performance gateway grayscale based on Nacos (Nacos Config Service, an open source distributed configuration management platform): Introduce the Starter launcher in the Spring Cloud Gateway gateway, and the gateway can have the grayscale release function.
[0177] Reference Fig.10 As shown in the flowchart, the process of Nacos configuration center can be:
[0178] The management end edits the grayscale release task. The interface for editing the grayscale release task can be as follows Fig.11 As shown, the specific grayscale release content includes gateway service, source address, grayscale address and grayscale rules.
[0179] Nacos configuration center synchronizes the configuration of Nacos configuration file, and after the configuration is completed, the data MD5 value (MessageDigest Algorithm 5, a commonly used hash function used to generate the digest or checksum of the message) is checked. Then it is determined whether the MD5 value has changed. If it has not changed, it returns to continue the data MD5 value check; if it has changed, the local cache is updated on the gateway side.
[0180] The gateway starts the gateway, registers the gateway Filter (component) for grayscale verification, registers the NacosConfig Service (Nacos) for the gateway, obtains the Nacos configuration and registers the listener. When the MD5 value changes, the local cache is updated, and then the user request is filtered through the filter. The gateway reads the grayscale rules and updates the Route (router) object.
[0181] Since the Nacos configuration center is used to store grayscale rules, the gateway side monitors the changes of the configuration files under the specified Namespace through the Nacos Client Api (Nacos click interface), and obtains the change data to the local cache in quasi-real time through long polling. Compared with the solution using Redis, the grayscale configuration performance of this implementation is better. At the same time, since only the local cache is read, the service unavailability caused by Redis downtime in the Redis grayscale solution is also avoided.
[0182] In this implementation, 1) decoupling of permissions and business implementation, providing componentized services to support secondary development; 2) one-stop permission center service, providing fast access to SAAS tenants (Software as a Service); 3) integration of classic permission models with the bank's internal permission system; 4) intelligent permission governance and audit services.
[0183] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the permission control method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0184] The present application also provides a permission control device, which adopts the permission control method in the above embodiment to solve the problem of resource waste when building the permission module of the business platform. Compared with the prior art, the beneficial effects of the permission control device provided by the present application are the same as the beneficial effects of the permission control method provided by the above embodiment, and other technical features in the permission control device are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0185] The present application provides a permission control device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the permission control method in the above-mentioned embodiment one.
[0186] Reference below Fig.12 , which shows a schematic diagram of the structure of a permission control device suitable for implementing the embodiment of the present application. The permission control device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.12 The permission control device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0187] like Fig.12As shown, the authority control device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the authority control device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the permission control device to communicate with other devices wirelessly or wired to exchange data. Although the permission control device with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided alternatively.
[0188] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0189] The permission control device provided by the present application adopts the permission control method in the above embodiment, which can solve the problem of resource waste when building the permission module of the business platform. Compared with the prior art, the beneficial effects of the permission control device provided by the present application are the same as the beneficial effects of the permission control method provided by the above embodiment, and the other technical features in the permission control device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0190] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0191] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0192] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the permission control method in the above-mentioned embodiment.
[0193] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0194] The computer-readable storage medium may be included in the authority control device; or may exist independently without being assembled into the authority control device.
[0195] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the permission control device, the permission control device: obtains the user login information of the target user, and performs user authentication based on the user login information; creates a role cache when the target user is authenticated; obtains the user permission information of the target user, and saves the user permission information in the role cache; when an access request initiated by the target user is detected, intercepts the access request and obtains the request permission of the access request; obtains the user permission information from the role cache, and when the request permission is consistent with the user permission information, performs resource access according to the access request.
[0196] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0197] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0198] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0199] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned permission control method, and can solve the waste of resources when building the permission module of the business platform. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the permission control method provided in the above-mentioned embodiment, and will not be repeated here.
[0200] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned permission control method when executed by a processor.
[0201] The computer program product provided by this application can solve the problem of resource waste when building the permission module of the business platform. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the permission control method provided by the above embodiment, which will not be repeated here.
[0202] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A permission control method, characterized in that: The method includes: Obtaining user login information of a target user, and performing user authentication based on the user login information; When the target user passes authentication, creating a role cache; Acquire user authority information of the target user, and store the user authority information in the role buffer; When an access request initiated by the target user is detected, the access request is intercepted and a request authority of the access request is obtained; The user authority information is obtained from the role cache, and when the requested authority is consistent with the user authority information, resource access is performed according to the access request.
2. The method according to claim 1, characterized in that The step of performing user authentication based on the user login information includes: Sending the user login information to a security manager; Sending a verification request to the authenticator through the security manager; Querying a relational database based on the user identifier carried in the verification request by the authenticator; If the authenticator finds the user authority information corresponding to the user identifier, it is determined that the target user identity authentication is passed; If the authenticator fails to find the user authority information, it is determined that the target user identity authentication fails.
3. The method according to claim 2, characterized in that After the step of querying the relational database based on the user identifier carried in the verification request by the authenticator, the method further comprises: Sending the user authority information to a cache database through the authenticator; Before the step of obtaining the user authority information from the role buffer, the method further comprises: The user authority information is obtained from the cache database according to a first preset period, and the most recently obtained user authority information is stored in the role cache.
4. The method according to claim 3, characterized in that After the step of sending the user authority information to the cache database through the authenticator, the method further comprises: When it is detected that the user authority information reaches a preset life cycle, migrating the user authority information to the relational database; The data in the cache database is backed up to a distributed search engine or a data warehouse according to a second preset period.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Obtain and save the login operation log and permission operation log of the target user according to a third preset period; In the case where it is determined that the permission check is triggered, the login operation information and the permission operation information are obtained from the login operation log and the permission operation log; Performing a permission check on the target user based on the login operation information and the permission operation information; If the permission check fails, the role permission is processed.
6. The method as claimed in claim 5, characterized in that The step of performing authority recheck on the target user based on the login operation information and the authority operation information includes: Determine a user login operation of the target user based on the login operation information, and determine a user authority operation of the target user based on the authority operation information; If the user login operation or the user authority operation is consistent with the preset abnormal behavior, it is determined that the target user authority check fails; If both the user login operation and the user authority operation are inconsistent with the preset abnormal behavior, it is determined that the target user authority check has passed.
7. The method as claimed in claim 6, characterized in that The step of processing the role authority includes: Determining an abnormal operation consistent with the preset abnormal behavior from the user login operation and the user authority operation; An operation type of the abnormal operation is determined, and the target user is processed according to the operation type.
8. A permission control device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the permission control method according to any one of claims 1 to 7.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the permission control method according to any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the permission control method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Micro-service access method, device and equipment and storage medium
CN112615849A
General dynamic data retrieval configuration method and system
CN115840847A
Systems, methods, and apparatuses for implementing a role based access control and authorization validator via blockchain smart contract execution using distributed ledger technology (DLT)
US20200344233A1
Cited By
Multi-role collaborative management architecture based on RBAC + HIS synchronization
CN120354459A
Playing equipment hierarchical access authority control method based on identity recognition
CN122578910A
