A method, device, system, equipment and medium for system login
By selecting the target operating environment from multiple operating environments, the problem of users who may access systems with incomplete functions when logging in is solved, and the effect of improving user experience is achieved.
Patent Information
- Application Number
- CN202210973644.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2042-08-15
AI Technical Summary
In the prior art, the system where the user logs in may have incomplete functions, resulting in a reduced user experience. How to ensure that the user always accesses a system with complete functions has become a challenge.
By obtaining the user's login request and selecting the target operating environment from multiple operating environments based on the login request, ensuring that the user accesses a fully functional system. The specific method includes parsing the login request, extracting the user ID, and selecting the production environment or test environment as the target operating environment based on the user ID or random number.
The target operating environment selection is realized for user login requests, ensuring that users access a fully functional system, thereby improving user experience.
Smart Images

Figure CN115348084B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of software development, and specifically to a method, apparatus, system, equipment and medium for system login. Background Art
[0002] With the rapid iteration of software functions, the complexity of system functions is increasing day by day. Each iteration of a product will bring certain security risks to the stability of the system. In related technologies, when using software, users usually log in to the online system that has been deployed in the production environment and iterated. However, some functions of the online system may be imperfect, which reduces the user experience.
[0003] Therefore, how to ensure that users always access a fully functional system becomes a problem that needs to be solved. Summary of the invention
[0004] Embodiments of the present application provide a method, apparatus, system, device and medium for system login. Through some embodiments of the present application, at least the target operating environment can be selected for the login request, thereby ensuring that the user accesses a fully functional system, thereby improving the user experience.
[0005] In a first aspect, the present application provides a method for system login, the method comprising: obtaining a login request sent by a user for logging into a system to be logged in; selecting a target operating environment from multiple operating environments based on the login request, wherein the multiple operating environments include at least a production environment and a test environment, the system to be logged in includes an online version system or a version system to be updated, the production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated; loading the target operating environment into the system to be logged in to obtain the target system to be logged in; processing the login request according to the target system to be logged in to obtain a login result, and returning the login result to the user.
[0006] Therefore, unlike the related art in which users log in to an online system that has been deployed and iterated in a production environment, the embodiment of the present application verifies the user's login request and selects a target operating environment for the login request, thereby ensuring that normal users access a fully functional system, thereby improving the user experience.
[0007] In combination with the first aspect, in one embodiment of the present application, the login request carries a user identifier, and the user identifier includes a first identifier or a second identifier; selecting a target operating environment from multiple operating environments based on the login request includes: parsing the login request and extracting the user identifier from the login request; if the user identifier is the first identifier, selecting the production environment from the multiple operating environments as the target operating environment; if the user identifier is the second identifier, selecting the test environment from the multiple operating environments as the target operating environment.
[0008] Therefore, the embodiment of the present application can enable normal users to access a system with complete functions and enable test users to access a system whose functions are to be authenticated by distinguishing user identifiers and identifying user identifiers during the user login process.
[0009] In combination with the first aspect, in one embodiment of the present application, selecting a target operating environment from multiple operating environments based on the login request includes: parsing the login request and confirming that the login request does not carry a user identifier; confirming that the current allocation method is a random mode, then obtaining a request random number; if the request random number is greater than a preset random number threshold, selecting the production environment from the multiple operating environments as the target operating environment; or, if the request random number is less than the preset random number threshold, selecting the test environment from the multiple operating environments as the target operating environment.
[0010] In combination with the first aspect, in one embodiment of the present application, selecting a target operating environment from multiple operating environments based on the login request includes: parsing the login request and confirming that the login request carries a browser identifier; if the browser identifier includes a first sub-identifier, selecting the production environment from the multiple operating environments as the target operating environment; if the browser identifier includes a second sub-identifier, selecting the test environment from the multiple operating environments as the target operating environment.
[0011] Therefore, the embodiment of the present application can distinguish whether the user who logs into the system to be logged in is a normal user or a test user by identifying the browser identifier, so that the corresponding target operating environment can be allocated.
[0012] In combination with the first aspect, in one embodiment of the present application, after parsing the login request and confirming that the login request carries a browser identifier, the method also includes: confirming that the first sub-identifier or the second sub-identifier does not exist in the browser identifier; extracting the user identifier from the login request includes: extracting the user identifier from the browser identifier.
[0013] In combination with the first aspect, in one embodiment of the present application, before confirming that the login request carries a browser identifier, the method also includes: confirming that there is no first identifier in the request header of the login request, and confirming that there is no access address corresponding to the second identifier in the login request.
[0014] Therefore, the embodiment of the present application verifies the browser identifier only after confirming that the first identifier does not exist in the request header and that the access address corresponding to the second identifier does not exist in the login request, thereby improving the accuracy of user identification.
[0015] In combination with the first aspect, in one embodiment of the present application, the target operating environment is selected from multiple operating environments based on the login request, including: determining whether the request header in the login request includes a first identifier or a second identifier; if the first identifier or the second identifier is included, the target operating environment is selected accordingly; if the first identifier or the second identifier is not included, determining whether the login request includes an access address corresponding to the second identifier; if the access address is included, the target operating environment corresponding to the second identifier is selected; if the access address is not included, verifying whether the first sub-identifier or the second sub-identifier exists in the browser identifier; if the first sub-identifier or the second sub-identifier exists, the target operating environment is selected. Select the corresponding target operating environment; if the first sub-identifier or the second sub-identifier does not exist, determine whether there is a user identifier in the browser identifier; if the user identifier exists, select the operating environment corresponding to the user identifier from the multiple operating environments as the target operating environment; if the user identifier does not exist, confirm that the current allocation method is a random mode, and then obtain a request random number; and if the request random number is greater than a preset random number preset, select the production environment from the multiple operating environments as the target operating environment; if the request random number is less than the preset random number preset, select the test environment from the multiple operating environments as the target operating environment.
[0016] In the second aspect, the present application provides a system for system login, the system comprising: a client, configured to obtain a login request input by a user and send the login request; a server cluster, the server cluster comprising at least: an environment selection server, configured to: obtain a login request sent by a user for logging into a system to be logged in; select a target operating environment from multiple operating environments based on the login request, wherein the multiple operating environments include at least a production environment and a test environment, the system to be logged in includes an online version system or a version system to be updated, the production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated; a request processing server, configured to: load the target operating environment into the system to be logged in to obtain a target system to be logged in; process the login request according to the target system to be logged in to obtain a login result, and return the login result to the user.
[0017] In a third aspect, the present application provides a system login device, the device comprising: a request acquisition module, configured to acquire a login request sent by a user for logging into a system to be logged in; an operating environment selection module, configured to select a target operating environment from multiple operating environments based on the login request, wherein the multiple operating environments at least include a production environment and a test environment, the system to be logged in includes an online version system or a to-be-updated version system, the production environment is used to deploy the online version system, and the test environment is used to deploy the to-be-updated version system;
[0018] The operating environment loading module is configured to load the target operating environment into the system to be logged in to obtain the target system to be logged in; the result feedback module is configured to process the login request according to the target system to be logged in to obtain the login result, and return the login result to the user.
[0019] In combination with the third aspect, in one embodiment of the present application, the login request carries a user identifier, and the user identifier includes a first identifier or a second identifier; the operating environment selection module is configured to: parse the login request, and extract the user identifier from the login request; if the user identifier is the first identifier, select the production environment from the multiple operating environments as the target operating environment; if the user identifier is the second identifier, select the test environment from the multiple operating environments as the target operating environment.
[0020] In combination with the third aspect, in one embodiment of the present application, the operating environment selection module is configured to: parse the login request and confirm that the login request does not carry a user identifier; confirm that the current allocation method is a random mode, then obtain a request random number; if the request random number is greater than a preset random number threshold, then select the production environment from the multiple operating environments as the target operating environment; or, if the request random number is less than the preset random number threshold, then select the test environment from the multiple operating environments as the target operating environment.
[0021] In combination with the third aspect, in one embodiment of the present application, the operating environment selection module is configured to: parse the login request and confirm that the login request carries a browser identifier; if the browser identifier includes a first sub-identifier, select the production environment from the multiple operating environments as the target operating environment; if the browser identifier includes a second sub-identifier, select the test environment from the multiple operating environments as the target operating environment.
[0022] In combination with the third aspect, in one implementation of the present application, the operating environment selection module is configured to: confirm that the first sub-identifier or the second sub-identifier does not exist in the browser identifier; and extract the user identifier from the browser identifier.
[0023] In combination with the third aspect, in one embodiment of the present application, the operating environment selection module is configured to: confirm that there is no first identifier in the request header of the login request, and confirm that there is no access address corresponding to the second identifier in the login request.
[0024] In combination with the third aspect, in one embodiment of the present application, the operating environment selection module is configured to: determine whether the request header in the login request includes the first identifier or the second identifier; if it contains the first identifier or the second identifier, select the corresponding target operating environment; if it does not contain the first identifier or the second identifier, determine whether the login request includes an access address corresponding to the second identifier; if it contains the access address, select the target operating environment corresponding to the second identifier; if it does not contain the access address, check whether the browser identifier contains the first sub-identifier or the second sub-identifier; if the first sub-identifier or the second sub-identifier exists, select the corresponding target operating environment; if the first sub-identifier or the second sub-identifier does not exist, determine whether there is a user identifier in the browser identifier; if the user identifier exists, select the operating environment corresponding to the user identifier from the multiple operating environments as the target operating environment; if the user identifier does not exist, confirm that the current allocation method is a random mode, and then obtain a request random number; and if the request random number is greater than a preset random number preset, select the production environment from the multiple operating environments as the target operating environment; if the request random number is less than the preset random number preset, select the test environment from the multiple operating environments as the target operating environment.
[0025] In a fourth aspect, the present application provides an electronic device comprising: a processor, a memory and a bus; the processor is connected to the memory via the bus, the memory stores a computer program, and when the computer program is executed by the processor, it can implement the method described in any embodiment of the first aspect.
[0026] In a fifth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed, can implement the method described in any embodiment of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of the scene composition of system login shown in an embodiment of the present application;
[0028] Figure 2 This is one of the flow charts of the method for system login shown in the embodiment of the present application;
[0029] Figure 3 A system login flow chart in the related art;
[0030] Figure 4 This is a second flowchart of the method for system login shown in an embodiment of the present application;
[0031] Figure 5A schematic diagram of the internal structure of a system to be logged in in the related art;
[0032] Figure 6 A schematic diagram of the internal structure of the system to be logged in shown in an embodiment of the present application;
[0033] Figure 7 This is a flowchart of the method of system login shown in the embodiment of the present application;
[0034] Figure 8 A schematic diagram of the structure of a system login device shown in an embodiment of the present application;
[0035] Fig. 9 A schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0037] The embodiments of the present application can be applied to the scenario where the user is verified when logging into the system to be logged in. In order to improve the problems in the background technology, in some embodiments of the present application, the user's login request is verified, so as to select the target operating environment corresponding to the login request from multiple operating environments. For example, in some embodiments of the present application, first, the login request sent by the user is obtained, then the login request is identified using a multi-environment diversion script, and the target operating environment is selected from multiple operating environments, and finally, the target system to be logged in corresponding to the target operating environment is used to obtain the login result, and the login result is returned to the user.
[0038] The method steps in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0039] Figure 1A schematic diagram of the scene composition of system login in some embodiments of the present application is provided, and the system includes a client 110, an environment selection server 120, and a request processing server 130. Specifically, after obtaining the user's login request, the client 110 sends the login request to the environment selection server 120. After receiving the login request, the environment selection server 120 selects a target operating environment from multiple operating environments based on the login request. After obtaining the target operating environment, the request processing server 130 obtains the login result through the target system to be logged in corresponding to the target operating environment, and feeds the login result back to the client 110.
[0040] What is different from the embodiments of the present application is that in the related art, when users use the software, they usually log in to the online system that has been deployed and iterated in the production environment. However, some functions of the online system may be imperfect, which reduces the user experience. The embodiments of the present application select a target operating environment from multiple operating environments and use the system corresponding to the target operating environment to return the login result.
[0041] The following describes the specific implementation process of a system login method performed by a server provided in some embodiments of the present application.
[0042] At least to solve the problems in the background technology, such as Figure 2 As shown, some embodiments of the present application provide a method for logging into a system, the method comprising:
[0043] S210, obtaining a login request sent by a user for logging into a system to be logged in.
[0044] That is to say, when a user needs to log in to a system to be logged in, he usually sends a login request, and the server receives the login request after the user sends it.
[0045] It is understandable that the login request may include a user ID, a user name, a user ID number, etc.
[0046] S220: Select a target operating environment from multiple operating environments based on the login request.
[0047] It should be noted that the multiple operating environments include at least a production environment and a test environment. The system to be logged in includes an online version system or a version system to be updated. The production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated.
[0048] In one embodiment of the present application, the login request carries a user identifier, and the user identifier includes a first identifier or a second identifier. S220 includes: parsing the login request and extracting the user identifier from the login request. If the user identifier is the first identifier, the production environment is selected from multiple operating environments as the target operating environment; if the user identifier is the second identifier, the test environment is selected from multiple operating environments as the target operating environment.
[0049] It can be understood that the first identifier is an identifier corresponding to the production environment, and the second identifier is an identifier corresponding to the test environment. The user identifier can be a "token" commonly used by users to access web pages.
[0050] That is to say, after parsing the login request, "token" is extracted from the login request. If "token" is the first identifier, the production environment is selected as the target operating environment from multiple operating environments. If "token" is the second identifier, the test environment is selected as the target operating environment from multiple operating environments.
[0051] It should be noted that the user identifier may also include a third identifier, namely, a development environment. If "token" is the third identifier, the development environment is selected from multiple operating environments as the target operating environment.
[0052] Therefore, the embodiment of the present application can enable normal users to access a system with complete functions and enable test users to access a system whose functions are to be authenticated by distinguishing user identifiers and identifying user identifiers during the user login process.
[0053] In one embodiment of the present application, S220 includes: first, parsing the login request and confirming that the login request does not carry a user identifier. Then, confirming that the current allocation mode is a random mode, obtaining a request random number. Finally, if the request random number is greater than or equal to a preset random number threshold, selecting a production environment as a target operating environment from multiple operating environments; or, if the request random number is less than a preset random number threshold, selecting a test environment as a target operating environment from multiple operating environments.
[0054] That is to say, not all login requests carry user identifiers. When the user request does not carry a user identifier, the current mode for confirming the target operating environment needs to be adjusted to a random mode, that is, a random number needs to be obtained first, for example, the random number is 3. Then the random number is compared with the random number preset. If the random number is greater than or equal to the preset random number threshold, the production environment is selected as the target operating environment. If the random number is less than the preset random number threshold, the test environment is selected as the target operating environment.
[0055] In another embodiment of the present application, if the random number is less than a preset random number threshold, the production environment is selected as the target operating environment; if the random number is greater than or equal to the preset random number threshold, the test environment is selected as the target operating environment.
[0056] It is understandable that the selection range of the random number can be set according to actual conditions, and the random number threshold can also be set according to actual conditions, for example, the random number threshold can be 4 or 5. The embodiments of the present application are not limited thereto.
[0057] In one embodiment of the present application, S220 further includes: parsing the login request and confirming that the login request carries a browser identifier. If the browser identifier includes a first sub-identifier, a production environment is selected from multiple operating environments as a target operating environment; if the browser identifier includes a second sub-identifier, a test environment is selected from multiple operating environments as a target operating environment.
[0058] It is understandable that the browser identifier is a "cookie" that is often used in user login scenarios. The first sub-identifier is an identifier corresponding to the production environment, and the second sub-identifier is an identifier corresponding to the test environment.
[0059] That is to say, after obtaining the user's login request, the target operating environment can also be selected through "cookies". Specifically, after confirming that the login request carries a browser identifier, if the browser identifier includes an identifier corresponding to the production environment, the production environment is selected as the target operating environment, and if the browser identifier includes an identifier corresponding to the test environment, the test environment is selected as the target operating environment.
[0060] Therefore, the embodiment of the present application can distinguish whether the user who logs into the system to be logged in is a normal user or a test user by identifying the browser identifier, so that the corresponding target operating environment can be allocated.
[0061] In one implementation of the present application, regarding the above embodiment, before confirming that the login request carries the browser identifier, it is also necessary to confirm that the first identifier does not exist in the request header of the login request, and to confirm that the access address corresponding to the second identifier does not exist in the login request.
[0062] That is to say, when the first identifier and the access address corresponding to the test environment do not exist in the request header, it is necessary to determine whether the login request carries the browser identifier.
[0063] Therefore, the embodiment of the present application verifies the browser identifier only after confirming that the first identifier does not exist in the request header and that the access address corresponding to the second identifier does not exist in the login request, thereby improving the accuracy of user identification.
[0064] In an implementation manner of the present application, S220 includes: confirming that the first sub-identifier or the second sub-identifier does not exist in the browser identifier, and extracting the user identifier from the browser identifier.
[0065] That is to say, there is a situation where the browser identifier does not contain the first sub-identifier or the second sub-identifier. If it is confirmed that the browser identifier does not contain the first sub-identifier or the second sub-identifier, it is necessary to extract the user identifier from the "cookie".
[0066] S230, loading the target operating environment into the system to be logged in to obtain the target system to be logged in.
[0067] That is to say, after obtaining the confirmation of the target operating environment, the target operating environment needs to be loaded on the system to be logged in to obtain the target system to be logged in. In addition, the target system to be logged in can also be directly confirmed according to the target operating environment.
[0068] It can be understood that the target system to be logged in can be an online version system or a version system to be updated. If the target operating environment is a production environment, the target system to be logged in is confirmed to be an online version system. If the target operating environment is a test environment, the target system to be logged in is confirmed to be a version system to be updated.
[0069] S240, processing the login request according to the target system to be logged in to obtain a login result, and returning the login result to the user.
[0070] That is to say, the user logs in to the target system to be logged in, and the target system to be logged in will return the login result. It can be understood that the target system to be logged in can be any web page, for example, a data query web page, a music playback web page, etc.
[0071] The above describes the specific implementation process of a system login method provided by the present application, and the following will describe a specific embodiment of a system login method.
[0072] In related technologies, with the rapid iteration of software functions, the complexity of system functions is increasing. Each iteration of a product will bring certain security risks to the stability of the system, resulting in certain problems in the official version of the software. Errors generated by the software during user use will reduce the user experience. If this problem is not rectified in a timely manner, users' trust in the software will become lower and lower, and they may eventually give up using it.
[0073] In order to solve the problem of reduced user experience caused by the released version, this application is committed to finding out potential security issues in the official version (i.e. the online version system) in advance in the gray version (i.e. the version system to be updated), to ensure that the online version system will not reduce the user experience.
[0074] like Figure 3 As shown, in the related art, the user 310 sends a login request to the online version system 330 through the gateway 320 , and the online version system 330 generates a login result and returns it to the user 310 .
[0075] This application is different from the related art in that Figure 4 As shown, user 310 sends a login request to environment selection server 410 through gateway 320. Environment selection server 410 selects a target operating environment from multiple operating environments, and then logs in to the online version system 330 or the version system to be updated accordingly, and then returns the login result to user 310.
[0076] like Figure 5 As shown, in the related art, the server cluster only includes one production environment 330. Specifically, the structure of the server cluster consists of an access layer 510, an application layer 520, a middleware 530, and a persistence layer 540. Among them, the access layer 510 includes an interface, the application layer 520 includes service-1, service-2, and even service-n, the middleware 530 includes message middleware, cache middleware, middleware-n, etc., and the persistence layer 540 includes data indexes, databases, persistence layer-n, etc., wherein n is an integer greater than 1.
[0077] This application is different from the related art in that Figure 6 As shown, the server cluster includes a server corresponding to a production environment and a server corresponding to a test environment. Specifically, the structure of the server cluster is composed of an access layer 510, a routing layer 610, an application layer 520, a middleware 530 and a persistence layer 540. Obviously, the present application has an additional multi-environment diversion script in the access layer, which is used to determine which operating environment the user should log in to based on the user request. Among them, the routing layer 610 includes an interface, the application layer 520 includes service-1 to service-n, and the middleware 530 includes message middleware, middleware-n, etc. It can be understood that the server corresponding to the production environment and the server corresponding to the test environment have the same framework structure, and share the persistence layer 540.
[0078] In other words, the software architecture and deployment in related technologies all adopt a single-environment cluster and rolling release, which cannot solve the compensation mechanism after the user encounters errors in the official version. Rollback means rolling back the entire code (revoking the released new functions and restoring to the version before release), and all new functions previously open to users will be lost. As a result, users cannot find new functions when using them. If the rollback is not carried out, the user experience will be reduced for other users when using the problematic functions.
[0079] Therefore, this application can make up for the shortcomings of traditional software architecture and deployment through the transformation of the architectural structure. A faster rollback method or compensation mechanism can be used to solve the problem of reduced user experience. Since the architecture is deployed in multiple environments, the user's access request can be quickly forwarded and adjusted according to the script flow switching process, avoiding the problem of reduced user experience caused by security vulnerability code.
[0080] As a specific embodiment of the present application, a multi-environment diversion script of the access layer is used to forward the analysis request. The backend service has a token feature (i.e., a user identifier used to distinguish user identities), and the user identifier can be analyzed from the request token. The front-end static resources insert a cookie (i.e., a browser identifier, which will be sent to the server when a login request is sent) into the browser through the backend service based on the cookie feature to solve the loading problem of the grayscale release of static resources.
[0081] like Figure 7 As shown, specifically, first execute S701 system configuration, that is, it is necessary to configure the configuration contents of multiple operating environments, the interface contents of login requests, etc. in the server, and then execute S702 to determine whether to turn on the grayscale system. If not, select the production environment 330. If so, execute S703 to determine whether the request header includes environmental rules, and then execute S704 to determine whether the request header specifies the system environment. If so, execute S705 to determine whether the system environment is compliant. If not, execute S706. If S705 determines that it is compliant, determine the target operating environment according to the identification of the system environment, that is, if the identification of the system environment is G, determine that the target operating environment is the grayscale environment 724, and if the identification of the system environment is P, determine that the target operating environment is the production environment 330. If S705 determines that it is not compliant, execute S706.
[0082] After that, execute S706 URI matching rule, first execute S707 to determine whether there is a gray system URI, if so, select the gray environment, if not, enter S708 cookie cache rule. Then execute S710 to determine whether the cookie has an environment identifier, if so, execute S712 to determine whether the cookie is valid, if not, execute S709, if yes, execute S715 cache environment identifier.
[0083] After that, execute S709 to obtain the user ID from the cookie, and S711 to determine whether it exists. If so, enter S714 with token rules, if not, enter S713 without token rules. In the steps included in S713, first execute S716 to determine whether it is random, if not, select the production environment, if so, execute S718 to obtain the request random number, and then execute S720 to request that the random number is greater than the random number threshold, if so, select the production environment 330, if not, select the grayscale environment.
[0084] In the steps included in S714, first execute S717 to determine whether a grayscale enterprise is configured. If so, execute S719 to determine whether the current enterprise is a grayscale enterprise. If not, select the production environment. In S719, if yes, select the grayscale environment, otherwise select the production environment. After that, execute S721 to obtain the environment to be routed in the end, S722 to add the response cookie environment cache, if the mark is P, select the production environment, if the mark is G, select the grayscale environment. Finally, execute S723 to request the end.
[0085] It should be noted that the production environment is a server cluster of the official version of the software, which mainly provides services to all or most users, and the software version is a stable version. The grayscale environment is a server cluster of the informal version of the software, which mainly provides services to grayscale users. The software version is a new version and is not stable. Grayscale users need to run in this environment for a period of time to evolve into a stable version. The grayscale environment includes the development environment and the test environment. Grayscale users are pre-specified users who test the software. Grayscale enterprises are pre-specified enterprises that test the software.
[0086] Specifically, each visit of the user will go through Figure 7The shown flow switching script first checks whether there are multiple operating environments, that is, whether multiple operating environments allow flow switching. Then, it determines whether the verification request header points to the environment rule (that is, specifies which operating environment to go to). If the valid environment rule is met, it is directly routed to the specified environment and the script is terminated, otherwise it continues to execute. Then, it checks whether the current request is the request address of the specified grayscale environment. If it is met, the request is forwarded to the grayscale environment and the script is terminated, otherwise it continues to execute. Then, it verifies the legitimacy of the cookie and checks whether the environment rule carried by the cookie is legal and valid. If it is met, the request is forwarded to the environment specified by the cookie, otherwise it continues to execute. This step is mainly to solve the problem of static resource loading. Then, it checks whether the current request carries a token. If it exists: parse the token, get the user behavior mark, check which environment it belongs to according to the grayscale user configuration, and forward the request to the corresponding operating environment. If it does not exist: first check whether random is turned on. If it is turned off, it is directly routed to the production environment. If it is turned on, a request random number is generated, compared with the configured routing value, and forwarded to the corresponding operating environment.
[0087] As an implementation of the present application, the execution steps of the diversion script are as follows:
[0088] S1: Determine whether the request header in the login request includes the first identifier or the second identifier. If it does, select the target operating environment accordingly. If it does not include the first identifier or the second identifier, determine whether the login request includes an access address corresponding to the second identifier.
[0089] S2: If the access address is included, then select the target operating environment corresponding to the second identifier; if the access address is not included, then check whether the browser identifier contains the first sub-identifier or the second sub-identifier.
[0090] S3: If the first sub-identifier or the second sub-identifier exists, then select the corresponding target operating environment; if the first sub-identifier or the second sub-identifier does not exist, then determine whether the user identifier exists in the browser identifier.
[0091] S4: If there is a user identifier, select an operating environment corresponding to the user identifier from multiple operating environments as the target operating environment.
[0092] S5: If the user identifier does not exist, confirm that the current allocation mode is a random mode, and obtain the requested random number; and
[0093] S6: If the requested random number is greater than the preset random number preset, the production environment is selected from multiple operating environments as the target operating environment; if the requested random number is less than the preset random number preset, the test environment is selected from multiple operating environments as the target operating environment.
[0094] Therefore, this application adjusts the traditional software deployment architecture and cooperates with the flow switching script to analyze user requests in multiple environments, forward the requests to the environment in the policy target, and meet the scheduling of user requests.
[0095] Therefore, when upgrading the software version, the enterprise deploys the newly released version to the grayscale environment, forwards the access traffic of internal employees and certain user groups recruited by the company to the grayscale environment through the rules of the flow switching script to verify whether there are security risks after the new version is released, and uses internal employees or a certain group of recruited users to use the new version functions in advance. After the online operation is stable, all users are switched to the new version environment. In this way, the release of new version functions will not reduce the user experience.
[0096] The above describes a specific embodiment of a system login method of the present application, and the following will describe a system login device of the present application.
[0097] like Figure 8 As shown, some embodiments of the present application provide a system login device 800, a request acquisition module 810, an operating environment selection module 820, an operating environment loading module 830 and a result feedback module 840.
[0098] The request acquisition module 810 is configured to acquire a login request sent by a user for logging into the system to be logged in;
[0099] The operating environment selection module 820 is configured to select a target operating environment from a plurality of operating environments based on the login request, wherein the plurality of operating environments at least include a production environment and a test environment, the system to be logged in includes an online version system or a version system to be updated, the production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated;
[0100] The operating environment loading module 830 is configured to load the target operating environment into the system to be logged in to obtain a target system to be logged in;
[0101] The result feedback module 840 is configured to process the login request according to the target system to be logged in to obtain a login result, and return the login result to the user.
[0102] In one embodiment of the present application, the login request carries a user identifier, and the user identifier includes a first identifier or a second identifier; the operating environment selection module 820 is configured to: parse the login request and extract the user identifier from the login request; if the user identifier is the first identifier, select the production environment from the multiple operating environments as the target operating environment; if the user identifier is the second identifier, select the test environment from the multiple operating environments as the target operating environment.
[0103] In one embodiment of the present application, the operating environment selection module 820 is configured to: parse the login request and confirm that the login request does not carry a user identifier; confirm that the current allocation method is a random mode, then obtain a request random number; if the request random number is greater than a preset random number threshold, then select the production environment from the multiple operating environments as the target operating environment; or, if the request random number is less than the preset random number threshold, then select the test environment from the multiple operating environments as the target operating environment.
[0104] In one embodiment of the present application, the operating environment selection module 820 is configured to: parse the login request and confirm that the login request carries a browser identifier; if the browser identifier includes a first sub-identifier, select the production environment from the multiple operating environments as the target operating environment; if the browser identifier includes a second sub-identifier, select the test environment from the multiple operating environments as the target operating environment.
[0105] In one implementation of the present application, the operating environment selection module 820 is configured to: confirm that the first sub-identifier or the second sub-identifier does not exist in the browser identifier; and extract the user identifier from the browser identifier.
[0106] In one embodiment of the present application, the operating environment selection module 820 is configured to: confirm that there is no first identifier in the request header of the login request, and confirm that there is no access address corresponding to the second identifier in the login request.
[0107] In one embodiment of the present application, the operating environment selection module 820 is configured to: determine whether the request header in the login request includes the first identifier or the second identifier; if the first identifier or the second identifier is included, the target operating environment is selected accordingly; if the first identifier or the second identifier is not included, determine whether the login request includes an access address corresponding to the second identifier; if the access address is included, select the target operating environment corresponding to the second identifier; if the access address is not included, check whether the browser identifier has the first sub-identifier or the second sub-identifier; if the first sub-identifier or the second sub-identifier exists, select the corresponding target operating environment. operating environment; if the first sub-identifier or the second sub-identifier does not exist, determine whether there is a user identifier in the browser identifier; if the user identifier exists, select the operating environment corresponding to the user identifier from the multiple operating environments as the target operating environment; if the user identifier does not exist, confirm that the current allocation method is a random mode, and then obtain a request random number; and if the request random number is greater than a preset random number preset, select the production environment from the multiple operating environments as the target operating environment; if the request random number is less than the preset random number preset, select the test environment from the multiple operating environments as the target operating environment.
[0108] In the embodiments of the present application, Figure 8 The modules shown can achieve Figures 1 to 7 Each process in the method embodiment. Figure 8 The operations and / or functions of each module in Figures 1 to 7 For details, please refer to the description in the above method embodiment. To avoid repetition, detailed description is appropriately omitted here.
[0109] like Fig. 9 As shown, an embodiment of the present application provides an electronic device 900, including: a processor 910, a memory 920 and a bus 930, wherein the processor is connected to the memory via the bus, and the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, they are used to implement a method as described in any one of the above embodiments. For details, please refer to the description in the above method embodiments. To avoid repetition, the detailed description is appropriately omitted here.
[0110] Among them, the bus is used to realize the direct connection and communication of these components. Among them, the processor in the embodiment of the present application can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0111] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the method described in the above embodiment may be executed.
[0112] Understandably, Fig. 9 The structure shown is for illustration only and may also include Fig. 9 More or fewer components as shown, or with Fig. 9 Different configurations shown. Fig. 9 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0113] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a server, any method described in any of the above-mentioned embodiments is implemented. For details, please refer to the description in the above-mentioned method embodiments. To avoid repetition, the detailed description is appropriately omitted here.
[0114] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0115] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for logging into a system, characterized in that: The method comprises: Obtaining a login request sent by a user for logging into a system to be logged in, where the user identifier includes a first identifier or a second identifier; Selecting a target operating environment from a plurality of operating environments based on the login request, wherein the plurality of operating environments at least include a production environment and a test environment, the system to be logged in includes an online version system or a version system to be updated, the production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated; Loading the target operating environment into the system to be logged in to obtain the target system to be logged in; Processing the login request according to the target system to be logged in to obtain a login result, and returning the login result to the user; The selecting of the target operating environment from the plurality of operating environments based on the login request includes: determining whether the request header in the login request includes the first identifier or the second identifier; if the first identifier or the second identifier is included, selecting the target operating environment accordingly; if the first identifier or the second identifier is not included, determining whether the login request includes an access address corresponding to the second identifier; if the access address is included, selecting the target operating environment corresponding to the second identifier; if the access address is not included, verifying whether the browser identifier contains the first sub-identifier or the second sub-identifier; if the first sub-identifier or the second sub-identifier exists, selecting the corresponding target operating environment. target operating environment; if the first sub-identifier or the second sub-identifier does not exist, determine whether there is a user identifier in the browser identifier; if the user identifier exists, select the operating environment corresponding to the user identifier from the multiple operating environments as the target operating environment; if the user identifier does not exist, confirm that the current allocation method is a random mode, and then obtain a request random number; and if the request random number is greater than a preset random number preset, select the production environment from the multiple operating environments as the target operating environment; if the request random number is less than the preset random number preset, select the test environment from the multiple operating environments as the target operating environment.
2. The method according to claim 1, characterized in that The login request carries a user identifier; The selecting a target operating environment from a plurality of operating environments based on the login request includes: Parsing the login request and extracting the user identifier from the login request; If the user identifier is the first identifier, selecting the production environment from the multiple operating environments as the target operating environment; If the user identifier is the second identifier, the test environment is selected from the multiple operating environments as the target operating environment.
3. The method according to claim 2, characterized in that The selecting a target operating environment from a plurality of operating environments based on the login request includes: Parsing the login request and confirming that the login request carries a browser identifier; If the browser identifier includes the first sub-identifier, selecting the production environment from the multiple operating environments as the target operating environment; If the browser identifier contains the second sub-identifier, the test environment is selected from the multiple operating environments as the target operating environment.
4. The method according to claim 3, characterized in that After parsing the login request and confirming that the login request carries a browser identifier, the method further includes: confirming that the first sub-identifier or the second sub-identifier does not exist in the browser identifier; The extracting the user identifier from the login request comprises: The user identifier is extracted from the browser identifier.
5. The method according to claim 4, characterized in that Before confirming that the login request carries the browser identifier, the method further includes: Confirm that the first identifier does not exist in the request header of the login request, and confirm that the access address corresponding to the second identifier does not exist in the login request.
6. A system for system login, characterized in that: The system comprises: The client is configured to obtain a login request input by a user and send the login request; A server cluster, the server cluster at least comprising: The environment selects the server, which is configured as: Obtaining a login request sent by a user for logging into a system to be logged in, where the user identifier includes a first identifier or a second identifier; Selecting a target operating environment from a plurality of operating environments based on the login request, wherein the plurality of operating environments at least include a production environment and a test environment, the system to be logged in includes an online version system or a version system to be updated, the production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated; The request processing server is configured as: Loading the target operating environment on the system to be logged in to obtain the target system to be logged in; processing the login request according to the target system to be logged in to obtain a login result, and returning the login result to the user; The selecting of the target operating environment from the plurality of operating environments based on the login request includes: determining whether the request header in the login request includes the first identifier or the second identifier; if the first identifier or the second identifier is included, selecting the target operating environment accordingly; if the first identifier or the second identifier is not included, determining whether the login request includes an access address corresponding to the second identifier; if the access address is included, selecting the target operating environment corresponding to the second identifier; if the access address is not included, verifying whether the browser identifier contains the first sub-identifier or the second sub-identifier; if the first sub-identifier or the second sub-identifier exists, selecting the corresponding target operating environment. target operating environment; if the first sub-identifier or the second sub-identifier does not exist, determine whether there is a user identifier in the browser identifier; if the user identifier exists, select the operating environment corresponding to the user identifier from the multiple operating environments as the target operating environment; if the user identifier does not exist, confirm that the current allocation method is a random mode, and then obtain a request random number; and if the request random number is greater than a preset random number preset, select the production environment from the multiple operating environments as the target operating environment; if the request random number is less than the preset random number preset, select the test environment from the multiple operating environments as the target operating environment.
7. A system login device, characterized in that: The device comprises: A request acquisition module is configured to acquire a login request sent by a user for logging into the system to be logged in, where the user identifier includes the first identifier or the second identifier; An operating environment selection module is configured to select a target operating environment from a plurality of operating environments based on the login request, wherein the plurality of operating environments at least include a production environment and a test environment, the system to be logged in includes an online version system or a version system to be updated, the production environment is used to deploy the online version system, and the test environment is used to deploy the version system to be updated; An operating environment loading module is configured to load the target operating environment into the system to be logged in to obtain a target system to be logged in; A result feedback module is configured to process the login request according to the target system to be logged in to obtain a login result, and return the login result to the user; The operating environment selection module is specifically used to: determine whether the request header in the login request includes the first identifier or the second identifier; if the first identifier or the second identifier is included, select the corresponding target operating environment; if the first identifier or the second identifier is not included, determine whether the login request includes an access address corresponding to the second identifier; if the access address is included, select the target operating environment corresponding to the second identifier; if the access address is not included, check whether the browser identifier contains the first sub-identifier or the second sub-identifier; if the first sub-identifier or the second sub-identifier exists, select the corresponding target operating environment; if If the first sub-identifier or the second sub-identifier does not exist, determine whether there is a user identifier in the browser identifier; if the user identifier exists, select the operating environment corresponding to the user identifier from the multiple operating environments as the target operating environment; if the user identifier does not exist, confirm that the current allocation method is a random mode, and obtain a request random number; and if the request random number is greater than a preset random number preset, select the production environment from the multiple operating environments as the target operating environment; if the request random number is less than the preset random number preset, select the test environment from the multiple operating environments as the target operating environment.
8. An electronic device, characterized in that: include: processor, memory, and bus; The processor is connected to the memory via the bus, the memory stores a computer program, and the computer program, when executed by the processor, can implement the method as claimed in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed, can implement the method as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
System login control method and device and computer readable storage medium
CN111355742A
Method and system for realizing gray release based on development platform and framework
CN114138307A