A permission control system, method, device, medium and product
By obtaining the user's API on the server side and performing access control based on the association between pre-configured permission resources and the API, the problem of repeatedly writing permission control logic on the front end and the back end is solved, resulting in a reduction in code volume and simplification of maintenance.
Patent Information
- Application Number
- CN202111433945.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2041-11-29
AI Technical Summary
Existing technologies, when requiring access control on both the front-end and back-end, result in a large amount of redundant access control logic code, making them difficult to maintain.
By obtaining the user's API on the server side and controlling permissions based on the association between pre-configured permission resources and the API, both the front-end and the server side perform permission control at the interface level, reducing the need to repeatedly write permission control logic code.
It reduces code redundancy, simplifies code logic, improves maintenance efficiency and security, and reduces the amount of code.
Smart Images

Figure CN116186723B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to an access control system, method, apparatus, computer-readable storage medium, and computer program product. Background Technology
[0002] With the continuous development of computer technology, especially mobile internet technology, service providers (such as business systems) can offer users a wide variety of business services. Generally, business systems provide corresponding business services to users based on their access permissions (such as permission identifiers).
[0003] To ensure the security of the business system, the approach of controlling access through a single front-end page has been changed to one that requires access control on both the front-end page and the server side. This prevents users from bypassing the front-end page's access control and directly obtaining relevant business services (such as private content, paid content, etc.) from the server.
[0004] Hard-coding is typically used to provide finer-grained control over user permissions. However, when both the front-end and back-end require permission control, code for judging permissions needs to be written on both sides. Therefore, hard-coding permission control generates a large amount of redundant permission control logic, significantly increasing code size and making it difficult to maintain. Summary of the Invention
[0005] The purpose of this disclosure is to provide an access control system, method, device, computer-readable storage medium, and computer program product that can significantly reduce the amount of code and is easy to maintain.
[0006] Firstly, this disclosure provides an access control system, including a front-end and a server;
[0007] The front end is used to send the user's user identifier to the server;
[0008] The server is configured to obtain the user's permission resources based on the user identifier; obtain the user's API from the pre-configured association between permission resources and application programming interface (API) based on the user's permission resources; and return the user's API to the front end.
[0009] The front end is used to invoke the access control logic. When authentication is successful, it sends an API call request corresponding to the user-triggered operation to the server. The access control logic instructs the API corresponding to the operation to be authenticated based on the user's API.
[0010] The server is used to invoke the permission control logic according to the API call request corresponding to the operation, and respond to the API call request corresponding to the operation when the authentication is successful.
[0011] Secondly, this disclosure provides an access control method applied to a server, the method comprising:
[0012] The server receives a user identifier sent by the front end, obtains the user's permission resources based on the user identifier, obtains the user's API from the pre-configured association between permission resources and application programming interface (API) based on the user's permission resources, and returns the user's API to the front end.
[0013] The server receives the API request corresponding to the user-triggered operation sent when the front-end calls the permission control logic and the authentication is successful. Based on the API call request corresponding to the operation, the server calls the permission control logic. When the authentication is successful, the server responds to the API call request corresponding to the operation. The permission control logic instructs the server to authenticate the API corresponding to the operation based on the user's API.
[0014] Thirdly, this disclosure provides an access control method applied to a front-end, the method comprising:
[0015] The front end sends the user's user identifier to the server;
[0016] The front end receives the user's API returned by the server. The user's API is obtained by the server from the association between pre-configured permission resources and application programming interface APIs through the user's permission resources. The user's permission resources are obtained by the server based on the user identifier.
[0017] The front-end invokes the permission control logic, and when authentication is successful, sends an API call request corresponding to the user-triggered operation to the server; wherein, the permission control logic instructs to authenticate the API corresponding to the operation based on the user's API.
[0018] Fourthly, this disclosure provides a server-side component, including:
[0019] A communication unit, used to identify the user identifier sent by the receiving front end;
[0020] The acquisition unit is configured to acquire the user's permission resources based on the user identifier, and acquire the user's API from a pre-configured association between permission resources and application programming interface (API) based on the user's permission resources; the user's API is obtained by the server from the pre-configured association between permission resources and application programming interface (API) through the user's permission resources, and the user's permission resources are obtained by the server based on the user identifier;
[0021] The communication unit is also used to return the user's API to the front end and receive API call requests corresponding to operations sent by the front end;
[0022] The authentication unit invokes the permission control logic, and when authentication is successful, responds to the API call request corresponding to the operation; wherein, the permission control logic instructs to authenticate the API corresponding to the operation based on the user's API.
[0023] Fifthly, this disclosure provides a front-end, including:
[0024] The communication unit is used to send the user's user identifier to the server and receive the user's API returned by the server.
[0025] An authentication unit is used to invoke the access control logic, which instructs the API corresponding to the operation to be authenticated based on the user's API.
[0026] The communication unit is also used to send an API call request corresponding to the user-triggered operation to the server when authentication is successful.
[0027] In a sixth aspect, this disclosure provides a computer-readable medium having a computer program stored thereon that, when executed by a processing device, implements the steps of the method described in any of the second aspects of this disclosure.
[0028] In a seventh aspect, this disclosure provides an electronic device, comprising:
[0029] A storage device on which computer programs are stored;
[0030] A processing apparatus for executing the computer program in the storage device to implement the steps of the method according to any one of the second aspects of this disclosure.
[0031] Eighthly, this disclosure provides a computer program product containing instructions that, when run on a device, cause the device to perform the method described in any implementation of the second aspect above.
[0032] As can be seen from the above technical solutions, this disclosure has the following advantages:
[0033] In this access control system, based on the pre-configured association between access resources and APIs, the frontend can obtain the user's API from the server, then call the access control logic for frontend authentication. After successful frontend authentication, the server, based on the API call request sent by the frontend, calls the aforementioned access control logic for server-side authentication. This eliminates the need to repeatedly write access control logic code, reducing code redundancy and facilitating maintenance. Furthermore, since the access control logic authenticates based on the user's API and the corresponding API for the operation, both the frontend and server perform access control at the interface level, further simplifying the code logic, reducing code size, and making it easier to maintain.
[0034] Other features and advantages of this disclosure will be described in detail in the following detailed description section. Attached Figure Description
[0035] To more clearly illustrate the technical methods of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below.
[0036] Figure 1 A system architecture diagram of an access control system provided in this disclosure embodiment;
[0037] Figure 2 A flowchart of an access control method provided in an embodiment of this disclosure;
[0038] Figure 3 This is a schematic diagram illustrating the association between a permissioned resource and an API, provided in an embodiment of this disclosure.
[0039] Figure 4 A schematic diagram of an interactive interface provided in an embodiment of this disclosure;
[0040] Figure 5 A flowchart of an access control logic provided in an embodiment of this disclosure;
[0041] Figure 6 A schematic diagram of a prompting interface provided in an embodiment of this disclosure;
[0042] Figure 7 A schematic diagram of a server provided in an embodiment of this disclosure;
[0043] Figure 8 A schematic diagram of a front end provided for an embodiment of this disclosure;
[0044] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0045] The terms "first" and "second" used in the embodiments of this disclosure are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.
[0046] First, some technical terms involved in the embodiments of this disclosure will be introduced.
[0047] The front-end refers to the webpage displayed to users on browsers on personal computers (PCs) and mobile devices. The front-end supports user interaction and receives various user-triggered actions, such as searching, viewing, and editing. The service provider typically provides a corresponding back-end, such as a server. After receiving a user-triggered search action, the front-end requests the corresponding data from the server. Once the server returns the data, the front-end can then present it to the user.
[0048] To ensure data security, both the front-end and server-side authenticate user actions. To achieve finer-grained control over user permissions, access control logic is typically deployed separately on the front-end and server using hard-coding. However, deploying access control logic on both the front-end and server generates a large amount of redundant code, significantly increasing the codebase and making it difficult to maintain.
[0049] In view of this, embodiments of this disclosure provide an access control system, which includes a front-end and a server. The front-end sends a user's identifier to the server. The server obtains the user's access resources based on the user identifier, then retrieves the user's API from a pre-configured association between access resources and APIs, and returns the user's API to the front-end. The front-end invokes access control logic; when authentication is successful, it sends an API call request corresponding to the user-triggered operation to the server. This access control logic instructs authentication of the API corresponding to the operation based on the user's API. The server invokes the access control logic according to the API call request corresponding to the operation; when authentication is successful, it responds to the API call request corresponding to the operation.
[0050] To make the technical solutions of this disclosure clearer and easier to understand, the architecture of the access control system provided by the embodiments of this disclosure will be described below with reference to the accompanying drawings.
[0051] See Figure 1The system architecture diagram of the access control system 100 shown is illustrated. The access control system 100 includes a front-end 102 and a server 104. The front-end 102 can be a webpage running on a terminal, including but not limited to smartphones, tablets, laptops, personal digital assistants (PDAs), or smart wearable devices. The server 104 can be deployed on a server, which can be a cloud server, such as a central server in a central cloud computing cluster or an edge server in an edge cloud computing cluster. The server can also be a server in a local data center. A local data center refers to a data center directly controlled by the user.
[0052] In some embodiments, the access control system 100 can be an access control system for paid documents, paid videos, or other data. Taking the access control system for paid documents as an example, the front end 102 can receive user viewing operations for a target document. The front end 102 sends the user's user identifier to the server 104. The server 104 obtains the user's access rights based on the user identifier. Then, based on the user's access rights, it obtains the user's API from the pre-configured association between access rights and APIs. The server 104 can cache the user's API on the server and send the user's API to the front end 104. After receiving the user's API, the front end 102 calls the access control logic for front-end authentication. After successful front-end authentication, the server 104 sends the API call request corresponding to the viewing operation sent by the front end and calls the same access control logic for server-side authentication. In this way, there is no need to repeatedly write the relevant code for access control logic, reducing code redundancy and making it easier to maintain.
[0053] The access control logic authenticates users based on their APIs and the APIs corresponding to their view operations. In some examples, authentication succeeds if the API for the view operation is found in the user's API list, and fails if it is not. During server-side authentication, server 104 can directly retrieve the user's API from the cache, enabling fast authentication without needing to retrieve it again based on the user's permissions, thus improving efficiency. Both frontend 102 and server 104 implement access control at the interface level, further simplifying the code, reducing code size, and making it easier to maintain.
[0054] In some embodiments, when server authentication is successful, the server 104 responds to the API call request corresponding to the viewing operation sent by the frontend, for example, returning the document data of the target document to the frontend. After receiving the document data returned by the server, the frontend can present the document data to the user.
[0055] In other embodiments, when server authentication fails, server 104 may reject the API call request corresponding to the viewing operation sent by the front end, and thus refuse to return the document data of the target document to the front end, thereby ensuring the security of the document data of the target document.
[0056] In other embodiments, when front-end authentication fails, front-end 102 may prompt the user that they do not have permission to view the target document. Furthermore, front-end 102 may also prompt the user to request permission to view the target document.
[0057] To make the technical solutions of this disclosure clearer and easier to understand, the permission control method provided by the embodiments of this disclosure will be introduced from the perspectives of the front end and the server end.
[0058] like Figure 2 As shown, this figure is a flowchart of an access control method provided in an embodiment of this disclosure, the method including:
[0059] S201: The front end obtains the user's identifier.
[0060] The front-end can present a human-computer interaction interface (HCI) to the user, supporting various user actions such as searching, viewing, and editing. Once the user enters the HCI, the front-end can prompt them to log in. After logging in, the front-end can obtain the user's identifier. In other examples, the front-end can also request user authorization. After the user authorizes the front-end to obtain the user's identifier, the front-end can obtain the user's identifier based on the user's authorization. The user identifier can be any one or more of the user's identification code, email address, and mobile phone number. This user identifier uniquely identifies the user.
[0061] S202: The front end sends an API request to the server based on the user's identifier.
[0062] The user's API retrieval request is used to request the user's API from the server. The user's API refers to the API that the user has permission to call. The user's API is used for subsequent front-end authentication.
[0063] In some embodiments, the front-end can encapsulate the user's identifier into the user's API retrieval request, so that the user's API retrieval request carries the user's user identifier, and then send the user's API retrieval request to the server to request the server to return the user's API.
[0064] In other embodiments, the front end may also directly send the user's user identifier to the server, so that the server can query the user's API based on the user's user identifier and return the user's API to the front end.
[0065] S203: The server retrieves the user's API based on the user's API request.
[0066] In some embodiments, after receiving a user's API retrieval request, the server can decapsulate the user's API retrieval request to obtain the user's identifier; in other embodiments, the server can also directly receive the user identifier sent by the front end.
[0067] The server retrieves the user's permission resources based on the user's user identifier. The user's permission resources can be represented by permission name, unique permission identifier, and permission list. Table 1 below shows a data structure for permission resources provided in an embodiment of this disclosure.
[0068] Table 1:
[0069] field name type describe For example name String Permission Name User search, user editing key String Unique identifier of permissions Permission 1, Permission 2 actions List <string> < / string> Permission List Reading, writing, reading and writing
[0070] As shown in Table 1 above, when managing a user's permissions, operations and maintenance personnel can determine the unique identifier representing the permission based on the permission name, and then adjust the permission list corresponding to that unique identifier. For example, the adjusted permission resource could be "Permission 1 - User Search - Read".
[0071] In some embodiments, the server can retrieve the user's permission resources corresponding to a user identifier from a pre-stored association between user identifiers and user permission resources. Specifically, the server can obtain the user's unique permission identifier from a pre-stored association between user identifiers and unique permission identifiers. Since the unique permission identifier corresponds one-to-one with the permission name and permission list, the user's permission resources can then be obtained. The aforementioned association between user identifiers and user permission resources can be pre-stored in a database that provides an API interface. The server can obtain the permission resources corresponding to the user identifier by calling the API interface provided by the database. In some examples, the server can use the user's email address as a parameter, call the database's API interface, obtain the returned unique permission identifier (e.g., "Permission 1" and "Permission 2"), and then obtain the user's permission resources based on this unique permission identifier, such as "Permission 1 - User Search - Read" and "Permission 2 - User Edit - Write".
[0072] Next, after the server obtains the user's permission resources, it can retrieve the user's API from the pre-configured association between permission resources and APIs.
[0073] like Figure 3As shown in the figure, this is a schematic diagram illustrating the association between permission resources and APIs provided in an embodiment of this disclosure. Users can pre-configure the association between preset operations and permission resources in the database, and then pre-configure the association between these preset operations and APIs, thereby obtaining the association between permission resources and APIs. In this way, the server can obtain the user's API based on the user's permission resources. Furthermore, the server can cache the user's API so that subsequent operations on the user using the user's API can be authenticated by the server.
[0074] In some embodiments, a user's API can be a list of user APIs, which includes at least one uniform resource locator (URL). For example, the user's API list may include "URL1", "URL2", and "URL3", where different URLs correspond to different resources (e.g., data). The server can retrieve the corresponding resources based on the URLs.
[0075] After pre-configuring the association between permission resources and APIs in the database, operations and maintenance personnel can easily update this association to manage user permissions. Compared to hard-coding, this eliminates the need for operations and maintenance personnel to check and modify related code on both the front-end and server sides. Therefore, this permission control system can significantly reduce the operations and maintenance workload of personnel, thereby improving operational efficiency.
[0076] The server can receive update requests, which may be triggered by operations and maintenance personnel. Then, the server updates the association between the pre-configured permission resources and the application programming interface (API) based on the update request.
[0077] In some examples, the update request may include the permission resource associated with the new operation and the API associated with the new operation, and the server establishes the association between the permission resource associated with the new operation and the API associated with the new operation. In other examples, the update request may include the permission resource associated with a historical operation and the API associated with that historical operation, and the server can update the pre-configured association between permission resources and application interface APIs to the association between permission resources associated with historical operations and the API associated with those historical operations.
[0078] like Figure 4As shown in the figure, this is a schematic diagram of an interactive interface provided in an embodiment of this disclosure. The interactive interface includes a permission resource configuration area 401, an API configuration area 402, and a submit control 403. In some examples, operations and maintenance personnel can configure permission resources associated with new operations in the permission resource configuration area 401 of the interactive interface, and configure the API associated with the new operation in the API configuration area 402. Operations and maintenance personnel can trigger an update request by clicking the submit control 403, and the server can then receive an update request including the permission resources associated with the new operation and the API associated with the new operation, so as to establish a new association between the permission resources associated with the new operation and the API associated with the new operation in the database.
[0079] Similarly, operations and maintenance personnel can configure the permission resources associated with historical operations in the permission resource configuration area 401 of the interactive interface, and configure the API associated with the historical operations in the API configuration area 402. Operations and maintenance personnel can trigger an update request by clicking the submit control 403. The server can then receive the update request, which includes the permission resources associated with the historical operations and the API associated with the historical operations, to adjust the association between the original permission resources in the database and the application programming interface (API). For example, the association between the pre-configured permission resources in the database and the API can be updated to the association between the permission resources associated with the historical operations and the API associated with the historical operations.
[0080] It should be noted that the APIs associated with the newly added operations and those associated with historical operations can be either existing APIs in the database or newly added APIs. In some examples, the database can automatically detect newly added APIs based on the general service plugin. For example, the relevant code for the general service plugin is as follows:
[0081]
[0082] S204: The server sends the user's API to the front end.
[0083] After obtaining the user's API, the server returns the user's API to the front end so that the front end can perform front-end authentication based on the user's API.
[0084] S205: The front-end calls the access control logic to perform front-end authentication; if the front-end authentication fails, then execute S206; if the front-end authentication succeeds, then execute S207.
[0085] After receiving a user's API, the frontend can invoke the access control logic to perform frontend authentication. This access control logic instructs the authentication of the API corresponding to the user's triggered operation based on the user's API. The user-triggered operation can be a search operation, an editing operation, etc.
[0086] like Figure 5 As shown, this figure is a flowchart of an access control logic provided in an embodiment of this disclosure. For ease of understanding, the process of the front-end calling this access control logic is described below. The process of the front-end calling this access control logic includes:
[0087] S501: Get the API corresponding to the user-triggered operation.
[0088] The front-end can obtain the API corresponding to the user-triggered operation from the pre-configured association between operations and APIs.
[0089] S502: Determine whether the API corresponding to the user-triggered operation is matched in the user's API.
[0090] S503: Authentication fails when the API corresponding to the user-triggered operation is not found in the user's API.
[0091] S504: Authentication is successful when the API corresponding to the user's triggered operation matches the user's API.
[0092] In some examples, after the front-end obtains the API corresponding to the user-triggered operation and the user's API, it can search for the corresponding API in the user's API. If the corresponding API is found, the API is matched in the user's API; otherwise, it is not matched.
[0093] S206: The front end prompts the user that they do not have permission to perform the operation.
[0094] When front-end authentication fails, the front-end can prompt the user that they do not have the necessary permissions. For example... Figure 6 As shown in the figure, this is a schematic diagram of a prompt interface provided in an embodiment of this disclosure. The prompt interface includes a prompt message 601, which may be "You do not have permission to view this content".
[0095] The prompt interface also includes a request control 602. Users can trigger a permission request for the operation using this control. The front-end can send the user-triggered request to the server, and operations personnel can configure relevant permissions for the user based on this request. For example, operations personnel can use... Figure 4 The interactive interface shown allows users to configure relevant permissions.
[0096] S207: The front end sends an API call request corresponding to the operation to the server.
[0097] Once the front-end authentication is successful, the front-end can send the corresponding API call request to the server.
[0098] S208: The server calls the access control logic to perform server authentication; if the server authentication fails, proceed to S209; if the server authentication succeeds, proceed to S210.
[0099] After receiving a user's API, the server can invoke the access control logic to perform server-side authentication. This access control logic instructs the authentication of the API corresponding to the user's triggered operation based on the user's API. Similarly, such as... Figure 5 As shown, the process of the server calling the access control logic includes:
[0100] S501: Get the API corresponding to the user-triggered operation.
[0101] The server can obtain the API corresponding to the user-triggered operation based on the received API call request.
[0102] The process of S502-S504 is similar to the front-end authentication process described above, and will not be repeated here.
[0103] It's worth noting that the server can cache the user's API after retrieving it. This way, during server-side authentication, there's no need to retrieve the user's API from the database again; instead, the server can directly retrieve the API corresponding to the user's triggered action from the cached API list, further improving the efficiency of server-side authentication.
[0104] S209: The server refuses to respond to the API call request sent by the frontend.
[0105] When server-side authentication fails, the server refuses to respond to API call requests sent by the frontend. In this embodiment, if a user bypasses frontend authentication through an illegal operation, the server will also authenticate the API corresponding to the user-triggered operation. If server-side authentication fails, the server will refuse to respond to API call requests sent by the frontend, further enhancing security.
[0106] S210: The server responds to the API call request sent by the front end.
[0107] In some embodiments, the server can return response data corresponding to the operation to the front end. For example, the server returns document data corresponding to the search operation on the target document to the front end, and the front end can then present the document data to the user.
[0108] Based on the foregoing description, this disclosure provides an access control method. Based on the pre-configured association between access resources and APIs, the front-end can obtain the user's API from the server, then call the access control logic for front-end authentication. After successful front-end authentication, the server, based on the API call request sent by the front-end, calls the aforementioned access control logic for server-side authentication. This eliminates the need to repeatedly write access control logic code on both the front-end and server sides, reducing code redundancy and facilitating maintenance. Furthermore, since the access control logic authenticates based on the user's API and the corresponding API for the operation, both the front-end and server perform access control at the interface level, further simplifying the code logic, reducing code volume, and making it easier to maintain.
[0109] Figure 7 This is a schematic diagram of a server according to an exemplary disclosed embodiment, such as... Figure 7 As shown, the server includes:
[0110] Communication unit 701 is used to receive a user identifier sent by the receiving front end;
[0111] The acquisition unit 702 is used to acquire the user's permission resources based on the user identifier, and to acquire the user's API from the association relationship between the pre-configured permission resources and the application programming interface (API) based on the user's permission resources;
[0112] Communication unit 701 is also used to return the user's API to the front end and receive API call requests corresponding to operations sent by the front end;
[0113] The authentication unit 703 invokes the permission control logic. When authentication is successful, it responds to the API call request corresponding to the operation. The permission control logic instructs the API corresponding to the operation to be authenticated based on the user's API.
[0114] Optionally, the server further includes an update unit; the update unit is configured to receive an update request and update the association between the pre-configured permission resources and the application programming interface (API) according to the update request.
[0115] Optionally, the update request includes the permission resources associated with the new operation and the API associated with the new operation; the update unit is specifically used to establish the association between the permission resources associated with the new operation and the API associated with the new operation.
[0116] Optionally, the update request includes the permission resources associated with the historical operation and the API associated with the historical operation; the update unit is specifically used to update the association between the pre-configured permission resources and the application programming interface (API) to the association between the permission resources associated with the historical operation and the API associated with the historical operation.
[0117] Optionally, the authentication unit 703 is further configured to reject the API call request corresponding to the operation when authentication fails.
[0118] Optionally, the authentication unit 703 is further configured to return response data corresponding to the operation to the front end so that the front end can present the response data.
[0119] Figure 8 This is a schematic diagram of a front end according to an exemplary disclosed embodiment, such as... Figure 8 As shown, the front end includes:
[0120] The communication unit 801 is used to send the user's user identifier to the server and receive the user's API returned by the server; the user's API is obtained by the server through the user's permission resources from the association between pre-configured permission resources and application programming interface APIs, and the user's permission resources are obtained by the server based on the user identifier;
[0121] The authentication unit 802 is used to invoke the access control logic, which instructs to authenticate the API corresponding to the operation based on the user's API.
[0122] The communication unit 801 is also used to send an API call request corresponding to the user-triggered operation to the server when authentication is successful.
[0123] Optionally, the authentication unit 802 is further configured to prompt the user that they do not have permission to perform the operation when authentication fails.
[0124] Optionally, the communication unit 801 is further configured to receive response data corresponding to the operation returned by the server when authentication is successful, and the front end further includes a display unit, which is configured to present the response data.
[0125] The functions of each module have been described in detail in the method steps of the previous embodiment, and will not be repeated here.
[0126] The following is for reference. Figure 9 It shows a schematic diagram of the structure of an electronic device 900 suitable for implementing embodiments of the present disclosure, which may be a server. Figure 9The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0127] like Figure 9 As shown, electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 902 or a program loaded from storage device 908 into random access memory (RAM) 903. RAM 903 also stores various programs and data required for the operation of electronic device 900. Processing device 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.
[0128] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 9 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0129] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory 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 a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by a processing device 901, it performs the functions defined in the methods of embodiments of this disclosure.
[0130] It should be noted that the computer-readable medium described in this disclosure 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 disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, 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. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, 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: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0131] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0132] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0133] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receive a user identifier sent by a front end; obtain the user's permission resources based on the user identifier; obtain the user's API from a pre-configured association between permission resources and application programming interfaces (APIs) based on the user's permission resources; and return the user's API to the front end; receive an API request corresponding to an operation triggered by the user, sent when the front end's access control logic authentication is successful; invoke the access control logic based on the API call request corresponding to the operation; and respond to the API call request corresponding to the operation when authentication is successful; wherein the access control logic instructs authentication of the API corresponding to the operation based on the user's API; or...
[0134] Send the user's user identifier to the server; receive the user's API returned by the server, wherein the user's API is obtained by the server from the association between pre-configured permission resources and application programming interface (API) through the user's permission resources, and the user's permission resources are obtained by the server based on the user identifier; invoke the permission control logic, and when authentication is successful, send an API call request corresponding to the operation triggered by the user to the server; wherein, the permission control logic instructs to authenticate the API corresponding to the operation based on the user's API.
[0135] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0136] 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 this disclosure. 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 the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can 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.
[0137] The modules described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a module does not necessarily limit the module itself; for example, the first acquisition module can also be described as "a module for acquiring at least two Internet Protocol addresses".
[0138] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0139] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, 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 devices, magnetic storage devices, or any suitable combination of the foregoing.
[0140] According to one or more embodiments of this disclosure, Example 1 provides an access control system, including a front-end and a server;
[0141] The front end is used to send the user's user identifier to the server;
[0142] The server is configured to obtain the user's permission resources based on the user identifier; obtain the user's API from the pre-configured association between permission resources and application programming interface (API) based on the user's permission resources; and return the user's API to the front end.
[0143] The front end is used to invoke the access control logic. When authentication is successful, it sends an API call request corresponding to the user-triggered operation to the server. The access control logic instructs the API corresponding to the operation to be authenticated based on the user's API.
[0144] The server is used to invoke the permission control logic according to the API call request corresponding to the operation, and respond to the API call request corresponding to the operation when the authentication is successful.
[0145] According to one or more embodiments of this disclosure, Example 2 provides the system of Example 1, wherein the server is further configured to receive an update request and, according to the update request, update the association between the pre-configured permission resources and the application programming interface (API).
[0146] According to one or more embodiments of this disclosure, Example 3 provides the system of Example 2, wherein the update request includes a permission resource associated with the new operation and an API associated with the new operation; the server is specifically used to establish the association between the permission resource associated with the new operation and the API associated with the new operation.
[0147] According to one or more embodiments of this disclosure, Example 4 provides the system of Example 2, wherein the update request includes permission resources associated with historical operations and APIs associated with the historical operations; the server is specifically used to update the association between the pre-configured permission resources and the application programming interface (API) to the association between the permission resources associated with the historical operations and the APIs associated with the historical operations.
[0148] According to one or more embodiments of this disclosure, Example 5 provides the system of Example 1, wherein the front end is further configured to prompt the user that they do not have permission to perform the operation when authentication fails.
[0149] According to one or more embodiments of this disclosure, Example 6 provides the system of Example 1, wherein the server is further configured to reject the API call request corresponding to the operation when authentication fails.
[0150] According to one or more embodiments of this disclosure, Example 7 provides the system of 1-6, wherein the server is specifically used to return response data corresponding to the operation to the front end when authentication is successful;
[0151] The front end is also used to present the response data.
[0152] According to one or more embodiments of this disclosure, Example 8 provides an access control method applied to a server, the method comprising:
[0153] The server receives a user identifier sent by the front end, obtains the user's permission resources based on the user identifier, obtains the user's API from the pre-configured association between permission resources and application programming interface (API) based on the user's permission resources, and returns the user's API to the front end.
[0154] The server receives the API request corresponding to the user-triggered operation sent when the front-end calls the permission control logic and the authentication is successful. Based on the API call request corresponding to the operation, the server calls the permission control logic. When the authentication is successful, the server responds to the API call request corresponding to the operation. The permission control logic instructs the server to authenticate the API corresponding to the operation based on the user's API.
[0155] According to one or more embodiments of this disclosure, Example 9 provides the method of Example 8, the method further comprising:
[0156] The server receives an update request and updates the association between the pre-configured permission resources and the application programming interface (API) according to the update request.
[0157] According to one or more embodiments of this disclosure, Example 10 provides the method of Example 9, wherein the update request includes a permission resource associated with the new operation and an API associated with the new operation; updating the association between the pre-configured permission resource and the application programming interface API includes:
[0158] Establish the association between the permission resources associated with the newly added operation and the API associated with the newly added operation.
[0159] According to one or more embodiments of this disclosure, Example 11 provides the method of Example 9, wherein the update request includes a permission resource associated with a historical operation and an API associated with the historical operation; updating the association between the pre-configured permission resource and the application programming interface API includes:
[0160] The association between the pre-configured permission resources and the application programming interface (API) is updated to the association between the permission resources associated with the historical operation and the API associated with the historical operation.
[0161] According to one or more embodiments of this disclosure, Example 12 provides the method of Example 8, the method further comprising:
[0162] When authentication fails, the server rejects the API call request corresponding to the operation.
[0163] According to one or more embodiments of this disclosure, Example 13 provides the methods of Examples 8-12, wherein responding to the API call request corresponding to the operation includes:
[0164] The response data corresponding to the operation is returned to the front end so that the front end can display the response data.
[0165] According to one or more embodiments of this disclosure, Example 14 provides an access control method applied to a front-end, the method comprising:
[0166] The front end sends the user's user identifier to the server;
[0167] The front end receives the user's API returned by the server. The user's API is obtained by the server from the association between pre-configured permission resources and application programming interface APIs through the user's permission resources. The user's permission resources are obtained by the server based on the user identifier.
[0168] The front-end invokes the permission control logic, and when authentication is successful, sends an API call request corresponding to the user-triggered operation to the server; wherein, the permission control logic instructs to authenticate the API corresponding to the operation based on the user's API.
[0169] According to one or more embodiments of this disclosure, Example 15 provides the method of Example 14, the method further comprising:
[0170] When authentication fails, the front-end will prompt the user that they do not have permission to perform the operation.
[0171] According to one or more embodiments of this disclosure, Example 16 provides the method of Example 14 or 15, the method further comprising:
[0172] The front end receives the response data corresponding to the operation returned by the server when the authentication is successful;
[0173] The front end presents the response data.
[0174] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0175] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0176] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative forms of implementing the claims. Regarding the apparatus in the above embodiments, the specific manner in which the various modules perform their operations has been described in detail in the embodiments relating to the method, and will not be elaborated upon here.
Claims
1. An access control system, characterized in that, Including front-end and server-side; The front end is used to send the user's user identifier to the server; The server is configured to obtain the user's permission resources based on the user identifier; obtain the user's API from the pre-configured association between permission resources and application programming interface (API) based on the user's permission resources; and return the user's API to the front end. The front end is used to invoke the permission control logic. When the authentication is successful, it sends the API call request corresponding to the user-triggered operation to the server. The access control logic indicates that the API corresponding to the operation is authenticated based on the user's API. The server is used to invoke the permission control logic according to the API call request corresponding to the operation, and respond to the API call request corresponding to the operation when the authentication is successful.
2. The system according to claim 1, characterized in that, The server is also configured to receive update requests and, based on the update requests, update the association between the pre-configured permission resources and the application programming interface (API).
3. The system according to claim 2, characterized in that, The update request includes the permission resources associated with the new operation and the API associated with the new operation; the server is specifically used to establish the association between the permission resources associated with the new operation and the API associated with the new operation.
4. The system according to claim 2, characterized in that, The update request includes the permission resources associated with the historical operation and the API associated with the historical operation; the server is specifically used to update the association between the pre-configured permission resources and the application programming interface (API) to the association between the permission resources associated with the historical operation and the API associated with the historical operation.
5. The system according to claim 1, characterized in that, The front end is also used to prompt the user that they do not have permission to perform the operation when authentication fails.
6. The system according to claim 1, characterized in that, The server is also configured to reject the API call request corresponding to the operation when authentication fails.
7. The system according to any one of claims 1-6, characterized in that, The server is specifically used to return the response data corresponding to the operation to the front end when the authentication is successful. The front end is also used to present the response data.
8. A method for access control, characterized in that, Applied to the server side, the method includes: The server receives a user identifier sent by the front end, obtains the user's permission resources based on the user identifier, obtains the user's API from the pre-configured association between permission resources and application programming interface (API) based on the user's permission resources, and returns the user's API to the front end. The server receives an API call request corresponding to the user-triggered operation sent when the front-end access control logic authentication is successful. Based on the API call request corresponding to the operation, the server invokes the access control logic. When authentication is successful, the server responds to the API call request corresponding to the operation. The access control logic instructs the server to authenticate the API corresponding to the operation based on the user's API.
9. The method according to claim 8, characterized in that, The method further includes: The server receives an update request and updates the association between the pre-configured permission resources and the application programming interface (API) according to the update request.
10. The method according to claim 9, characterized in that, The update request includes the permission resources associated with the new operation and the API associated with the new operation; updating the association between the pre-configured permission resources and the application programming interface (API) includes: Establish the association between the permission resources associated with the newly added operation and the API associated with the newly added operation.
11. The method according to claim 9, characterized in that, The update request includes the permission resources associated with the historical operation and the API associated with the historical operation; updating the association between the pre-configured permission resources and the application programming interface (API) includes: The association between the pre-configured permission resources and the application programming interface (API) is updated to the association between the permission resources associated with the historical operation and the API associated with the historical operation.
12. The method according to claim 8, characterized in that, The method further includes: When authentication fails, the server rejects the API call request corresponding to the operation.
13. The method according to any one of claims 8-12, characterized in that, The response to the API call request corresponding to the operation includes: The response data corresponding to the operation is returned to the front end so that the front end can display the response data.
14. An access control method, characterized in that, Applied to the front end, the method includes: The front end sends the user's user identifier to the server; The front end receives the user's API returned by the server. The user's API is obtained by the server from the association between pre-configured permission resources and application programming interface APIs through the user's permission resources. The user's permission resources are obtained by the server based on the user identifier. The front-end invokes the permission control logic. When authentication is successful, it sends an API call request corresponding to the user-triggered operation to the server. When the server receives the API call request corresponding to the operation, the permission control logic is also used by the server for authentication, so that the server responds to the API call request corresponding to the operation when authentication is successful. The permission control logic instructs the API corresponding to the operation to be authenticated based on the user's API.
15. The method according to claim 14, characterized in that, The method further includes: When authentication fails, the front-end will prompt the user that they do not have permission to perform the operation.
16. The method according to claim 14 or 15, characterized in that, The method further includes: The front end receives the response data corresponding to the operation returned by the server when the authentication is successful; The front end presents the response data.
17. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing apparatus for executing the computer program in the storage device to implement the steps of the method according to any one of claims 8 to 16.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processing device, the program performs the steps of the method according to any one of claims 8 to 16.
19. A computer program product, characterized in that, When the computer program product is run on a computer, it causes the computer to perform the method as described in any one of claims 8 to 16.
Citation Information
Patent Citations
API calling system, method, and apparatus, electronic equipment, and storage medium
CN109510846A
Authentication and authorization method and system based on Kubernetes
CN110995450A
