User authentication method, device, server and storage medium
By obtaining the access object parameters and user identification in the access request, obtaining the user permission list and comparing the path and business identification, the problem of large permission maintenance workload and slow authentication speed in the existing technology is solved, and more efficient user authentication is achieved. rights process.
Patent Information
- Application Number
- CN202011380096.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-30
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2040-11-30
AI Technical Summary
The user authentication method in the existing technology requires a large number of permission schemes to be set in advance, resulting in a heavy workload of permission maintenance and slow authentication speed.
By obtaining the access object parameters and user identification in the access request, obtain a matching user permission list, including a path list and a business identification list, and use regular expressions to compare the access path and business identification to determine whether the authentication has passed or failed, allowing Visit the corresponding business.
It reduces the workload of permission maintenance, improves the authentication speed, and reduces the number of permission schemes that need to be set in advance.
Smart Images

Figure CN112507298B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a user authentication method, device, server and storage medium. Background Art
[0002] Currently, when a user accesses a service platform, in order to ensure the security of the user and the platform, the user's access request needs to be authenticated. Only when the authentication is passed, the user is allowed to access the services of the service platform.
[0003] In the related art, in order to authenticate the user's access request, a large number of permission schemes need to be set in advance, which leads to a large workload of permission maintenance. In addition, since authentication usually involves comparing the access parameters carried in the access request with each permission scheme to authenticate the user's access request, if a large number of permission schemes are set in advance, the authentication speed will be slow. Summary of the invention
[0004] The present disclosure provides a user authentication method, device, server and storage medium to at least solve the problems of heavy workload of authority maintenance and slow authentication speed existing in the user authentication method in the related art.
[0005] The technical solution of the present disclosure is as follows:
[0006] Obtain the access object parameter and user identifier carried in the access request; obtain a user permission list matching the user identifier; wherein the user permission list includes a path list with access rights and a service identifier list with access rights; compare the access path in the access object parameter with the path list, and compare the access service identifier in the access object parameter with the service identifier list; if a prefix of the access path exists in the path list and the access service identifier exists in the service identifier list, determine that the access request authentication is passed, and allow access to the service corresponding to the access service identifier with the access path.
[0007] As a first possible scenario of an embodiment of the present disclosure, the comparing the access path in the access object parameter with the path list, and the comparing the access service identifier in the access object parameter with the service identifier list, includes: using a first regular expression to compare the access path with the path list; when a prefix of the access path exists in the path list, querying the access service identifier in the access object parameter carried in the access request; and when it is determined that the access request carries the access service identifier, using a second regular expression to compare the access service identifier with the service identifier list.
[0008] As a second possible situation of the embodiment of the present disclosure, after comparing the access path with the path list using the first regular expression, the method further includes: when the prefix of the access path does not exist in the path list, determining that the access request authentication fails.
[0009] As a third possible situation of an embodiment of the present disclosure, after querying the access service identifier in the access object parameter carried in the access request, it also includes: if the access service identifier is not carried in the access request, determining that the access request authentication is successful.
[0010] As a fourth possible situation of the embodiment of the present disclosure, before obtaining the access object parameter and the user identifier carried in the access request, the method further includes: monitoring the access request of the service platform; and performing routing interception on the access request.
[0011] As a fifth possible situation of an embodiment of the present disclosure, obtaining a user permission list that matches the user identifier includes: sending a list request carrying the user identifier to a set interface to obtain the user permission list that matches the user identifier; adding a prototype attribute; wherein the prototype attribute points to the user permission list, and is used to reference the prototype attribute to obtain the user permission list when an access request carrying the user identifier is intercepted again subsequently.
[0012] According to a second aspect of an embodiment of the present disclosure, a user authentication device is provided, comprising: a first acquisition module, configured to acquire an access object parameter and a user identifier carried in the access request; a second acquisition module, configured to acquire a user permission list matching the user identifier; wherein the user permission list comprises a path list with access rights and a service identifier list with access rights; a comparison module, configured to compare the access path in the access object parameter with the path list, and to compare the access service identifier in the access object parameter with the service identifier list; the first authentication module, configured to determine that the access request authentication is passed, and to allow access to the service corresponding to the access service identifier with the access path, when a prefix of the access path exists in the path list and the access service identifier exists in the service identifier list.
[0013] As a first possible situation of an embodiment of the present disclosure, the comparison module includes: a first comparison unit, configured to use a first regular expression to compare the access path with the path list; a query unit, configured to query the access service identifier in the access object parameter carried in the access request when the prefix of the access path exists in the path list; and a second comparison unit, configured to use a second regular expression to compare the access service identifier with the service identifier list when it is determined that the access request carries the access service identifier.
[0014] As a second possible situation of the embodiment of the present disclosure, the apparatus further includes: a second authentication module configured to determine that the access request authentication fails when the prefix of the access path does not exist in the path list.
[0015] As a third possible situation of the embodiment of the present disclosure, the apparatus further includes: a third authentication module configured to determine that the access request is authenticated if the access service identifier is not carried in the access request.
[0016] As a fourth possible situation of the embodiment of the present disclosure, the device further includes: a monitoring module configured to monitor access requests from the service platform; and an interception module configured to perform routing interception on the access requests.
[0017] As a fifth possible situation of the embodiment of the present disclosure, the second acquisition module includes: an acquisition unit, configured to send a list request carrying the user identifier to a set interface to obtain the user permission list matching the user identifier; an adding unit, configured to add a prototype attribute; wherein the prototype attribute points to the user permission list, and is used to reference the prototype attribute to obtain the user permission list when an access request carrying the user identifier is intercepted again subsequently.
[0018] According to the third aspect of an embodiment of the present disclosure, a server is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the user authentication method proposed in the embodiment of the first aspect of the present disclosure.
[0019] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of a server, the server is enabled to execute the user authentication method proposed in the embodiment of the first aspect of the present disclosure.
[0020] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided. When the computer program is executed by a processor of a server, the server can execute the user authentication method proposed in the embodiment of the first aspect of the present disclosure.
[0021] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0022] By obtaining the access object parameter and user identifier carried in the access request, a user permission list matching the user identifier is obtained according to the user identifier, wherein the user permission list includes a path list with access rights and a business identifier list with access rights, and then the access path in the access object parameter carried in the access request is compared with the path list, and the access business identifier in the access object parameter is compared with the business identifier list, so that when there is a prefix of the access path in the path list and an access business identifier in the business identifier list, it is determined that the access request authentication is passed, and access to the business corresponding to the access business identifier with the access path is allowed, thereby realizing the authentication of the user's access request, improving the authentication speed, and reducing the workload of permission maintenance.
[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0025] Figure 1 is a flow chart of a user authentication method according to an exemplary embodiment;
[0026] Figure 2 is a flow chart of another user authentication method according to an exemplary embodiment;
[0027] Figure 3 is a flow chart of another user authentication method according to an exemplary embodiment;
[0028] Figure 4 is a flow chart of another user authentication method according to an exemplary embodiment;
[0029] Figure 5 is a block diagram of a user authentication device according to an exemplary embodiment;
[0030] Figure 6 is a block diagram of another user authentication device according to an exemplary embodiment;
[0031] Figure 7 The invention is a block diagram of a server for user authentication according to an exemplary embodiment. DETAILED DESCRIPTION
[0032] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0034] At present, when users access the service platform, in order to ensure the security of users and the platform, the user's access request needs to be authenticated. Only when the authentication is passed, the user is allowed to access the service of the service platform. Taking the game platform as an example, the user needs to have both the game access path permission and the game identification permission to access the game content through the access path.
[0035] In the related art, taking the permission management of the game platform as an example, for example, a user has the permission to access path a and access path b, and the permission to the three game identifiers of game A, game B, and game C, then the following 6 permission schemes corresponding to the user need to be pre-set: 1) permission to have access path a and the game identifier of game A; 2) permission to have access path b and the game identifier of game A; 3) permission to have access path a and the game identifier of game B; 4) permission to have access path b and the game identifier of game B; 5) permission to have access path a and the game identifier of game C; 6) permission to have access path b and the game identifier of game C. When the access request of the user is obtained, the combination of the access path and the game identifier in the access request, such as access path a and game A, needs to be compared with the above 6 permission schemes to authenticate the access request of the user.
[0036] Then, assuming that a user has the authority of 10 access paths and the authority of 20 game identifiers, it is necessary to pre-set 10*20=200 authority schemes corresponding to the user. When authenticating the access request of the user, it is necessary to compare the combination of the access path and the game identifier in the access request with the 200 pre-set authority schemes. It can be seen that the user authentication method in the related art needs to pre-set a large number of authority schemes in order to authenticate the access request of the user, and the more access paths and game identifiers the user has the authority to, the more authority schemes need to be pre-set, and the greater the workload of authority maintenance. In addition, since the access request of the user is usually authenticated by comparing the access parameters carried in the access request with each authority scheme, if a large number of authority schemes are pre-set, it will also lead to slow user authentication.
[0037] The present disclosure mainly aims at the technical problems of large workload of authority maintenance and slow authentication speed in user authentication methods in related technologies, and proposes a user authentication method. The user authentication method of the present disclosure embodiment obtains the access object parameter and user ID carried in the access request, and then obtains the user authority list matching the user ID, wherein the user authority list includes a path list with access rights and a service ID list with access rights, and then compares the access path in the access object parameter carried in the access request with the path list, and compares the access service ID in the access object parameter with the service ID list, so that when there is a prefix of the access path in the path list and an access service ID in the service ID list, it is determined that the access request authentication is passed, and the service corresponding to the access service ID is allowed to be accessed with the access path, thereby realizing the authentication of the user's access request, improving the authentication speed, and reducing the workload of authority maintenance.
[0038] The user authentication method provided by the embodiment of the present disclosure is described in detail below with reference to the accompanying drawings.
[0039] Figure 1 The figure is a flow chart of a user authentication method according to an exemplary embodiment.
[0040] It should be noted that the executor of the user authentication method of the embodiment of the present disclosure may be a user authentication device, which may be a server or may be configured in a server to authenticate user access requests, thereby increasing the authentication speed and reducing the workload of authority maintenance.
[0041] Among them, the server can be any stationary or mobile computing device capable of data processing, such as mobile computing devices such as laptops and wearable devices, or stationary computing devices such as desktop computers, or other types of computing devices, and the embodiments of the present disclosure are not limited to this.
[0042] like Figure 1 As shown, the user authentication method may include the following steps:
[0043] In step 101, the access object parameter and the user identifier carried in the access request are obtained.
[0044] The access request is a user's access request to a business platform. The business platform may be a game business platform related to the game business, or other business platforms related to other businesses, and this application does not limit this. In addition, the business platform may be a platform developed based on the Vue.js framework, or a platform developed based on other frameworks, and this application does not limit this.
[0045] Among them, the access object parameters may include the access service identifier, access path and other parameters related to any service to be accessed. Among them, the access service identifier is the identifier corresponding to the service to be accessed, i.e., the service to be accessed, which is used to uniquely identify the service to be accessed. It may be the name of the service to be accessed, such as "Game A", or it may be an identification number pre-assigned to the service to be accessed, etc. This application does not impose any restrictions on this. The access path is the access path corresponding to the service to be accessed, through which the service to be accessed can be located.
[0046] The user identifier is used to uniquely identify the user to distinguish the user from other users. The user identifier can be, for example, the user's ID number, mobile phone number, or any other information that can uniquely identify the user, and this application does not limit this.
[0047] In an exemplary embodiment, the access request of the service platform can be monitored, and the access request can be routed and intercepted, and then the access object parameter and user identifier carried by the access request can be obtained from the intercepted access request. That is, before step 101, it can also include: monitoring the access request of the service platform; routing and intercepting the access request.
[0048] In an exemplary embodiment, taking the business platform as a platform developed based on the Vue.js framework as an example, the access request of the business platform can be monitored, and when the user accesses the business platform, it can be intercepted through vue.router, and the access object parameters and user identification carried by the access request can be obtained through the router.beforeEach navigation hook function. Among them, vue.router is a link path management system for WebAPP (web application on mobile terminal), and vue.router and Vue.js are deeply integrated, which is suitable for building single-page applications.
[0049] In step 102, a user authority list matching the user identifier is obtained; wherein the user authority list includes a path list with access rights and a service identifier list with access rights.
[0050] The path list included in the user authority list includes various access paths to which the user has access rights; the service identification list included in the user authority list includes various service identifications to which the user has access rights.
[0051] For example, taking the business platform as a game platform, assuming that a user with the user ID "X1" has the authority to access path a and access path b, and also has the authority to the three business IDs of game A, game B, and game C, then the user authority list corresponding to user "X1" includes access path a and access path b, and the business ID list corresponding to user "X1" includes the three business IDs of game A, game B, and game C.
[0052] In an exemplary embodiment, each access path that each user has access rights to can be pre-determined to form a path list corresponding to each user, and each service identifier that each user has access rights to can be determined to form a service identifier list corresponding to each user, and then a user authority list corresponding to each user can be formed based on the path list and service identifier list corresponding to each user. Furthermore, after obtaining the user identifier carried in the access request, a user authority list matching the user identifier can be obtained from the pre-generated user authority lists corresponding to each user based on the user identifier.
[0053] In step 103, the access path in the access object parameter is compared with the path list, and the access service identifier in the access object parameter is compared with the service identifier list.
[0054] In step 104, when the prefix of the access path exists in the path list and the access service identifier exists in the service identifier list, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier is allowed through the access path.
[0055] In an exemplary embodiment, the access path in the access object parameter can be compared with the path list, and the access service identifier in the access object parameter can be compared with the service identifier list. If the prefix of the access path in the access object parameter carried in the access request exists in the path list, and the access service identifier in the access object parameter carried in the access request exists in the service identifier list, it is determined that the user has the authority to access the service corresponding to the access service identifier with the access path, thereby determining that the access request authentication is passed, thereby allowing access to the service corresponding to the access service identifier with the access path in the access request.
[0056] For example, assuming that the business platform is a game platform, and the user ID of a certain user is "X1", the user has the authority to access paths a and b, and also has the authority to the three business IDs of games A, B, and C. Then, a user authority list of user "X1" can be generated in advance, and the path list included in the user authority list includes access path a and access path b, and the business ID list included in the user authority list includes the three business IDs of games A, game B, and game C. After obtaining the access object parameter and user ID carried in the access request, if the access object parameter includes access path a and access business ID "game B", and the user ID is "X1", then according to the user ID "X1", the user authority list matching the user "X1" can be obtained from the user authority list of each user generated in advance, and the access path a in the access object parameter can be compared with the path list corresponding to the user "X1", and the access business ID "game B" in the access object parameter can be compared with the business ID list corresponding to the user "X1". Since the prefix of access path a exists in the path list corresponding to user "X1", and "Game B" exists in the business identification list corresponding to user "X1", it can be determined that user "X1" has the authority to access the content of business identification "Game B" through access path a. It can be determined that the access request authentication of user "X1" has passed, and access to the business corresponding to business identification "Game B" is allowed through access path a.
[0057] In an exemplary embodiment, taking the business platform as a platform developed based on the vue.js framework as an example, permission control can be implemented through the router.beforeEach navigation hook function. Specifically, the following program can be used for implementation.
[0058]
[0059]
[0060] It should be noted that, in an exemplary embodiment, if it is determined that the prefix of the access path does not exist in the path list, it means that the user does not have the authority to access the corresponding service with the access path. If the prefix of the access path exists in the path list, but the access service identifier does not exist in the service identifier list, it means that although the user has the authority to access the path, he does not have the authority to access the service corresponding to the access service identifier with the access path. It can be determined that the access request authentication has failed.
[0061] In an exemplary embodiment, if it is determined that the access request authentication fails, the request may be routed to the homepage of the service platform and a prompt message may be displayed to prompt the user that the user does not have access rights.
[0062] It can be understood that in the embodiment of the present application, in order to perform user authentication, a path list and a business identification list are pre-generated, that is, when the permission scheme is pre-set, the two dimensions of access path permission and business identification permission are split, and the permissions are cross-bound for the user from the two dimensions, and a path list and a business identification list are generated. Since the path list includes each access path with access rights of the corresponding user, and the business identification list includes each business identification with access rights of the corresponding user, the number of pre-created permission schemes is the sum of the number of access paths with access rights of the user included in the path list and the number of business identifications with access rights of the user included in the business identification list, that is, the sum of the number of permission schemes of the two dimensions. When comparing the access object parameters carried in the access request with the pre-created permission scheme, since the access path in the access object parameter is compared with the path list, and the access business identification in the access object parameter is compared with the business identification list, the number of comparisons when performing user authentication is the sum of the number of access paths with access rights of the user included in the path list and the number of business identifications with access rights of the user included in the business identification list.
[0063] For example, in the above example, when the permission scheme corresponding to user "X1" is pre-created, the created path list includes two access paths, access path a and access path b, to which user "X1" has access rights, and the service identification list includes three service identifications, "Game A", "Game B" and "Game C", to which user "X1" has access rights, that is, 5 permission schemes are pre-created. When authenticating the access request of user "X1", the access path a in the access object parameter carried in the access request of user "X1" is compared with the two access paths included in the path list, and the access service identification "Game B" in the access object parameter carried in the access request of user "X1" is compared with the three service identifications included in the service identification list, that is, the number of comparisons is 5 times.
[0064] Similarly, assuming that a user has the authority to access 10 paths and the authority to access 20 game identifiers, according to the solution of the present application, 10+20=30 authority schemes corresponding to the user need to be pre-set. Compared with the user authentication method in the related art that requires the pre-setting of 10*20=200 authority schemes corresponding to the user, the number of authority schemes that need to be pre-set is significantly reduced. Therefore, the user authentication method provided by the present application can reduce the number of authority schemes that need to be pre-set and reduce the workload during authority maintenance. In addition, when performing user authentication, since the number of pre-set authority schemes is reduced, the number of comparisons is reduced, thereby increasing the authentication speed.
[0065] The user authentication method of the embodiment of the present disclosure obtains the access object parameter and the user identifier carried in the access request, and then obtains the user permission list matching the user identifier, wherein the user permission list includes a path list with access rights and a service identifier list with access rights, and then compares the access path in the access object parameter carried in the access request with the path list, and compares the access service identifier in the access object parameter with the service identifier list, so that when there is a prefix of the access path in the path list and there is an access service identifier in the service identifier list, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier with the access path is allowed, thereby realizing the authentication of the user's access request, improving the authentication speed, and reducing the workload of permission maintenance.
[0066] Through the above analysis, it can be known that the user authentication method provided in the embodiment of the present application can pre-set the user permission list corresponding to each user, and then after obtaining the access object parameter and user identifier carried by the access request, the access path in the access object parameter can be compared with the path list included in the user permission list matching the user identifier, and the access service identifier in the access object parameter can be compared with the service identifier list included in the user permission list matching the user identifier, so as to authenticate the access request. Figure 2 , a method for authenticating an access request by comparing an access path in an access object parameter with a path list, and comparing an access service identifier in an access object parameter with a service identifier list in a user authentication method provided in an embodiment of the present disclosure is described.
[0067] Figure 2 The figure is a flow chart showing another user authentication method according to an exemplary embodiment.
[0068] like Figure 2 As shown, Figure 1 The step 103 shown may specifically include the following steps 201-203.
[0069] In step 201, the access path is compared with the path list using a first regular expression.
[0070] In step 202, when the prefix of the access path exists in the path list, the access service identifier is queried in the access object parameter carried in the access request.
[0071] Among them, a regular expression is a sequence of characters that defines a search pattern, and is usually used for "find" or "find and replace" operations on a string, or for input validation, etc. For example, the regular expression .at can be used to match any three-character string ending with "at", so that the regular expression can match strings such as "hat", "cat", and "bat"; the regular expression a.*?d can be used to match any string starting with "a" and ending with "d", so that the regular expression can match strings such as "and", "aud", etc.
[0072] In an exemplary embodiment, a first regular expression can be set according to the prefix of the access path in the access object parameters to match any string that begins with the prefix of the access path in the access object parameters, and the first regular expression can be used to match in the path list. When the first regular expression is used to match any string that begins with the prefix of the access path in the access object parameters in the path list, it can be determined that the prefix of the access path exists in the path list.
[0073] In step 203, when it is determined that the access request carries an access service identifier, the access service identifier is compared with the service identifier list using a second regular expression.
[0074] It is understandable that in some scenarios, the access request may carry an access service identifier, such as when accessing the content of a specific game, the access request will carry the game identifier of the specific game. In some scenarios, the access request may not carry an access service identifier, for example, when a user requests to perform a public operation of the game platform, such as performing configuration operations such as updating user information that are not related to the game business, the access request will not include the game identifier. Then, in an embodiment of the present application, when determining that there is a prefix of the access path in the path list, the access service identifier can be first queried in the access object parameter carried by the access request to determine whether the access service identifier is carried in the access request. If the access service identifier is carried in the access request, the access service identifier is then compared with the service identifier list.
[0075] In an exemplary embodiment, a second regular expression can be set according to the access service identifier in the access object parameters to match the character string corresponding to the access service identifier. For example, if the access service identifier is "A", the second regular expression can be / A / . When there is a prefix of the access path in the path list and the access request carries the access service identifier, the second regular expression is used to compare the access service identifier with the service identifier list. When the second regular expression is used and the character string corresponding to the access service identifier is matched in the service identifier list, it can be determined that the access service identifier exists in the service identifier list, that is, the user has the authority to access the service corresponding to the access service identifier with the access path, thereby determining that the user access request authentication is passed, allowing the user to access the service corresponding to the access service identifier with the access path in the access object parameters.
[0076] In an exemplary embodiment, if it is determined that the access request does not carry the access service identifier, it means that the user may want to perform configuration operations unrelated to the service, such as updating user information. In this case, it is only necessary to determine whether the access path in the user's access request is authenticated. That is, when there is a prefix of the access path in the path list, if the access request does not carry the access service identifier, it is determined that the access request is authenticated, and access to the corresponding service is allowed through the access path.
[0077] For example, continuing with the above example, assuming that the access object parameters and user identification carried in the access request are obtained, if the access object parameters include access path a and access service identification "Game B", and the user identification is "X1", then the user identification "X1" can be used to obtain the user permission list that matches user "X1" from the pre-generated user permission list of each user, and according to the prefix of the access path a, set the first regular expression to match any string that starts with the prefix of the access path a. When the first regular expression is used and a string that starts with the prefix of the access path a is matched in the path list corresponding to user "X1", it can be determined that the prefix of the access path a exists in the path list.
[0078] Furthermore, the access service identifier can be queried in the access request. Since the access service identifier "Game B" is carried in the access request, a second regular expression can be set to match the character string corresponding to "Game B". When the second regular expression is used, when the character string corresponding to "Game B" is matched in the service identifier list corresponding to the user "X1", it can be determined that the access service identifier "Game B" exists in the service identifier list, and thus it can be determined that the user "X1" has the authority to access the content of the access service identifier "Game B" through the access path a. It can then be determined that the access request authentication of the user "X1" has passed, and access to the service corresponding to the service identifier "Game B" through the access path a is allowed.
[0079] It should be noted that since different services may have the same path prefix, for example, games A, B, and C in the above example share the prefix of access path a and the prefix of access path b, in an embodiment of the present application, during authentication, authentication can be performed first based on the access path in the access object parameters, and when the prefix of the access path exists in the path list, authentication can be performed based on the access service identifier.
[0080] By using the first regular expression to compare the access path with the path list, it is possible to accurately determine whether the prefix of the access path exists in the path list. When the prefix of the access path exists in the path list and it is determined that the access request carries an access service identifier, by using the second regular expression to compare the access service identifier with the service identifier list, it is possible to accurately determine whether the access service identifier exists in the service identifier list, thereby improving the accuracy of authenticating the user's access request.
[0081] Through the above analysis, it can be known that in the embodiment of the present application, the access path can be compared with the path list first. When the prefix of the access path exists in the path list, the access service identifier is queried in the access object parameter carried by the access request. After that, when it is determined that the access request carries the access service identifier, the access service identifier is compared with the service identifier list to authenticate the access request. Figure 3 , with respect to the above process, the user authentication method provided by the embodiment of the present disclosure is further explained.
[0082] Figure 3 The figure is a flow chart showing another user authentication method according to an exemplary embodiment.
[0083] like Figure 3 As shown, the user authentication method may include the following steps 301-310.
[0084] In step 301, the access request of the service platform is monitored.
[0085] In step 302, the access request is routed and intercepted, and the access object parameter and user identifier carried in the access request are obtained from the access request.
[0086] In step 303, a user authority list matching the user identifier is obtained; wherein the user authority list includes a path list with access rights and a service identifier list with access rights.
[0087] In step 304 , the access path is compared with the path list using the first regular expression to determine whether the prefix of the access path exists in the path list. If so, step 306 is executed; otherwise, step 305 is executed.
[0088] Specifically, the specific implementation process and principle of the above steps 301-304 can refer to the description of the above embodiment, which will not be repeated here.
[0089] In step 305, it is determined that the access request authentication fails.
[0090] Specifically, if the prefix of the access path does not exist in the path list, it means that the user does not have the access authority for the access path in the access request. At this time, it can be determined that the access request authentication fails and the user is not allowed to access the service corresponding to the access path.
[0091] By directly determining that the access request authentication fails when the prefix of the access path does not exist in the path list, the subsequent comparison of the access service identifier with the service identifier list is avoided, the workload in the user authentication process is reduced, the user authentication time is saved, and the user authentication speed is improved.
[0092] In step 306 , it is determined whether the access object parameter carried in the access request carries an access service identifier. If so, step 308 is executed; otherwise, step 307 is executed.
[0093] In step 307, it is determined that the access request authentication is successful.
[0094] Specifically, if it is determined that the access request does not carry an access service identifier, it means that the user may want to perform configuration operations that are not related to the service, such as updating user information. At this time, it is only necessary to determine whether the access path in the user's access request has been authenticated. Then, if the access path in the user's access request has been authenticated, but the access request does not carry an access service identifier, it can be determined that the access request has been authenticated. That is, if the access path prefix exists in the path list and the access request does not carry an access service identifier, it is determined that the access request has been authenticated, and access to the corresponding service is allowed with the access path.
[0095] Through the above process, even if the access request does not carry the access service identifier, the user's access request can still be accurately authenticated.
[0096] In step 308 , the access service identifier is compared with the service identifier list using the second regular expression to determine whether the access service identifier exists in the service identifier list. If yes, step 309 is executed; otherwise, step 310 is executed.
[0097] In step 309, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier is allowed through the access path.
[0098] In step 310, it is determined that the access request authentication fails.
[0099] Specifically, when it is determined that there is a prefix of the access path in the path list, and the access request carries an access service identifier, the second regular expression is used to compare the access service identifier with the service identifier list to determine whether there is an access service identifier in the service identifier list. When there is a prefix of the access path in the path list, and there is an access service identifier in the service identifier list, it means that the user has the authority to access the service corresponding to the access service identifier with the access path, so that it can be determined that the access request authentication is passed, and access to the service corresponding to the access service identifier with the access path is allowed. When there is a prefix of the access path in the path list, but there is no access service identifier in the service identifier list, it means that although the user has the authority to access the path, he does not have the authority to access the service corresponding to the access service identifier with the access path, so that it can be determined that the access request authentication has not passed.
[0100] By using the first regular expression to compare the access path with the path list, it is possible to accurately determine whether the prefix of the access path exists in the path list. When the prefix of the access path exists in the path list and it is determined that the access request carries an access service identifier, by using the second regular expression to compare the access service identifier with the service identifier list, it is possible to accurately determine whether the access service identifier exists in the service identifier list. Furthermore, through the user authentication method provided by the present application, the accuracy of authenticating the user's access request is improved.
[0101] Through the above analysis, it can be known that the user permission list corresponding to each user can be pre-set, and then after the router intercepts the access request and obtains the access object parameter and user ID carried in the access request, the user permission list matching the user ID can be obtained to authenticate the access request according to the access object parameter carried in the access request, and the path list and business ID list included in the user permission list. Figure 4 , the process of obtaining a user authority list matching a user identifier in the user authentication method provided in an embodiment of the present disclosure is further explained.
[0102] Figure 4 The figure is a flow chart showing another user authentication method according to an exemplary embodiment.
[0103] like Figure 4 As shown, Figure 1 The step 102 shown may specifically include the following steps 401-402.
[0104] In step 401, a list request carrying a user identifier is sent to a set interface to obtain a user authority list matching the user identifier.
[0105] Specifically, the user authority lists corresponding to the preset users can be stored in a preset location, and the user authority list can be obtained from the preset location through a set interface, so that after monitoring the access request of the business platform and obtaining the carried user identifier from the access request intercepted by the route, the user authentication device can send a list request carrying the user identifier to the set interface to obtain the user authority list matching the user identifier from the preset location.
[0106] Among them, the preset position and the set interface can be set arbitrarily as needed, and this application does not impose any restrictions on this.
[0107] In an exemplary embodiment, each time an access request carrying a user identifier is intercepted, a list request carrying the user identifier can be sent to a set interface to obtain a user authority list that matches the user identifier, and then the access request is authenticated based on the access object parameters carried by the access request, and the path list and service identifier list included in the user authority list.
[0108] In step 402, a prototype attribute is added; wherein the prototype attribute points to a user permission list, and is used to obtain the user permission list by referencing the prototype attribute when an access request carrying a user identifier is intercepted again in the future.
[0109] It is understandable that when performing user authentication, if each access request carrying a user identifier is intercepted, a list request carrying the user identifier is sent to the set interface to obtain a user authority list that matches the user identifier. The process is cumbersome and may also affect the authentication speed of the access request.
[0110] Then, in an embodiment of the present application, after obtaining a user permission list that matches the user identifier, a prototype attribute can be added, and the prototype attribute can be set to point to the user permission list, so that when an access request carrying the user identifier is intercepted again in the future, the prototype attribute can be referenced to obtain the user permission list. Thus, when an access request carrying the user identifier is intercepted again in the future, the prototype attribute can be referenced to obtain the user permission list, without having to send a list request carrying the user identifier to the set interface to obtain the user permission list that matches the user identifier, thereby simplifying the process of obtaining the user permission list that matches the user identifier, saving time for obtaining the user permission list that matches the user identifier, and further improving the authentication speed of the access request.
[0111] Taking a business platform developed based on the Vue.js framework as an example, after obtaining the user permission list matching the user ID for the first time, the user permission list can be bound to the vue.prototype prototype property, so that when an access request carrying the user ID is intercepted again in the future, the prototype property can be referenced to obtain the user permission list.
[0112] After obtaining the user identifier carried in the access request, the user authentication device sends a list request carrying the user identifier to a set interface to obtain a user permission list matching the user identifier, and then adds a prototype attribute, wherein the prototype attribute points to the user permission list, and is used to reference the prototype attribute to obtain the user permission list when the access request carrying the user identifier is intercepted again in the future. This implements that when the access request carrying the user identifier is intercepted again in the future, the user permission list can be referenced to obtain the user permission list. Since there is no need to send a list request carrying the user identifier to the set interface every time an access request carrying the user identifier is intercepted, the process of obtaining the user permission list matching the user identifier is simplified, the time for obtaining the user permission list matching the user identifier is saved, and the authentication speed of the access request is further improved.
[0113] In order to implement the above embodiment, the embodiment of the present disclosure proposes a user authentication device.
[0114] Figure 5 is a block diagram of a user authentication device according to an exemplary embodiment.
[0115] Reference Figure 5 The user authentication device 100 may include: a first acquisition module 110, a second acquisition module 120, a comparison module 130 and a first authentication module 140.
[0116] The first acquisition module 110 is configured to acquire the access object parameter and the user identifier carried in the access request;
[0117] The second acquisition module 120 is configured to acquire a user permission list matching the user identifier; wherein the user permission list includes a path list with access rights and a service identifier list with access rights;
[0118] The comparison module 130 is configured to compare the access path in the access object parameter with the path list, and to compare the access service identifier in the access object parameter with the service identifier list;
[0119] The first authentication module 140 is configured to determine that the access request authentication is passed if there is a prefix of the access path in the path list and an access service identifier in the service identifier list, and allow access to the service corresponding to the access service identifier through the access path.
[0120] It should be noted that the user authentication device of the embodiment of the present disclosure can execute the user authentication method of the aforementioned embodiment. The user authentication device can be a server or can be configured in a server to authenticate the user's access request, improve the authentication speed, and reduce the workload of authority maintenance.
[0121] Among them, the server can be any stationary or mobile computing device capable of data processing, such as mobile computing devices such as laptops and wearable devices, or stationary computing devices such as desktop computers, or other types of computing devices, and the embodiments of the present disclosure are not limited to this.
[0122] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0123] The user authentication device of the disclosed embodiment obtains the access object parameter and the user identifier carried in the access request, and then obtains a user permission list matching the user identifier, wherein the user permission list includes a path list with access permissions and a service identifier list with access permissions, and then compares the access path in the access object parameter carried in the access request with the path list, and compares the access service identifier in the access object parameter with the service identifier list, so that when there is a prefix of the access path in the path list and there is an access service identifier in the service identifier list, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier with the access path is allowed, thereby realizing the authentication of the user's access request, improving the authentication speed, and reducing the workload of permission maintenance.
[0124] Figure 6 The invention is a block diagram of another user authentication device according to an exemplary embodiment.
[0125] Reference Figure 6 In the user authentication device 100, the comparison module 130 may specifically include:
[0126] The first comparison unit 1301 is configured to compare the access path with the path list using a first regular expression;
[0127] The query unit 1302 is configured to query the access service identifier in the access object parameter carried in the access request when the prefix of the access path exists in the path list;
[0128] The second comparing unit 1303 is configured to compare the access service identifier with the service identifier list by using a second regular expression when determining that the access request carries the access service identifier.
[0129] Reference Figure 6 , the user authentication device 100 may further include:
[0130] The second authentication module 150 is configured to determine that the access request authentication fails when the prefix of the access path does not exist in the path list;
[0131] The third authentication module 160 is configured to determine that the access request authentication is successful when the access request does not carry the access service identifier.
[0132] Reference Figure 6 , the user authentication device 100 may further include:
[0133] A monitoring module 170, configured to monitor access requests from the service platform;
[0134] The interception module 180 is configured to perform routing interception on the access request.
[0135] Reference Figure 6 In the user authentication device 100, the second acquisition module 120 may specifically include:
[0136] The acquisition unit 1201 is configured to send a list request carrying a user identifier to a set interface to acquire a user authority list matching the user identifier;
[0137] The adding unit 1202 is configured to add a prototype attribute, wherein the prototype attribute points to a user permission list, and is used to obtain the user permission list by referencing the prototype attribute when an access request carrying a user identifier is intercepted again later.
[0138] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0139] The user authentication device of the disclosed embodiment obtains the access object parameter and the user identifier carried in the access request, and then obtains a user permission list matching the user identifier, wherein the user permission list includes a path list with access permissions and a service identifier list with access permissions, and then compares the access path in the access object parameter carried in the access request with the path list, and compares the access service identifier in the access object parameter with the service identifier list, so that when there is a prefix of the access path in the path list and there is an access service identifier in the service identifier list, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier with the access path is allowed, thereby realizing the authentication of the user's access request, improving the authentication speed, and reducing the workload of permission maintenance.
[0140] In order to implement the above embodiment, the embodiment of the present disclosure also proposes a server.
[0141] The server 200 includes:
[0142] Processor 220;
[0143] A memory 210 for storing instructions executable by a processor 220;
[0144] The processor 220 is configured to execute instructions to implement the user authentication method as described above.
[0145] As an example, Figure 7 is a block diagram of a server 200 for user authentication according to an exemplary embodiment. Figure 7 As shown, the server 200 may further include:
[0146] The memory 210 and the processor 220, a bus 230 connecting different components (including the memory 210 and the processor 220), the memory 210 stores a computer program, and when the processor 220 executes the program, the user authentication method described in the embodiment of the present disclosure is implemented.
[0147] Bus 230 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.
[0148] The server 200 typically includes a variety of server-readable media. These media can be any available media that can be accessed by the server 200, including volatile and non-volatile media, removable and non-removable media.
[0149] The memory 210 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 240 and / or cache memory 250. The server 200 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 260 may be used to read and write non-removable, non-volatile magnetic media ( Figure 7 not shown, usually called a "hard drive"). Although Figure 7 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 230 via one or more data medium interfaces. The memory 210 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.
[0150] A program / utility 280 having a set (at least one) of program modules 270 may be stored, for example, in the memory 210, such program modules 270 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 270 generally perform the functions and / or methods of the embodiments described in the present disclosure.
[0151] The server 200 may also communicate with one or more external devices 290 (e.g., keyboards, pointing devices, displays 291, etc.), one or more devices that enable a user to interact with the server 200, and / or any device that enables the server 200 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 292. Furthermore, the server 200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 293. Figure 7 As shown, the network adapter 293 communicates with other modules of the server 200 via the bus 230. It should be understood that although Figure 7 Not shown, other hardware and / or software modules may be used in conjunction with server 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0152] The processor 220 executes various functional applications and data processing by running the programs stored in the memory 210 .
[0153] It should be noted that the implementation process and technical principles of the server of this embodiment refer to the aforementioned explanation of the user authentication method of the embodiment of the present disclosure, and will not be repeated here.
[0154] The server provided by the embodiment of the present disclosure obtains the access object parameter and the user identifier carried in the access request, and then obtains a user permission list matching the user identifier, wherein the user permission list includes a path list with access permissions and a service identifier list with access permissions, and then compares the access path in the access object parameter carried in the access request with the path list, and compares the access service identifier in the access object parameter with the service identifier list, so that when there is a prefix of the access path in the path list and an access service identifier in the service identifier list, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier with the access path is allowed, thereby realizing authentication of the user's access request, improving the authentication speed, and reducing the workload of permission maintenance.
[0155] In order to implement the above embodiment, the embodiment of the present disclosure also proposes a storage medium.
[0156] When the instructions in the storage medium are executed by the processor of the server, the server is enabled to execute the user authentication method as described above.
[0157] In order to implement the above embodiments, the present disclosure also provides a computer program product. When the computer program is executed by a processor of a server, the server can execute the user authentication method as described above.
[0158] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0159] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A user authentication method, characterized in that: The following steps are involved: Obtaining access object parameters and user identifiers from the intercepted access request, wherein the access object parameters include an access path and an access service identifier, the access service identifier is used to uniquely identify the service to be accessed, and the user identifier is used to uniquely identify the user; Sending a list request carrying the user identifier to a set interface to obtain a user permission list matching the user identifier, adding a prototype attribute after obtaining the user permission list, and setting the prototype attribute to point to the user permission list, and when an access request carrying the user identifier is intercepted again, referencing the prototype attribute to obtain the user permission list; wherein the user permission list includes a path list with access rights and a service identifier list with access rights; Comparing the access path with the path list, and comparing the access service identifier with the service identifier list; When the prefix of the access path exists in the path list and the access service identifier exists in the service identifier list, it is determined that the access request authentication is passed, and access to the service corresponding to the access service identifier is allowed through the access path.
2. The user authentication method according to claim 1, characterized in that: Comparing the access path with the path list, and comparing the access service identifier with the service identifier list, includes: Using a first regular expression to compare the access path with the path list; When the prefix of the access path exists in the path list, querying the access service identifier in the access object parameter carried in the access request; When it is determined that the access request carries the access service identifier, the access service identifier is compared with the service identifier list using a second regular expression.
3. The user authentication method according to claim 2, characterized in that: After comparing the access path with the path list using the first regular expression, the method further includes: When the prefix of the access path does not exist in the path list, it is determined that the access request authentication fails.
4. The user authentication method according to claim 2, characterized in that: After querying the access service identifier in the access object parameter carried in the access request, the method further includes: When the access request does not carry the access service identifier, it is determined that the access request is authenticated.
5. The user authentication method according to any one of claims 1 to 4, characterized in that: Before obtaining the access object parameter and the user identifier carried in the access request, the method further includes: Monitor access requests from the business platform; The access request is routed and intercepted.
6. A user authentication device, characterized in that: include: A first acquisition module is configured to acquire access object parameters and a user identifier from the intercepted access request, wherein the access object parameters include an access path and an access service identifier, the access service identifier is used to uniquely identify the service to be accessed, and the user identifier is used to uniquely identify the user; The second acquisition module is configured to send a list request carrying the user identifier to a set interface to obtain a user permission list matching the user identifier, add a prototype attribute after obtaining the user permission list, and set the prototype attribute to point to the user permission list, and when an access request carrying the user identifier is intercepted again, reference the prototype attribute to obtain the user permission list; wherein the user permission list includes a path list with access rights and a service identifier list with access rights; A comparison module, configured to compare the access path with the path list, and to compare the access service identifier with the service identifier list; The first authentication module is configured to determine that the access request authentication is successful and allow access to the service corresponding to the access service identifier through the access path when the prefix of the access path exists in the path list and the access service identifier exists in the service identifier list.
7. The user authentication device according to claim 6, characterized in that: The comparison module comprises: A first comparison unit is configured to compare the access path with the path list using a first regular expression; a query unit configured to query the access service identifier in the access object parameter carried in the access request when the prefix of the access path exists in the path list; The second comparing unit is configured to, when determining that the access request carries the access service identifier, use a second regular expression to compare the access service identifier with the service identifier list.
8. The user authentication device according to claim 7, characterized in that: Also includes: The second authentication module is configured to determine that the access request authentication fails when the prefix of the access path does not exist in the path list.
9. The user authentication device according to claim 7, characterized in that: Also includes: The third authentication module is configured to determine that the access request is authenticated if the access service identifier is not carried in the access request.
10. The user authentication device according to any one of claims 6 to 9, characterized in that: Also includes: A monitoring module, configured to monitor access requests from the service platform; The interception module is configured to perform routing interception on the access request.
11. A server, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the user authentication method as described in any one of claims 1 to 5.
12. A storage medium, when instructions in the storage medium are executed by a processor of a server, enables the server to execute the user authentication method according to any one of claims 1 to 5.
