Login method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for logging in using a computer.
Background
With the development of economy and technology, the popularity of the internet, especially the mobile internet, in modern life, more and more users perform various activities, such as entertainment, communication, shopping, etc., through the internet. Generally, users use various software to perform these activities, such as communication through communication software. These software often require the user to log in before they can use it, or to obtain more functionality after logging in. Accordingly, users often use these software after logging in or automatically logging in.
Generally, when a user logs in, a server needs to perform multiple queries on a user platform according to a user login account (the login account is also called a login identity); and the binding relationship between the login account and the user equipment needs to be inquired and judged for many times on the wireless authentication platform. When frequent, large and centralized user login occurs, the burden of the user platform and the wireless authentication platform is increased, and the server may be slow in response and even paralyzed. For example, every year at spring festival, a large number of users will concentrate on logging in communication software in the morning, send spring festival blessings to each other, and cause extremely high login concurrent requests; the registration of the capacity to be prepared is concurrent with 150 w/s. Such a large amount of centralized user login may cause a burden on the server, and may even cause a slow response or even paralysis of the server, thereby affecting the user experience.
Therefore, it is necessary to find a login method with less burden on the server.
Disclosure of Invention
In view of the above, the present invention provides a method and an apparatus for performing login using a computer, which can perform login processing by using session control data, so that stress on a wireless authentication platform and a user platform can be reduced. Also, fewer lookups and acknowledgements need to be performed using session control data. Therefore, the method can reduce the pressure of the user on the server during login.
The embodiment of the application provides a login method, which comprises the following steps:
receiving a login request;
acquiring a session control identity according to the login request;
acquiring session control information according to the session control identity;
and performing login processing according to the session control information.
Preferably, the obtaining the session control identity includes:
and acquiring a session control identity from the login request.
Preferably, the obtaining the session control identity includes:
acquiring a login identity and an equipment identity from the login request;
acquiring a multiplexing key according to the login identity and the equipment identity;
and acquiring a session control identity according to the multiplexing key.
Preferably, the obtaining of the session control identity according to the multiplexing key includes:
the value keyed by the reuse key is obtained from the database.
Preferably, the obtaining the session control information according to the session control identity includes:
a value keyed by the session control identity is obtained from the database.
Preferably, the performing the login processing according to the session control information includes:
and when the login information in the session control information is not empty and the login identity contained in the user information in the session control information is the same as the login identity carried in the login request, allowing the login of the login identity.
Preferably, before the obtaining the session control identity, the method further includes:
constructing session control data, wherein the session control data comprises a session control identity and session control information corresponding to the session control identity, and the session control information comprises at least one of user information and login information.
Preferably, the session control data is constructed from historical login requests or historical login request data.
The embodiment of the present application further provides a login method, including:
generating a login request;
searching a session control identity stored locally;
and carrying the session control identity in the login request and sending the login request to a server, so that the server acquires the session control identity according to the login request, acquires session control information according to the session control identity and performs login processing according to the session control information.
An embodiment of the present application further provides a login device, including:
a login request receiving means for receiving a login request;
the session control identity acquisition device acquires a session control identity according to the login request;
the session control information acquisition device acquires session control information according to the session control identity;
and a login processing device for performing login processing according to the session control information.
Preferably, the session control identifier obtaining device obtains the session control identifier from the login request.
Preferably, the method further comprises the following steps:
the session control data construction device constructs session control data before the session control identity is acquired, wherein the session control data comprises the session control identity and session control information corresponding to the session control identity, and the session control information comprises at least one of user information and login information.
An embodiment of the present application further provides a login device, including:
a login request generation device for generating a login request;
a session control identification searching device for searching the session control identification stored locally;
and the session control identity transmitting device carries the session control identity in the login request and transmits the login request to a server, so that the server acquires the session control identity according to the login request, acquires session control information according to the session control identity and performs login processing according to the session control information.
By using the session control data for the login process, the pressure on the wireless authentication platform and the user platform can be reduced. Also, fewer lookups and acknowledgements need to be performed using session control data. Thereby reducing the stress on the server from user login.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a diagram illustrating a login method in the prior art;
FIG. 2 is a flowchart illustrating a login method according to a first embodiment;
FIG. 3 is a schematic view of a first embodiment;
FIG. 4 is a schematic flow chart of a first process of generating and saving a multiplexing key;
fig. 5 is a flowchart illustrating a login method according to a second embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
In the prior art, the secret-free login can be performed according to the following procedures.
When a client successfully logs in by using an account (loginId) password, a server binds a device identifier (device Id) and a user identifier (userId) of a device where the client is located, and constructs a data entry database, wherein the account refers to a user login account such as a mailbox or a mobile phone number, and the userId refers to a unique identifier of the user in the database;
when the client logs in again, sending the equipment Id and loginId of the equipment where the client is located to the server;
and the server searches the corresponding userId according to the loginId, and if the server determines that the searched userId and the equipment Id sent by the client have a binding relationship, the login is successful.
The login method is shown in fig. 1, in which the login system, the user platform, and the wireless authentication platform are all part of a server.
The login system receives the login request, sends the loginId in the login request to the user platform, and sends the equipment Id in the login request to the wireless authentication platform;
the user platform inquires the userId according to the loginId and sends the userId to the wireless authentication platform;
the wireless authentication platform judges whether a binding relationship exists between the userId and the equipment Id, and returns the judgment result to the login system;
and the login system determines whether the application login is successful according to the binding relationship judgment result returned by the wireless authentication platform.
The above is a conventional secret-free login method. In the prior art, a user platform queries a userId according to a loginnid, and often needs to query for multiple times, and a wireless authentication platform judges whether a binding relationship exists between the userId and a device Id, and also often needs to query and judge for multiple times, so that a large amount of server resources are occupied, and the efficiency is low.
The following describes a login method in the present application.
Session control (Session) data used in the present application will be first introduced.
Session data is data of a key-value structure, wherein a key may be a String (String), and a key is a unique identifier of Session data, i.e., a Session control identity (Session id); the value (value) may be an Object (Object) and is the main information carrier of Session data, i.e. Session control information (CacheSession). The CacheSession may include device information (DeviceInfo), user information (userInfo), client information (ClientInfo), and login information (loginninfo).
The Session data may be generated after the account password is successfully logged in, wherein the Session id may be generated by a random number, time information, and other related information. After the Session data is generated, the server can send the Session id to the client for storage; the loginninfo in the CacheSession can be uploaded by the client and can contain information such as login time; the ClientInfo can contain a client identifier and client version information uploaded by a client and can also contain a digital signature of the client; DeviceInfo may contain the device identification uploaded by the client and may also contain device type information; the userInfo may include an account loginId uploaded by the client, and may also include a userld corresponding to the loginId.
The structure of Session data may be as shown in table 1.
TABLE 1
The Session data may be saved to a key-value database, and preferably, to a Tair database.
The login flow of this embodiment is shown in fig. 2.
S101: the server receives a password-free login request.
When a user logs in a secret-free login mode, a secret-free login request can be sent to a server through a client.
S102: the SessionId is obtained from the login request.
After receiving the login request, the server can directly acquire the SessionId uploaded by the client from the login request.
Of course, if the server is provided with a time division multiplexing switch for controlling whether or not Session is used, the server can acquire the Session id from the login request when the time division multiplexing switch is on.
S103: and obtaining the CacheSession from Tair according to the Session Id.
After the server obtains the SessionId, if the obtained SessionId is not null, the server can obtain CacheSession from Tair according to the obtained SessionId.
S104: and performing login processing according to the CacheSession.
After the server acquires the CacheSession, if the acquired CacheSession is judged not to be empty and the userInfo and loginnfo contained in the CacheSession are not judged to be empty, login processing can be performed according to the CacheSession.
Specifically, the login processing according to the CacheSession may be to assemble a user login result (userlogiinres) according to the CacheSession, including performing login processing according to a logiinid in the userInfo, and when the logiinid is the same as the login identity carried in the login request, allowing the login identity to log in, and returning the login result.
In the process, the Session data does not need to be updated again, so that the calculation amount can be reduced, and the server resources are saved.
And if the time-sharing multiplexing switch is closed, or the Session Id is empty, or the CacheSession is empty, or any one of the userInfo and loginInfo contained in the CacheSession is empty, adopting the original login flow to login. The original login procedure may be the existing password-free login method mentioned in the beginning of this embodiment.
The system composition of the present embodiment may be as shown in fig. 3, wherein:
the mobile terminal can be a mobile device such as a smart phone and a tablet computer used by a user;
the mobile gateway is used for authenticating and forwarding the request of the user and is a connection point of the mobile terminal and the server;
the login system is used for receiving a user login request, bearing a login service and creating Session data;
the user platform stores basic information data of a user, and provides functions of inquiring userId, verifying a password, creating a new user and the like;
user db is a database used by the user platform;
the mobile authority verification system is one of wireless authentication platforms, wherein a user login-free relationship is stored, and login-free relationship creation and verification are provided.
The mobile rights db is a database used by the mobile rights checking system.
Tair is a distributed key-value cache database.
It should be noted that, in this embodiment, by using the method of logging in through Session data as shown in fig. 2, the user platform, the user db, the mobile permission verification system, and the mobile permission db may not be used, and when logging in through Session data is not possible (for example, when Session data is not generated yet), the user platform, the user db, the mobile permission verification system, and the mobile permission db may be used, and logging in may be performed through an original login process. By using the method provided in the embodiment, CacheSession can be searched from the database according to the SessionId without searching in a user platform and a wireless authentication platform, and without judging whether a binding relationship exists between the userId and the device Id. The user platform and the wireless authentication platform which are low in use efficiency are not required to be searched and judged, and the pressure of the user on the user platform and the wireless authentication platform during login is reduced, so that the pressure born by the server is effectively reduced, and the effect of bearing larger parallel login requests is realized.
In addition, the server may generate the Session data according to data required for generating the Session data, which is carried in the historical login request of the user, before the user logs in. In this way, a virtual login request is actually generated according to the historical login request, and Session data can be generated according to the virtual login request without actually sending out the login request by the user side. Session data are generated before the user actually logs in, and the survival time of the Session data is prolonged, so that the login mode in the embodiment can be adopted when the user actually logs in, and the original login mode is not required.
Example 2
Embodiment 1 provides a method for acquiring a SessionId uploaded by a client from a login request, acquiring a CacheSession according to the SessionId, and finally performing a login operation according to information in the CacheSession. However, the SessionId is not necessarily included in all login requests, for example, the SessionId is not saved by the client (e.g., the SessionId is lost). To solve this problem, another login method is proposed in this embodiment.
For explaining the present embodiment, the multiplexed data used in the present embodiment will be described first.
The multiplexing data may be generated after the account password is successfully logged in, or may be generated when Session data is generated. The multiplexing data comprises the Session Id in the Session data generated when the login is successful and the data generated according to the device id, so that under the condition that the device id is known, corresponding data can be generated according to the device id, and the corresponding Session Id can be searched according to the data.
For example, in the login scenario of payment software, the generated multiplexing data may be a key-value structure, which may be stored in a Tair database. The key part may be a character string, which may be obtained by performing an information-summarization Algorithm 5(Message-Digest Algorithm 5, abbreviated as MD5) according to the logiinid, the wallet device identifier (walletTid), the key corresponding to the wallet device identifier (walletClientKey), the shortcut device identifier (mspTid), and the key corresponding to the shortcut device identifier (mspClientKey) in the login request. The Value part may be a Session id, which may be the Session id of Session data generated after the account password login is successful.
The key portion of the multiplexed data is called a multiplexed key, the walletTid and mspTid used to generate the multiplexed key are often the same, collectively referred to as device identification (Tid), and the walletClientKey and mspClientKey are also often the same, collectively referred to as device identification key.
Fig. 4 shows a flow of generating and storing multiplexed data. As shown in fig. 4, after login is successful, acquiring a multiplexing key according to logiinid, Tid and the device identification key; caching the multiplexing key, the corresponding Session Id and the corresponding relation between the multiplexing key and the Session Id into Tair; and ending the flow.
The structure of the multiplexed data may be as shown in table 2.
TABLE 2
Key
|
Value
|
MD5(loginId,walletTid,walletClientKey,mspTid,mspClientKey)
|
SessionId |
The corresponding SessionId may be obtained from the multiplexing key, depending on the structure of the multiplexing data.
The flow of this embodiment is described below, as shown in fig. 5.
S201: the server receives a password-free login request.
When a user logs in a secret-free login mode, a secret-free login request can be sent to a server through a client.
S202: and acquiring loginId, tid and the equipment identification key from the login request, and performing MD5 operation according to the loginId, tid and the equipment identification key to acquire the multiplexing key.
Of course, if the server is provided with a time-division multiplexing switch for controlling whether to use Session, the server may acquire logiinid, tid, and the device identification key from the login request when the time-division multiplexing switch is on.
S203: acquiring a corresponding sessionId from Tair according to the multiplexing key (S202); after acquiring the SessionId, the flow of this embodiment is the same as or similar to the flow after acquiring the SessionId in embodiment 1;
s204: and obtaining the CacheSession from Tair according to the Session Id.
After the server obtains the SessionId, if the obtained SessionId is not null, the server can obtain CacheSession from Tair according to the obtained SessionId.
S205: and performing login processing according to the CacheSession.
After the server acquires the CacheSession, if the acquired CacheSession is judged not to be empty and the userInfo and loginnfo contained in the CacheSession are not judged to be empty, login processing can be performed according to the CacheSession.
Specifically, the login processing according to the CacheSession may be to assemble a user login result (userlogiinres) according to the CacheSession, including performing login processing according to a logiinid in the userInfo, and when the logiinid is the same as the login identity carried in the login request, allowing the login identity to log in, and returning the login result.
And if the time-sharing multiplexing switch is closed, or the Session Id is empty, or the CacheSession is empty, or any one of the userInfo and loginInfo contained in the CacheSession is empty, adopting the original login flow to login. The original login procedure may be the existing password-free login method mentioned in the beginning of embodiment 1.
This embodiment proposes a login method when there is no SessionId in the login request, which tries to find the SessionId according to other data in the login request, and after finding the SessionId, converts the situation into the situation in embodiment 1.
Example 3
The embodiment of the invention also provides a login method, which comprises the following steps:
generating a login request;
searching a session control identity stored locally;
and carrying the session control identity in the login request and sending the login request to a server, so that the server acquires the session control identity according to the login request, acquires session control information according to the session control identity and performs login processing according to the session control information.
The server may perform the login process according to the method set forth in embodiment 1.
Example 4
The embodiment of the present invention further provides a login device, including:
a login request receiving means for receiving a login request;
the session control identity acquisition device acquires a session control identity according to the login request;
the session control information acquisition device acquires session control information according to the session control identity;
and a login processing device for performing login processing according to the session control information.
In the embodiment, the login request receiving device is used for receiving the login request, the Session control identity acquiring device is used for acquiring the Session control identity according to the login request, the Session control information acquiring device is used for acquiring the Session control information according to the Session control identity, and the login processing device is used for performing login processing according to the Session control information, so that the login processing can be performed by using Session data, the pressure on a user platform and a wireless authentication platform is reduced, and more parallel login requests can be borne.
In one embodiment, the session control identifier obtaining means obtains the session control identifier from the login request.
By using the session control identity, the SessionId can be directly obtained, and then CacheSession is obtained, and login processing is performed according to the SessionId.
In one embodiment, the login device further includes:
the session control data construction device constructs session control data before the session control identity is acquired, wherein the session control data comprises the session control identity and session control information corresponding to the session control identity, and the session control information comprises at least one of user information and login information.
By using the Session control data construction means, the required Session data, Session id and CacheSession can be constructed and can also be used for the login procedure.
Example 5
The embodiment of the present invention further provides a login device, including:
a login request generation device for generating a login request;
a session control identification searching device for searching the session control identification stored locally;
and the session control identity transmitting device carries the session control identity in the login request and transmits the login request to a server, so that the server acquires the session control identity according to the login request, acquires session control information according to the session control identity and performs login processing according to the session control information.
The session control id obtaining apparatus in embodiment 4 may be used to obtain the session control id sent by the session control id sending apparatus; and performs login processing based on the session control information using the login processing means.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input operation/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.