React-based page authentication method and device, equipment and medium
By obtaining the user's access address and login status in the React framework's web system and matching them with the system's routing table to determine permissions, the system solves the access security risks caused by the simple authentication methods in existing technologies, and achieves more secure page access control.
Patent Information
- Application Number
- CN202310670787.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-07
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2043-06-07
AI Technical Summary
Existing web systems based on the React framework use simple authentication methods, which pose security risks and allow users to access restricted web pages through illegitimate means.
By obtaining the user's access address and login status, and matching them with the permission information in the pre-configured system routing table, it is determined whether the user has the necessary access rights. If the user has the necessary permissions, the target webpage is displayed; otherwise, a 404 page or other preset page is displayed.
It improves the accuracy and security of authentication, reduces the risk of users accessing target web pages through abnormal means, and enhances the data security of the Web system.
Smart Images

Figure CN116708121B_ABST
Abstract
Description
Technical Field
[0001] This application relates to communication technology, and more particularly to a React-based page authentication method, apparatus, device, and medium. Background Technology
[0002] In the field of communications, when a user accesses a webpage of a web system, in order to ensure the security of the webpage data, it is necessary to authenticate the user's access and process it differently according to the user's different access permissions.
[0003] In existing technologies, when a user accesses a webpage in a web system built on the React framework, user authentication is typically based on the user's permissions. A corresponding menu item is displayed on the interface, allowing the user to access the desired webpage. If the user lacks permissions, the corresponding menu item is not displayed, and the user cannot access the desired webpage.
[0004] However, existing authentication methods are relatively simple and pose certain access security risks. Summary of the Invention
[0005] This application provides a React-based page authentication method, apparatus, device, and medium to address the problem that existing authentication methods are relatively simple and pose certain access security risks.
[0006] Firstly, this application provides a React-based page authentication method, including:
[0007] In response to user actions, the system obtains the access address of the target webpage entered by the user. The target webpage is a webpage in the target web system, which is created based on React.
[0008] Obtain the user's login status on the target web system, including logged-in and logged-out status;
[0009] Based on the login status and the access address, the system matches the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage. The permission information includes at least the webpage routing address of each webpage in the target web system and the authentication identifier information of each webpage routing address.
[0010] If the user has permission to access the target webpage, the target webpage corresponding to the access address is displayed.
[0011] Optionally, the step of matching the login status and the access address with the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage includes:
[0012] If the user's login status to the target Web system is not logged in, the access address is matched with the webpage route address stored in the system routing table;
[0013] If no matching webpage route address is found in the system routing table, the user does not have permission to access the target webpage.
[0014] If a webpage route address matching the access address is found in the system routing table, the system determines whether the user has permission to access the target webpage based on the authentication identifier of the webpage route address.
[0015] Optionally, determining whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address includes:
[0016] If the authentication identifier of the webpage routing address indicates that the access address does not require authentication, then the user has permission to access the target webpage.
[0017] If the authentication identifier of the webpage routing address indicates that the access address requires authentication, then the user does not have permission to access the target webpage.
[0018] Optionally, the step of matching the login status and the access address with the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage includes:
[0019] If the user's login status to the target Web system is logged in, obtain the user's login account information;
[0020] Based on the login account information, determine the webpage routing addresses in the target Web system that are allowed to be accessed under the login account information from the pre-configured user routing permission data;
[0021] The access address is matched with the webpage route addresses that the login account information is allowed to access, stored in the system routing table;
[0022] If no matching webpage route address is found in the allowed webpage route addresses in the system routing table, then the user does not have permission to access the target webpage.
[0023] If a webpage route address matching the access address is found in the allowed webpage route addresses in the system routing table, it is determined whether the access address is the login page address of the target web system.
[0024] If the access address is the login page address, then the webpage that the user is currently logged into is displayed;
[0025] If the access address is not the login page address of the target web system, determine whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address.
[0026] Optionally, determining whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address includes:
[0027] If the authentication identifier of the webpage routing address indicates that the access address has passed authentication, then the user has permission to access the target webpage.
[0028] If the authentication identifier of the webpage routing address indicates that the access address authentication fails, then the user does not have permission to access the target webpage.
[0029] Optional, also includes:
[0030] If the user does not have permission to access the target webpage, a preset webpage is displayed, which indicates that no target webpage corresponding to the access address can be found.
[0031] Optionally, before obtaining the access address to the target webpage input by the user in response to the user operation, the method further includes:
[0032] Create a system routing table for the target web system. The permission information in the system routing table includes at least: the webpage routing address of each webpage in the target web system and the authentication identifier information of each webpage routing address.
[0033] Secondly, this application provides a React-based page authentication device, comprising:
[0034] The acquisition module is used to respond to user operations and acquire the access address of the target webpage entered by the user. The target webpage is a webpage in the target web system, which is created based on React.
[0035] The acquisition module is further configured to acquire the user's login status to the target Web system, the login status including logged-in status and not logged-in status;
[0036] The processing module is used to match the login status and the access address with the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target web page. The permission information includes at least the web page routing address of each web page in the target web system and the authentication identifier information of each web page routing address.
[0037] The display module is used to display the target webpage corresponding to the access address if the user has permission to access the target webpage.
[0038] Thirdly, this application provides an electronic device, including: at least one processor and a memory;
[0039] The memory stores computer-executed instructions;
[0040] The at least one processor executes computer execution instructions stored in the memory to perform the React-based page authentication method according to any one of the first aspects.
[0041] Fourthly, embodiments of this application provide a readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the React-based page authentication method described in any of the first aspects.
[0042] This application provides a React-based page authentication method, apparatus, device, and medium. Responding to user operations, it obtains the access address of a target webpage entered by the user. The target webpage is a webpage within a target web system created based on React. The method obtains the user's login status on the target web system, including logged-in and logged-out states. Based on the login status and access address, it matches the user's permissions with pre-configured permission information in the target web system's system routing table to determine if the user has permission to access the target webpage. This permission information includes at least the webpage routing address of each webpage in the target web system and authentication identifier information for each webpage routing address. If the user has permission to access the target webpage, the target webpage corresponding to the access address is displayed. This method provides a more secure authentication approach, improving the security of user access to target webpages. Attached Figure Description
[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0044] Figure 1 This application provides an illustration of an application scenario.
[0045] Figure 2 A flowchart illustrating a React-based page authentication method provided in this application embodiment;
[0046] Figure 3 This is a flowchart illustrating a method for determining whether a user has permission to access a target webpage when not logged in, as provided in an embodiment of this application.
[0047] Figure 4 This is a flowchart illustrating a method for determining whether a user has permission to access a target webpage while already logged in, as provided in an embodiment of this application.
[0048] Figure 5 A schematic diagram of the structure of a React-based page authentication device provided in an embodiment of this application;
[0049] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0050] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0051] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0052] In the description of the embodiments of this application, the terms "inner" and "outer", etc., which indicate the direction or positional relationship, are based on the direction or positional relationship shown in the drawings. This is only for the convenience of description and is not intended to indicate or imply that the device or component must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation of this application.
[0053] Furthermore, it should be noted that, in the description of the embodiments of this application, unless otherwise explicitly specified and limited, the terms "connected" and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the embodiments of this application according to the specific circumstances.
[0054] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0055] For a web system to function fully according to business needs, it must also ensure data security and system reliability. A web system can have multiple web pages, and users can access different pages according to their needs. In this application, a web system can be understood as a website.
[0056] When users access web pages on a web system, their access needs to be authenticated to ensure the security of the access service as much as possible and reduce the loss of web page data caused by unauthorized access.
[0057] Currently, when a user wants to access a webpage in a web system built on the React framework, user authentication is usually based on the user's permissions to determine whether the user can access the site.
[0058] Specifically, by obtaining the user's permission data, if the user's permission data is authenticated, a menu item for the target webpage that the user wants to access will be displayed on the web system's interface, and the user can access the target webpage by clicking on the menu item. If the user's permission data is not authenticated, the menu item for the target webpage that the user wants to access will not be displayed on the web system's interface, and the user will not be able to access the target webpage.
[0059] However, in the existing technology, if a user obtains the URL of the target page they want to access through abnormal means, they can still access the target webpage by entering the URL in their browser. The existing authentication methods are relatively simple, and access permissions are easily leaked, posing certain access security risks.
[0060] Therefore, to address the aforementioned technical problems in the prior art, this application proposes a React-based page authentication method, apparatus, device, and medium. By obtaining the access address of the target webpage accessed by the user to the target web system, and the user's login status to the target web system, the method then matches the login status and access address with the permission information in the pre-configured system routing table of the target web system to obtain a matching result. If the matching result indicates that the user has permission to access the target webpage, the target webpage is displayed. This method improves the accuracy of the authentication result and enhances the security of the user's webpage access.
[0061] To facilitate understanding of this application, an application scenario of this application is illustrated below. Figure 1 This application provides an illustration of an application scenario, such as... Figure 1 As shown:
[0062] User A enters the access address 'aaaa' of the target webpage in the target web system to be accessed in the browser of terminal 01, and User B also enters the access address 'aaaa' of the target webpage in the target web system to be accessed in the browser of terminal 02.
[0063] Server 03 retrieves the permission data for user A and user B from terminals 01 and 02 respectively, and performs authentication processing against the pre-configured system routing table of the target web system. After authentication, if user A has permission to access the target webpage, the target webpage is displayed on terminal 01. If user B does not have permission to access the target webpage, a 404 error is displayed on terminal 01.
[0064] It is understood that this application does not limit the number, form, or interaction method of terminal 01, terminal 02, and server 03 in the application scenario, nor does it limit the type or function of the target Web system. The above scenario is only used as an example. In the specific application of the solution, it can be set according to actual needs.
[0065] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0066] Figure 2This is a flowchart illustrating a React-based page authentication method provided in an embodiment of this application. The executing entity of this method can be a terminal with page authentication functionality, such as a personal computer, laptop, smartphone, tablet, portable wearable device, server, or server cluster. The method in this embodiment can be implemented through software, hardware, or a combination of both. Figure 2 As shown, the method specifically includes the following steps:
[0067] S201. In response to user operation, obtain the access address of the target webpage entered by the user. The target webpage is a webpage in the target web system, which is created based on React.
[0068] In this embodiment, the execution entity is a computer. The user can enter the URL of the target webpage to be accessed in any browser on the computer, or the user can click the menu item corresponding to the target webpage on the computer. The computer can then obtain the user's access address, which can be a Uniform Resource Locator (URL), etc.
[0069] It should be noted that the target web system in this application is built on the React framework, which is a JavaScript framework for building user interfaces. Frameworks are reusable code.
[0070] The specific creation process is not the focus of this application; for details, please refer to relevant technologies. This application will not elaborate further here.
[0071] The target web system may have multiple web pages, including at least a login page for logging into the system and other web pages. The login page allows users to enter their account information.
[0072] S202. Obtain the user's login status on the target web system. The login status includes logged-in status and not logged-in status.
[0073] In this embodiment, the user's login status can also be obtained. When the user is already logged into the target web system, the obtained login status is "logged in"; when the user is not logged into the target web system, the obtained login status is "micro-login".
[0074] The login status can be obtained from the data management backend or from the computer's log data. This application does not limit the method of obtaining the login status.
[0075] S203. Based on the login status and access address, match them with the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage.
[0076] In this embodiment, a system routing table for the target web system is pre-created. The permission information in the system routing table includes at least the web page routing address of each web page in the target web system and the authentication identifier information of each web page routing address.
[0077] For example,
[0078] The system routing table includes, but is not limited to: each webpage component of the target web system, the webpage routing path (webpage routing address) of each webpage, and the authentication information (auth) of each webpage routing address.
[0079] In this implementation, web page components can be imported into the system routing table using lazy loading. Each component can be packaged and loaded separately, allowing users to access only the relevant web page and reducing loading time. The Suspense component's fallback property is used to implement a loading animation when resources are loaded, preventing a blank screen and improving user experience. In this embodiment, a component can be understood as a web page or a sub-module within a web page.
[0080] The authentication identifier can be a boolean value, a permission-associated identifier string, or an array of strings, and is used to authenticate user access.
[0081] In this embodiment, user routing permission data is also pre-configured, which sets access permissions for different users to the target web system webpage according to their different roles or types.
[0082] Furthermore, after obtaining the user's login status and access address, the system matches the information with the permission information in the pre-configured system routing table of the target web system to obtain the matching result. Based on the matching result, the system determines whether the user has permission to access the target webpage.
[0083] S204. If the user has permission to access the target webpage, display the target webpage corresponding to the access address.
[0084] If a user has permission to access the target webpage, it means that the user can access the target webpage, and the target webpage corresponding to the access address will be displayed on the computer's browser.
[0085] If the user does not have permission to access the target webpage, it means that the user cannot access the target webpage and a preset webpage is displayed. The preset webpage is used to indicate that the target webpage corresponding to the access address cannot be found. For example, it can be displayed as a 404 page.
[0086] In the above embodiments of this application, the access address of the target webpage input by the user is obtained. The target webpage is a webpage within a target web system created based on React. The user's login status in the target web system is obtained, including logged-in and logged-out states. Based on the login status and access address, the user's permission is matched against the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage. This permission information includes at least the webpage routing address of each webpage in the target web system and the authentication identifier information for each webpage routing address. If the user has permission to access the target webpage, the target webpage corresponding to the access address is displayed. This authentication method is more secure and can effectively reduce the threat of users accessing target pages through abnormal means, thus improving the security of the target web system data.
[0087] Furthermore, based on the above embodiments, the following embodiments will explain in detail the process in step S203 of matching the login status and access address with the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage.
[0088] Figure 3 This is a flowchart illustrating a method for determining whether a user has permission to access a target webpage when not logged in, as provided in an embodiment of this application. Figure 3 As shown, the method includes the following steps:
[0089] S301. If the user's login status for the target Web system is not logged in, match the access address with the web page route address stored in the system routing table.
[0090] In this embodiment, the authentication process can be performed by the RouteController, which is specifically responsible for authenticating page resource requests and processing different authentication results accordingly.
[0091] The RouteController can be placed inside the Switch component of react-router. react-router automatically imports the RouteController into the browser's location object. The location object is typically used to get or set the web address of the page to be accessed. Therefore, when a user enters the web address to be accessed in the browser, the pathname property on the location object changes, the RouteController is re-rendered, and the currently displayed page is switched.
[0092] When a user enters the URL of a webpage in their browser, the routing controller begins authenticating the user's access. Specifically, the routing controller matches the access URL with the webpage routes stored in the system's routing table.
[0093] S302. If no matching webpage route address is found in the system routing table, the user does not have permission to access the target webpage.
[0094] If no matching webpage route address is found in the system routing table, it means that the access address does not exist in the system routing table, and the routing controller will control the currently displayed webpage to be a 404 page.
[0095] S303. If a webpage routing address matching the access address is found in the system routing table, determine whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address.
[0096] One possible implementation is:
[0097] S3031. If the authentication identifier of the webpage routing address indicates that the access address does not require authentication, then the user has permission to access the target webpage.
[0098] If the authentication identifier of the webpage route address is a boolean value, a permission-associated identifier string, or any of the string arrays that indicates that the access address does not require authentication, then the user can access the target webpage corresponding to that access address, and the route controller controls the currently displayed webpage to be the target page.
[0099] S3032. If the authentication identifier of the webpage routing address indicates that the access address requires authentication, then the user does not have permission to access the target webpage.
[0100] If the authentication identifier of the webpage routing address, i.e., a boolean value, or a permission-associated identifier string, or any of the string arrays, indicates that the access address requires authentication, and since the user is not logged in, the user's permission data cannot be obtained, then the user is prohibited from accessing the target webpage corresponding to the access address. The routing controller controls the currently displayed webpage to be the login page of the target web system or other pages displaying preset screens. This embodiment does not impose any limitations.
[0101] In the above embodiments of this application, if the user's login status to the target web system is not logged in, the access address is matched with the webpage routing addresses stored in the system routing table. If no matching webpage routing address is found in the system routing table, the user does not have permission to access the target webpage. If a matching webpage routing address is found in the system routing table, the user's permission to access the target webpage is determined based on the authentication identifier of the webpage routing address. This embodiment improves the security and reliability of the authentication process when the user is not logged into the target web system.
[0102] Figure 4 This is a flowchart illustrating a method for determining whether a user has permission to access a target webpage while logged in, as provided in an embodiment of this application. Figure 4 As shown, the method includes the following steps:
[0103] S401. If the user's login status on the target Web system is "logged in", obtain the user's login account information.
[0104] If the user has already logged into the target web system, the login account information used by the user to log in to the system can be obtained.
[0105] S402. Based on the login account information, determine the webpage route address in the target Web system that is allowed to be accessed under the login account information from the pre-configured user routing permission data.
[0106] This application pre-configures user routing permission data for different roles. The routing permission data can be stored in the Redux container. Based on the Redux container, the permission state machine can set, update, and globally store user permission data.
[0107] When an administrator modifies a user's routing permission data on the server, the server can use WebSocket full-duplex communication technology to push the new permission data to the browser. Upon receiving the data, the browser immediately triggers an update operation on the permission state machine via Redux's dispatch interface, thus ensuring the real-time validity of the permission data. In other words, even if a user is already logged into the target web system, if their permission to access a webpage has just been granted by the administrator, the user can immediately access that webpage.
[0108] Since user routing permission data is pre-configured, and this data sets the access permissions for different users to the target web system's web pages, multiple web page routing addresses that are allowed to be accessed under the login account information can be determined from the user routing permission data.
[0109] S403. Match the access address with the webpage route addresses allowed to be accessed by the login account information stored in the system routing table.
[0110] The routing controller matches the access address with the webpage routes allowed by the login account information stored in the system routing table.
[0111] S404. If no matching webpage route address is found in the system routing table's allowed webpage route addresses, the user does not have permission to access the target webpage.
[0112] If no matching webpage address is found in the allowed webpage routing addresses in the system routing table, it means that the access address does not exist in the system routing table, and the routing controller will control the currently displayed webpage to be a 404 page.
[0113] S405. If a webpage route address matching the access address is found in the allowed webpage route addresses in the system routing table, determine whether the access address is the login page address of the target web system.
[0114] S406. If the access address is the login page address, then display the webpage that the user is currently logged into.
[0115] If the access address is the login page address, it means that the user wants to access the login page again. However, the user is already logged in to this page. To prevent the user from logging in again, the user is prohibited from accessing the page and the user's current login page is still displayed.
[0116] S407. If the access address is not the login page address of the target web system, determine whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address.
[0117] One possible implementation is:
[0118] S4071. If the authentication identifier of the webpage routing address indicates that the access address authentication is successful, then the user has the permission to access the target webpage.
[0119] If the authentication identifier of the webpage routing address is a boolean value, a permission-associated identifier string, or an array of strings indicating that the access address is authenticated, the user can access the target webpage corresponding to that access address, and the routing controller controls the currently displayed webpage to be the target page.
[0120] S4072. If the authentication identifier of the webpage routing address indicates that the access address authentication fails, then the user does not have permission to access the target webpage.
[0121] If the authentication identifier of the webpage routing address, i.e., a boolean value, or a permission-associated identifier string, or any string array indicates that the access address authentication fails, then the user is prohibited from accessing the target webpage corresponding to the access address. The routing controller controls the currently displayed webpage to be a 404 page or other preset page. In this embodiment, the specific page to be displayed is not limited, and it can be determined according to the actual configuration.
[0122] In the above embodiments of this application, if the user's login status to the target web system is logged in, the user's login account information is obtained. Based on the login account information, the allowed webpage routing addresses in the target web system under the login account information are determined from the pre-configured user routing permission data. The access addresses are matched with the allowed webpage routing addresses stored in the system routing table. If no matching webpage routing address is found, the user does not have permission to access the target webpage. If a matching webpage routing address is found, it is determined whether the access address is the login page address of the target web system. If the access address is not the login page address of the target web system, the user's permission to access the target webpage is determined based on the authentication identifier of the webpage routing address. The method of this embodiment improves the security and reliability of the authentication process when the user is already logged into the target web system.
[0123] Figure 5 A schematic diagram of a React-based page authentication device provided in this application embodiment is shown below. Figure 5 As shown, the device includes: an acquisition module 501, a processing module 502, and a display module 503.
[0124] The acquisition module 501 is used to respond to user operations and acquire the access address of the target webpage entered by the user. The target webpage is a webpage in the target web system, which is created based on React.
[0125] The acquisition module 501 is also used to acquire the user's login status to the target web system, including logged-in status and not logged-in status.
[0126] The processing module 502 is used to match the login status and access address with the permission information in the pre-configured system routing table of the target Web system to determine whether the user has permission to access the target web page. The permission information includes at least the web page routing address of each web page in the target Web system and the authentication identifier information of each web page routing address.
[0127] Display module 503 is used to display the target webpage corresponding to the access address if the user has permission to access the target webpage.
[0128] One possible implementation is that the processing module 502 is specifically used for:
[0129] If the user is not logged in to the target web system, the access address will be matched with the web page route address stored in the system routing table.
[0130] If no matching webpage route address is found in the system routing table, the user does not have permission to access the target webpage.
[0131] If a webpage route address matching the access address is found in the system routing table, the system determines whether the user has permission to access the target webpage based on the authentication identifier of the webpage route address.
[0132] One possible implementation is that the processing module 502 is specifically used for:
[0133] If the authentication flag of the webpage routing address indicates that the access address does not require authentication, then the user has permission to access the target webpage.
[0134] If the authentication flag of the webpage routing address indicates that authentication is required for the access address, then the user does not have permission to access the target webpage.
[0135] One possible implementation is that the processing module 502 is specifically used for:
[0136] If the user is logged in to the target web system, obtain the user's login account information.
[0137] Based on the login account information, determine the webpage route address in the target web system that is allowed to be accessed under the login account information from the pre-configured user routing permission data.
[0138] The access address is matched with the webpage routes allowed by the login account information stored in the system routing table.
[0139] If no matching webpage route address is found in the system routing table's allowed webpage route addresses, the user does not have permission to access the target webpage.
[0140] If a webpage route address matching the access address is found in the allowed webpage route addresses in the system routing table, it is determined whether the access address is the login page address of the target web system.
[0141] If the access address is the login page address, the webpage that the user is currently logged into will be displayed.
[0142] If the access address is not the login page address of the target web system, determine whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address.
[0143] One possible implementation is that the processing module 502 is specifically used for:
[0144] If the authentication identifier of the webpage routing address indicates that the access address authentication is successful, then the user has permission to access the target webpage.
[0145] If the authentication flag of the webpage routing address indicates that the access address authentication has failed, then the user does not have permission to access the target webpage.
[0146] One possible implementation is that the display module 503 is also used for:
[0147] If the user does not have permission to access the target webpage, a default webpage will be displayed. The default webpage is used to indicate that the target webpage corresponding to the access address cannot be found.
[0148] One possible implementation is that the device also includes a creation module for:
[0149] Create a system routing table for the target web system. The permission information in the system routing table should include at least the following: the web page routing address of each web page in the target web system and the authentication information of each web page routing address.
[0150] The React-based page authentication device provided in this embodiment is used to execute the aforementioned method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0151] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the device may include at least one processor 601 and a memory 602.
[0152] The memory 602 is used to store programs. Specifically, the program may include program code, which may include computer operation instructions or executable instructions of the processor 601, etc.
[0153] The memory 602 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0154] The processor 601 is used to execute computer execution instructions stored in the memory 602 to implement the method described in any of the foregoing embodiments. The processor 601 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0155] Optionally, the electronic device may also include a communication interface 603. In specific implementations, if the communication interface 603, memory 602, and processor 601 are implemented independently, they can be interconnected via a bus to complete communication. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.
[0156] Optionally, in a specific implementation, if the communication interface 603, memory 602, and processor 601 are integrated on a single chip, then the communication interface 603, memory 602, and processor 601 can communicate through an internal interface.
[0157] The electronic device provided in this embodiment is used to execute the React-based page authentication method executed in the aforementioned embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0158] This application also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a disk, or an optical disk. Specifically, the computer-readable storage medium stores computer-executable instructions, which are used in the React-based page authentication method described in the above embodiments.
[0159] This application also provides a computer program product comprising executable instructions or a computer program stored in a readable storage medium. At least one processor of an electronic device can read the executable instructions from the readable storage medium, and the at least one processor executes the executable instructions to cause the electronic device to implement the React-based page authentication method provided in the various embodiments described above.
[0160] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0161] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A React-based page authentication method, characterized in that, include: In response to user actions, the system obtains the access address of the target webpage entered by the user. The target webpage is a webpage in the target web system, which is created based on React. Obtain the user's login status on the target web system, including logged-in and logged-out status; The routing controller matches the login status and access address with the permission information in the pre-configured system routing table of the target web system to determine whether the user has permission to access the target webpage. The routing controller is triggered to perform authentication when the user enters the access address. The permission information includes at least the webpage routing address of each webpage in the target web system and the authentication identifier information of each webpage routing address. If the user's login status to the target Web system is not logged in, the access address is matched with the webpage route address stored in the system routing table; If no matching webpage route address is found in the system routing table, the user does not have permission to access the target webpage. If a webpage routing address matching the access address is found in the system routing table, the system determines whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address. If the user has permission to access the target webpage, display the target webpage corresponding to the access address; The step of determining whether a user has permission to access a target webpage by matching the login status and access address with the permission information in the pre-configured system routing table of the target web system through the routing controller includes: If the user's login status to the target Web system is logged in, obtain the user's login account information; Based on the login account information, determine the webpage routing addresses in the target Web system that are allowed to be accessed under the login account information from the pre-configured user routing permission data; The access address is matched with the webpage route addresses allowed to be accessed by the login account information stored in the system routing table; If no matching webpage route address is found in the allowed webpage route addresses in the system routing table, then the user does not have permission to access the target webpage. If a webpage route address matching the access address is found in the allowed webpage route addresses in the system routing table, it is determined whether the access address is the login page address of the target web system. If the access address is the login page address, then the webpage that the user is currently logged into is displayed; If the access address is not the login page address of the target web system, determine whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address.
2. The method according to claim 1, characterized in that, The step of determining whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address includes: If the authentication identifier of the webpage routing address indicates that the access address does not require authentication, then the user has permission to access the target webpage. If the authentication identifier of the webpage routing address indicates that the access address requires authentication, then the user does not have permission to access the target webpage.
3. The method according to claim 1, characterized in that, The step of determining whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address includes: If the authentication identifier of the webpage routing address indicates that the access address has passed authentication, then the user has permission to access the target webpage. If the authentication identifier of the webpage routing address indicates that the access address authentication fails, then the user does not have permission to access the target webpage.
4. The method according to any one of claims 1-3, characterized in that, Also includes: If the user does not have permission to access the target webpage, a preset webpage is displayed, which indicates that no target webpage corresponding to the access address can be found.
5. The method according to claim 1, characterized in that, Before responding to a user action and obtaining the user-inputted address for the target webpage, the method further includes: Create a system routing table for the target web system. The permission information in the system routing table includes at least: the webpage routing address of each webpage in the target web system and the authentication identifier information of each webpage routing address.
6. A React-based page authentication device, characterized in that, include: The acquisition module is used to respond to user operations and acquire the access address of the target webpage entered by the user. The target webpage is a webpage in the target web system, which is created based on React. The acquisition module is further configured to acquire the user's login status to the target Web system, the login status including logged-in status and not logged-in status; The processing module is used to determine whether the user has permission to access the target webpage by matching the login status and the access address with the permission information in the pre-configured system routing table of the target web system through the routing controller. The routing controller is triggered to perform authentication when the user enters the access address. The permission information includes at least the webpage routing address of each webpage in the target web system and the authentication identifier information of each webpage routing address. If the user's login status to the target web system is not logged in, the access address is matched with the webpage routing addresses stored in the system routing table. If no matching webpage routing address is found in the system routing table, the user does not have permission to access the target webpage. If a matching webpage routing address is found in the system routing table, the user's permission to access the target webpage is determined based on the authentication identifier of the webpage routing address. The display module is used to display the target webpage corresponding to the access address if the user has permission to access the target webpage. The processing module is further configured to: if the user's login status in the target Web system is logged in, obtain the user's login account information; determine, based on the login account information, the webpage routing addresses allowed to be accessed under the login account information in the target Web system from pre-configured user routing permission data; match the access addresses with the webpage routing addresses allowed to be accessed under the login account information stored in the system routing table; if no matching webpage routing address is found in the system routing table, the user does not have permission to access the target webpage; if a matching webpage routing address is found in the system routing table, determine whether the access address is the login page address of the target Web system; if the access address is the login page address, display the webpage the user is currently logged into; if the access address is not the login page address of the target Web system, determine whether the user has permission to access the target webpage based on the authentication identifier of the webpage routing address.
7. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the electronic device to perform the React-based page authentication method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the React-based page authentication method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Front-end micro-servitization method and device, computer equipment and storage medium
CN113010224A
React-based authority control method and device, electronic equipment and storage medium
CN115686514A