A login method, apparatus, device, storage medium and program product
Patent Information
- Application Number
- CN202511396965.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2045-09-28
AI Technical Summary
[0004]本发明实施例提供一种登录方法、装置、设备、存储介质及程序产品,以解决相关技术中存在用户登录灵活性较差的问题
[0027]在本发明实施例中,获取登录设备的相关数据,所述相关数据用于表征所述登录设备所处环境情况;基于所述相关数据生成第一评分,所述第一评分用于表征所述登录设备所在环境的安全情况;确定所述第一评分对应的第一风险等级;基于所述第一风险等级确定第一登录方式;基于所述第一登录方式进行登录。这样,通过登录设备的相关数据确定登录设备的第一风险等级,进而可以根据第一风险等级确定具体的第一登录方式,从而实现为不同风险等级配置不同的登录方式,以适配设备的不同使用场景,在满足安全登录的要求下尽可能的降低登录的复杂性,有效提高了登录的灵活性。
Smart Images

Figure CN121193493B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically to a login method, apparatus, device, storage medium, and program product. Background Technology
[0002] To enhance device or system security, users are required to log in before services are provided. In these technologies, login is typically via password or biometrics. However, the login method is often fixed, regardless of whether the user is in a familiar private or public network environment, or using a personal or shared device. This cumbersome process results in limited user flexibility.
[0003] It is evident that the relevant technologies suffer from poor user login flexibility. Summary of the Invention
[0004] This invention provides a login method, apparatus, device, storage medium, and program product to solve the problem of poor user login flexibility in related technologies.
[0005] To solve the above problems, the present invention is implemented as follows:
[0006] In a first aspect, embodiments of the present invention provide a login method, including:
[0007] Obtain relevant data about the login device, which is used to characterize the environment in which the login device is located;
[0008] A first score is generated based on the relevant data, and the first score is used to characterize the security status of the environment where the login device is located.
[0009] Determine the first risk level corresponding to the first score;
[0010] The first login method is determined based on the first risk level;
[0011] Log in using the first login method.
[0012] Secondly, embodiments of the present invention also provide a login device, comprising:
[0013] The acquisition module is used to acquire relevant data of the login device, and the relevant data is used to characterize the environmental conditions of the login device;
[0014] A generation module is used to generate a first score based on the relevant data, the first score being used to characterize the security status of the environment where the login device is located;
[0015] The first determining module is used to determine the first risk level corresponding to the first score;
[0016] The second determining module is used to determine the first login method based on the first risk level;
[0017] The login module is used to log in based on the first login method.
[0018] Thirdly, embodiments of the present invention also provide an electronic device, including a transceiver and a processor.
[0019] The transceiver is used to acquire relevant data of the login device, and the relevant data is used to characterize the environmental conditions of the login device.
[0020] The processor is used to generate a first score based on the relevant data, and the first score is used to characterize the security status of the environment where the login device is located;
[0021] The processor is also configured to determine the first risk level corresponding to the first score;
[0022] The processor is further configured to determine a first login method based on the first risk level;
[0023] The processor is also used to log in based on the first login method.
[0024] Fourthly, embodiments of the present invention provide an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, it implements the steps of the login method described in the first aspect.
[0025] Fifthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the login method described in the first aspect.
[0026] In a sixth aspect, the present invention also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the login method described in the first aspect.
[0027] In this embodiment of the invention, relevant data of the login device is acquired, which characterizes the environment in which the login device is located; a first score is generated based on the relevant data, which characterizes the security status of the environment in which the login device is located; a first risk level corresponding to the first score is determined; a first login method is determined based on the first risk level; and login is performed based on the first login method. In this way, by determining the first risk level of the login device through its relevant data, a specific first login method can be determined based on the first risk level. This allows for configuring different login methods for different risk levels to adapt to different usage scenarios of the device, minimizing the complexity of login while meeting the requirements for secure login, and effectively improving the flexibility of login. Attached Figure Description
[0028] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0029] Figure 1 This is a flowchart of a login method provided in an embodiment of the present invention;
[0030] Figure 2 This is a structural diagram of a login device provided in an embodiment of the present invention;
[0031] Figure 3 This is a structural diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0033] Please see Figure 1 , Figure 1 This is a flowchart of a login method provided in an embodiment of the present invention, such as... Figure 1 As shown, it includes the following steps:
[0034] Step 101: Obtain relevant data of the login device, which is used to characterize the environment in which the login device is located.
[0035] The login devices mentioned above are the devices that users need to log in to. These devices can be hardware devices such as user terminals, personal computers, and public computers, or software devices such as mobile applications and web operating systems. It is understandable that different devices have different levels of security. For example, for user terminals, if a user logs in in a familiar environment, the security is relatively high, and a simple method such as a password can be used. For public computers, the environment is relatively less secure, requiring a more secure method such as facial recognition for login.
[0036] When collecting relevant data, it is necessary to develop collection components suitable for different platforms (mobile, web, etc.). For example, for mobile devices, native software development kits (SDKs) or application programming interfaces (APIs) provided by the system framework can be used to obtain detailed information such as device model, operating system version, and memory capacity. For web devices, JavaScript's navigator object and related browser extension APIs can be used to collect information such as browser type, version, and whether it supports specific HyperText Markup Language (HTML) 5 features. Furthermore, a data transmission channel can be built to transmit the collected data to the backend server in real time and securely, while ensuring data integrity. For example, encrypted transmission protocols such as Hypertext Transfer Protocol Secure (HTTPS) can be used to prevent data leakage.
[0037] The aforementioned data pertains to the login device and is used to characterize the environment in which the device operates, such as its network conditions and location. This data helps determine the risk level of the login device, which in turn determines the appropriate login method.
[0038] In one embodiment, the relevant data includes at least one of the following: network data of the login device, geographic information data, and user login information data.
[0039] Specifically, when collecting network data, a custom network speed measurement algorithm can be pre-designed to dynamically adjust the size of the request data packets based on the network type and current network conditions. For example, for high-speed and stable Wireless Fidelity (Wi-Fi) networks, the data packet size can be appropriately increased to more accurately measure the bandwidth limit; for cellular networks or situations with unstable signals, the data packet size can be reduced to decrease the risk of packet loss and measurement errors.
[0040] Furthermore, based on historical test data and user geographic location information, priority can be given to servers that are close, have fast response times, and high stability for testing. This can more accurately reflect the actual network quality experienced by the user. For example, for mobile devices, by combining system network monitoring services with custom speed testing algorithms, network requests can be periodically (e.g., every 2 minutes) sent to multiple test servers distributed across different regions and network service providers to measure key indicators such as network type (Wi-Fi, cellular networks such as 4G and 5G and their sub-bands), real-time bandwidth (estimated based on request packet size and round-trip time), network latency (recording the time difference between request sending and response reception), and packet loss rate (statistically calculating the proportion of a certain number of request packets that did not receive a response). For web-based devices, JavaScript's XMLHttpRequest or fetch API can be used in conjunction with backend auxiliary scripts to achieve similar network status monitoring functions, also periodically feeding back network data to designated servers for unified processing by the backend servers.
[0041] When collecting geographic information data, for mobile devices, high-precision Global Positioning System (GPS) positioning is prioritized, and the GPS signal status is continuously monitored to obtain geographic information data of the logged-in device. If the signal strength is lower than a preset threshold, the GPS signal is considered poor. When poor GPS signal is detected, the base station positioning function is activated. At this time, the mobile device obtains the device's base station information (such as base station identifier (ID), location area code, etc.) and then sends this information to the base station positioning interface provided by the mobile operator to obtain approximate geographic information data of the device. If base station positioning is unavailable, the device's Wi-Fi module can be used to scan for surrounding Wi-Fi hotspots to obtain the basic service set identifier (BSSID) and signal strength information of the hotspots. At this time, this Wi-Fi information is sent to a server containing a Wi-Fi hotspot geographic information database to obtain the geographic information data of the logged-in device. In addition, for web-based devices, with user authorization, the HTML5 Geolocation API is used to obtain the geographic location. This is combined with Internet Protocol (IP) address resolution technology (which can interface with professional geographic IP databases) to further refine the location information to the city level or even specific regions, ensuring that the geographic information data can effectively assist in environmental assessment. After location is completed, latitude and longitude coordinates and location accuracy data are uploaded in real time as geographic information data for unified processing by the backend server.
[0042] When collecting user login information data, the system of the logged-in device records the user's login behavior, including login time, login frequency, and device switching. Furthermore, data from different systems can be merged based on the user ID as the association key to ensure that the time, device, network, and location information corresponding to each login behavior is complete and consistent.
[0043] In some implementations, a multi-dimensional raw dataset is constructed, where each row represents a user login event and its associated environmental information, allowing the backend server to process it uniformly. It's important to note that before collecting user login information, the system must obtain the user's explicit consent. This means the user needs to be informed what data will be collected and how it will be used. Users have the right to refuse the collection of certain data, and the system must clearly inform the user of any potential functional limitations that may result from such refusal, such as the inability to provide personalized services or reduced security.
[0044] Step 102: Generate a first score based on the relevant data. The first score is used to characterize the security status of the environment where the login device is located.
[0045] Step 103: Determine the first risk level corresponding to the first score.
[0046] The aforementioned first score characterizes the security status of the environment in which the login device resides, and the first risk level is the risk level corresponding to the first score. It should be noted that the first score and first risk level characterize the security status of the environment; they correspond to each other, with a higher first score indicating a higher first risk level and vice versa. By generating the first score based on relevant data, the risk level of the login device can be determined, and consequently, the corresponding login method can be determined.
[0047] Step 104: Determine the first login method based on the first risk level.
[0048] The first login method mentioned above corresponds to the first risk level. It should be noted that the login methods differ for different risk levels. For low-risk levels, a simple login method, such as direct password login, can be used; while for high-risk levels, a more complex login method, such as a combination of password and facial recognition, can be used. By configuring different login methods for different risk levels to adapt to different device usage scenarios, the complexity of login is minimized while meeting the requirements for secure login, effectively improving login flexibility.
[0049] Step 105: Log in using the first login method.
[0050] In this embodiment of the invention, relevant data of the login device is acquired, which characterizes the environment in which the login device is located; a first score is generated based on the relevant data, which characterizes the security status of the environment in which the login device is located; a first risk level corresponding to the first score is determined; a first login method is determined based on the first risk level; and login is performed based on the first login method. In this way, by determining the first risk level of the login device through its relevant data, a specific first login method can be determined based on the first risk level. This allows for configuring different login methods for different risk levels to adapt to different usage scenarios of the device, minimizing the complexity of login while meeting the requirements for secure login, and effectively improving the flexibility of login.
[0051] In one embodiment, generating a first score based on the relevant data includes:
[0052] The first score is generated based on preset rules to correspond to the relevant data; or, the first score is obtained by predicting the relevant data based on a preset scoring model.
[0053] In this embodiment of the invention, a first score corresponding to the relevant data can be generated based on preset rules, or a first score can be obtained by predicting the relevant data based on a preset scoring model, thereby improving the flexibility of calculating the first score.
[0054] The step of generating the first score corresponding to the relevant data based on preset rules includes:
[0055] A first corrected score is determined based on a first mapping relationship, wherein the first mapping relationship includes multiple data and corrected scores corresponding to different data, and the relevant data is at least one of the multiple data.
[0056] The initial score is corrected based on the first corrected score to obtain the first score.
[0057] The first mapping relationship mentioned above is a pre-configured mapping relationship. Different scores can be pre-configured for different data. After obtaining the relevant data of the logged-in device, the score corresponding to each parameter can be determined according to the parameter values included in the relevant score, thereby obtaining the first score.
[0058] Furthermore, in this invention, an initial score is preset, a first corrected score corresponding to the relevant data is determined according to a first mapping relationship, and the initial score is corrected according to the first corrected score to obtain a first score.
[0059] For example, if the initial score is 100 points and the first corrected score obtained through the first mapping relationship is -30 points, then the initial score is corrected based on the first corrected score to obtain a first score of 70 points.
[0060] In some implementations, the first mapping relationship includes device-related correction scores used to assess the level of device performance. For example, correction scores are set based on factors such as the device's system version to determine its software update level, whether it supports the latest security protocols, and specific system functions, providing hardware and software-level score corrections for environment classification. Specifically, the latest system version supporting the latest security protocols receives +10 points, a newer system version supporting some security protocols receives +5 points, and an older system version or one that does not support security protocols receives -10 points; the browser identifies the type of device the user is using when requesting a webpage, such as a mobile phone, tablet, or personal computer (PC), with mobile phones receiving +0 points, tablets receiving +5 points, and PCs receiving +10 points.
[0061] Furthermore, different device types may face different security risks, so it is also necessary to extract the device's operating system version information. For example, older operating system versions may have known security vulnerabilities. Specifically, the latest operating system version scores +5 points, a newer operating system version scores +2 points, and an older operating system version scores -5 points. By analyzing the device's usage behavior, such as frequent restarts and abnormal traffic, it is possible to identify whether the device is at risk of being controlled by malware. No frequent restarts and normal traffic scores +5 points, while frequent restarts or abnormal traffic scores -10 points.
[0062] In some implementations, the first mapping relationship also includes a correction score corresponding to the network data. It should be noted that network data includes basic network type, bandwidth, latency, and packet loss rate. In addition, network stability indicators can be calculated, such as using tools like the Ping command and employing a sliding window technique to statistically analyze network data over a period of time (e.g., 30 minutes), recording bandwidth and latency data every minute, calculating moving averages for bandwidth and latency, and comparing the moving averages at the beginning and end of the window. If both bandwidth and latency trends are positive, the network congestion trend is increasing; if both bandwidth and latency trends are negative, the network congestion trend is decreasing; if both bandwidth and latency trends are close to zero, the network congestion trend is stable. Specifically, the security scoring rules are as follows: a small latency standard deviation (stable) is +5 points, and a large latency standard deviation (unstable) is -5 points; abnormal fluctuations in network speed may indicate network attacks or instability; a stable network congestion trend is +2 points, and an increasing network congestion trend is -5 points; the system differentiates between the type of network the user is connected to, such as home Wi-Fi, office Wi-Fi, public Wi-Fi, 4G / 5G, etc. Home Wi-Fi or office Wi-Fi is +10 points, 4G / 5G is +5 points, and public Wi-Fi is -10 points, meaning public Wi-Fi generally has lower security. It's understandable that proxy IPs may be associated with malicious behavior, and the system can also analyze user IP address information, including the IP's geographical location and whether it's a proxy IP. A non-proxy IP with a geographic location matching the historical login location scores +5 points, while a proxy IP or an IP with a geographic location that does not match the historical login location scores -10 points. Network traffic characteristics are extracted, such as traffic size, packet length, and transmission protocol type. Abnormal traffic patterns may indicate network attacks. Setting normal traffic size, packet length, and transmission protocol type scores +5 points, while setting abnormal traffic size, packet length, and transmission protocol type scores -10 points.
[0063] In some implementations, the first mapping relationship also includes a correction score corresponding to the geographic information data. Specifically, using Geographic Information System (GIS) tools and map data resources, latitude and longitude coordinates are associated with specific administrative regions, and the geographical region type is further identified, such as commercial centers, residential areas, industrial areas, educational parks, and transportation hubs. Simultaneously, combined with nearby Points of Interest (POI) information, it is determined whether the location is near specific places such as shopping malls, schools, hospitals, and stations, adding geographic scene characteristics to the environmental classification. Specifically, commercial centers and educational parks receive +5 points, residential areas and industrial areas receive +2 points, and transportation hubs receive -5 points. Furthermore, the frequency of changes in the user's geographic location is monitored. Frequent changes in geographic location may indicate that the user is using the device in an unsafe environment. By comparing the user's real-time geographic location with historical login locations, the matching degree is assessed; mismatched geographic locations may increase risk. Specifically, stable geographic location (low frequency of change) receives +5 points, frequent changes in geographic location receive -10 points, a high matching degree between real-time geographic location and historical login location receives +5 points, and a low matching degree receives -10 points.
[0064] In some implementations, the first mapping relationship also includes a correction score corresponding to the user login information data. It should be noted that abnormal user behavior reflects potential login risks. When a user typically logs in during daytime working hours, but logs in late at night, there is a risk that malicious attackers may exploit the user's low-activity period to steal information or perform illegal operations. Alternatively, the login time change may be due to reasonable reasons such as working overtime or traveling across time zones. In such cases, combining geographical location information with the user's travel records can help make a more accurate judgment. Specifically, logins at unusual times (such as late at night) are scored as -5 points, and logins at unusual times without a reasonable explanation (such as working overtime or traveling across time zones) are scored as -10 points. Furthermore, if a user logs into their account multiple times within a short period, such as within one hour, on different devices or under different network environments, the risk factor will significantly increase. This may indicate that the account has been stolen, and attackers are attempting to gain various permissions, steal information, or perform probing operations after brute-force password cracking. Specifically, a sudden change in login frequency (such as an abnormal increase in the number of logins within a day) is scored as -10 points. Similarly, if a user frequently switches devices to log in within a day, such as from a mobile phone to a tablet to a PC, and the geographical location and network environment of the devices vary significantly, there is a high probability that the account password has been compromised, and the different devices are being used by multiple parties, including attackers. Specifically, frequent device switching scores -10 points, and logging in on a new device without strict authentication scores -15 points. Furthermore, if the same account logs in nearly simultaneously from different geographical locations, the account risk is high, indicating that the account has likely been stolen, and multiple attackers or stolen devices are simultaneously attempting to access the account from different locations. Based on this, interrupted login scores -10 points, and simultaneous login from different locations scores -20 points.
[0065] In some implementations, an open-source rules engine (such as Drools) can be used to match the first mapping relationship with the relevant data and to score the risk. The mapping relationship is written using Drools Rule Language (DRL) and can be matched with different login environments and behavioral patterns.
[0066] The initial score is corrected based on the first corrected score to obtain the first score. Specifically, this can be achieved by adding scores from different parameters (such as device scores, network data scores, geographic information data scores, and user login information data scores) to obtain the first corrected score. The initial score is then corrected using the first corrected score to obtain the user's comprehensive login environment score, ranging from 0 to 100. The lower the score, the higher the security risk.
[0067] Furthermore, the mapping relationship can be updated periodically based on new data and changes in security threats to maintain the accuracy and effectiveness of the scoring.
[0068] In one embodiment, generating the first score corresponding to the relevant data based on preset rules; or, predicting the relevant data based on a preset scoring model to obtain the first score, includes:
[0069] If the number of received historical relevant data is less than a set threshold, the first score corresponding to the relevant data is generated based on the preset rules;
[0070] If the amount of received historical relevant data is greater than or equal to a set threshold, the relevant data is predicted based on a preset scoring model to obtain the first score. The preset scoring model is a scoring model that is trained on an initial scoring model based on the historical relevant data and meets preset conditions.
[0071] It should be noted that generating the first score using preset rules requires configuring numerous mapping relationships, resulting in low efficiency. To improve scoring efficiency, a preset scoring model can be trained using historical data. Using this preset model for scoring can effectively improve efficiency.
[0072] Among them, the preset conditions can be set quantity conditions.
[0073] In this embodiment of the invention, when the amount of received historical relevant data is less than a set threshold, a first score corresponding to the relevant data is generated based on preset rules; when the amount of received historical relevant data is greater than or equal to the set threshold, the relevant data is predicted based on a preset scoring model to obtain the first score. The preset scoring model is a scoring model trained on an initial scoring model based on historical relevant data and that meets preset conditions. Thus, scoring is first performed using preset rules, and subsequently using a preset scoring model, effectively improving scoring efficiency.
[0074] In one embodiment, the training process of the preset scoring model includes:
[0075] Acquire multiple sets of historical data, each set of historical data including historical related data and historical scores;
[0076] The multiple sets of historical data are divided into a training set and a test set. The training set includes a first part of the multiple sets of historical data, and the test set includes other parts of the multiple sets of historical data. The other parts are the parts of the multiple sets of historical data other than the first part.
[0077] The initial scoring model is trained based on the training set to obtain an intermediate training model;
[0078] Based on the intermediate training model, the historical relevant data included in the test set are used to calculate the predicted score;
[0079] The loss value is calculated based on the predicted score and the historical scores included in the test set;
[0080] If the loss value is less than the set threshold, the intermediate training model is set as the preset scoring model.
[0081] In this embodiment of the invention, multiple sets of historical data are acquired, each set including historical related data and historical ratings. The multiple sets of historical data are divided into a training set and a test set. The training set includes a first portion of the multiple sets of historical data, and the test set includes other portions of the multiple sets of historical data, the other portions being the portions other than the first portion. An initial rating model is trained based on the training set to obtain an intermediate training model. A predicted rating is obtained by calculating the historical related data included in the test set based on the intermediate training model. A loss value is calculated based on the predicted rating and the historical ratings included in the test set. If the loss value is less than a set threshold, the intermediate training model is set as the preset rating model. Thus, a preset rating model is obtained through training with multiple sets of historical data, facilitating subsequent rating based on the preset rating model.
[0082] In some implementations, historical data can be historical data collected from multiple data sources, such as fields covering user ID, device type, device-related information, network type, network IP address, bandwidth, latency, packet loss rate, login geographical location, login time period, login result, and security event tags.
[0083] It should be noted that the collected historical data may contain missing values and outliers, requiring cleaning to improve data accuracy. Missing values can be handled by imputation or feature deletion; outliers can be identified and handled using statistical methods or business knowledge.
[0084] For type features, such as device type and operating system, the discrete category information—for example, device type might include desktop, laptop, mobile phone, etc., and operating system might include Windows, macOS, Linux, etc.—can be transformed into dense vectors through an embedding layer. The role of the embedding layer is to map discrete categories to a continuous low-dimensional space, so that each category can be represented by a dense vector. For example, assuming there are n device types, an embedding layer can be defined to map each device type to an m-dimensional vector. Similarly, a similar embedding layer is used for operating system transformation.
[0085] For numerical features, such as network latency, these are continuous numerical data that can be directly input into the model. The model then uses the embedding vectors of the numerical features and the categorical features together in subsequent fusion operations.
[0086] Furthermore, considering the temporal correlation of user login behavior, such as the periodicity of login times, time series features can be constructed, such as the login frequency and login time distribution over the past 7 days. The login frequency over the past 7 days can record the number of times a user logs in each day over the past 7 days, forming a vector containing 7 elements. The login time distribution can represent the user's login activity at different times of the day. For example, a day can be divided into 24 hours, forming a vector containing 24 elements, where each element represents the frequency of login in the corresponding hour. Alternatively, it can be further divided into weekdays / holidays, morning / evening peak hours, etc., to better capture temporal features.
[0087] The dense vector obtained from the categorical features through the embedding layer is concatenated with the numerical features. This involves linking the embedding vectors of device type, operating system, and numerical features such as network latency into a longer vector. Time-series features (such as the login frequency and login time distribution in the last 7 days) are also added to this concatenated vector to form a comprehensive feature vector. This vector contains information from different modalities (categorical, numerical, and time-series), resulting in multiple sets of historical data.
[0088] The aforementioned preset scoring model can be a neural network model, which implements scoring. In some implementations, a multilayer perceptron (MLP) model can be selected to handle the nonlinear relationships in complex login scenarios.
[0089] Specifically, first determine the number of neurons in the input layer. Based on the dimensions of the preprocessed data, concatenate the feature vectors corresponding to all device, network, user login, and geographic information data as input. For example, if after preprocessing, device information has 5 features, network data has 8 features, user login information three months later has 4 features, and geographic information data has 6 features, then the number of neurons in the input layer is 5 + 8 + 4 + 6 = 23.
[0090] Furthermore, select an appropriate number of hidden layers and the number of neurons per layer. The optimal structure can be determined through experiments and parameter tuning. The initial design could include two hidden layers, with 32 neurons in the first layer and 16 neurons in the second. The activation function for the hidden layers can be the Rectified Linear Unit (ReLU) function, with the formula f(x) = max(0,x), which effectively alleviates the vanishing gradient problem and accelerates model convergence.
[0091] The system can output a safety score from 0 to 100. The output layer consists of a single neuron, and the activation function can be a linear activation function (i.e., no additional activation function is used) to output a continuous numerical value that directly reflects the score.
[0092] The loss value calculated based on the predicted score and the historical scores included in the test set can be obtained by calculating the loss value based on the historical scores and the predicted score using a loss function.
[0093] In some implementations, the loss function can be the Mean Squared Error (MSE), which measures the average of the squared errors between the predicted score and historical scores. Further, L2 regularization can be added to prevent overfitting and improve the model's generalization ability. Simultaneously, statistical analysis methods are used to quantify the correlation between each parameter and the score. Statistical analysis of historical data can be used to calculate the frequency of change of each parameter within a certain time range. For example, the number of changes in network IP address and login time period within a week can be compared with the number of changes in device type within the same time period. For parameters with high importance, such as user ID, a smaller L2 regularization weight is assigned; a smaller regularization weight means that the weight constraints on these parameters are less during model training, allowing the model to learn the characteristics of these parameters more fully and thus better capture their relationship with the security score. For parameters with high change frequency, such as network IP address and login time period, the regularization strength is appropriately increased. Since these parameters are unstable, increasing the regularization weight can prevent the model from over-relying on them for prediction, reduce the model's sensitivity to noise, and improve the model's generalization ability.
[0094] The method employs time series analysis to identify periodic patterns in login behavior, determining if login data exhibits significant seasonality or periodicity. For instance, if user login behavior differs significantly between holidays and weekdays, different regularization coefficient values can be applied to different time periods. For example, during holidays, due to potentially more complex and variable user behavior and relatively higher data noise, the regularization coefficient value can be appropriately increased to strengthen regularization and prevent overfitting. On weekdays, when data is relatively stable, the regularization weight value can be appropriately decreased, allowing the model to better learn the data characteristics. Based on the mean squared error (MSE) loss function, L2 regularization terms with different parameters are added. For each parameter's weight, its corresponding regularization weight is multiplied. Then, the regularization terms for all parameters are summed and added to the MSE loss to obtain the final loss function.
[0095] The loss function can be expressed by the following formula:
[0096] ;
[0097] Where L is the final loss function, n is the number of samples, and y i It is a true historical rating. It is the predicted score of the model. It is the overall regularization coefficient, m is the number of parameters, and w is the regularization coefficient. j It is the weight corresponding to the j-th parameter, α j It is the regularization weight of the j-th parameter.
[0098] In some implementations, the Adam optimizer combined with a cosine annealing strategy can be used to fully utilize Adam's adaptive learning rate feature while avoiding overfitting by dynamically adjusting the learning rate. Specifically, considering the periodicity of login activity, the strategy uses a larger learning rate in the early stages of training, enabling the model to quickly converge to a better region; as training progresses, the learning rate gradually decreases to prevent the model from skipping the optimal solution. Simultaneously, the cosine annealing period can be set according to the length of the login cycle. For example, if login behavior is found to be cyclical, the cosine annealing period can be set to the number of training epochs corresponding to one week. During training epochs corresponding to peak login periods, the learning rate is appropriately increased, allowing the model to learn more features faster; during training epochs corresponding to low login periods, the learning rate is decreased, allowing the model to converge more stably. The decay frequency of the learning rate is adjusted according to the periodicity of the login data and the model's training progress. If the periodicity of login activity is significant, the learning rate can be adjusted according to multiples of the cycle.
[0099] During optimization, the synergistic effect of regularization with the optimizer and learning rate scheduler needs to be considered. For example, when using a large regularization strength, it may be necessary to appropriately increase the initial learning rate to ensure that the model can fully learn the features of the data; in the stage of low learning rate, the regularization strength can be appropriately reduced to avoid the model being overly constrained. If the model is prone to getting stuck in local optima during training, the decay frequency of the learning rate can be appropriately increased. The model is trained using the training set data, specifying the number of training epochs and the batch size. For example, setting the number of training epochs to 50 and the batch size to 32. During training, the multilayer perceptron model continuously adjusts the weights according to the loss function to improve prediction accuracy. Model performance is optimized by adjusting hyperparameters such as the number of hidden layers, the number of neurons per layer, the number of training epochs, the batch size, and the learning rate.
[0100] Understandably, the pre-trained scoring model needs to be saved before making predictions. This saved model is deployed to the actual production server. Specifically, this can be achieved by setting up a Representational State Transfer (RESTful) API service to receive user login device, network data, user login information, and geographic information. Then, the loaded pre-trained scoring model is used to make predictions, and the first score is returned.
[0101] In one embodiment, the step of predicting the relevant data based on a preset scoring model to obtain the first score includes:
[0102] Obtain n sets of sample data, where n is a positive integer greater than 1;
[0103] The n sets of sample data are divided into a first set of sample data and a second set of sample data.
[0104] The first sample score is calculated for each sample in the first group of sample data based on the preset rules, and the second sample score is calculated for each sample in the second group of sample data based on the preset scoring model.
[0105] Based on the first sample score of each sample in the first group of sample data and the second sample score of each sample in the second group of sample data, calculate the first statistic and the first degree of freedom;
[0106] The first probability is determined based on the first statistic and the first degree of freedom;
[0107] If the first probability is less than a set probability threshold, the relevant data is predicted based on the preset scoring model to obtain the first score.
[0108] It should be noted that before scoring using the preset scoring model, it is necessary to determine the scoring effect of the preset scoring model. The preset scoring model should only be used if the scoring effect of the preset scoring model meets the expectations; if the scoring effect of the preset scoring model does not meet the expectations, the preset rules should continue to be used for scoring.
[0109] In this embodiment of the invention, n sets of sample data are obtained, where n is a positive integer greater than 1; the n sets of sample data are divided into a first set of sample data and a second set of sample data; a first sample score is calculated for each sample data in the first set of sample data based on the preset rules, and a second sample score is calculated for each sample data in the second set of sample data based on the preset scoring model; a first statistic and a first degree of freedom are calculated based on the first sample score and the second sample score of each sample data in the first set of sample data and the second sample score of each sample data in the second set of sample data; a first probability is determined based on the first statistic and the first degree of freedom; when the first probability is less than a set probability threshold, the relevant data is predicted based on the preset scoring model to obtain the first score. Thus, by calculating the first probability to determine the scoring effect of the preset scoring model relative to the preset rules, and when the first probability is less than the set probability threshold, the scoring effect of the preset scoring model is considered to meet the requirements, and the relevant data is predicted based on the preset scoring model to obtain the first score.
[0110] Specifically, after the pre-set scoring model is trained, A / B testing can be used to compare the scoring of the rule engine and the machine learning engine. Using statistical hypothesis testing, a significance level α (i.e., a pre-set probability threshold) is defined to represent the error rate, typically set to 0.05, representing a 5% probability of error between the pre-set scoring model score and the pre-set rule score. The power (1-β) is set as the probability of correctly identifying an actual difference between the two sets of scores, set to 0.95, representing the probability of correctly identifying an actual difference between the two sets of scores. σ1 is the standard deviation of the difference between the pre-set rule scores, and σ2 is the standard deviation of the difference between the pre-set scoring model scores, used to measure the dispersion of the data, indicating the magnitude of fluctuation in the scoring data. Δ is the minimum difference between the pre-set scoring model score and the pre-set rule score, indicating that the pre-set scoring model score is at least Δ points higher than the pre-set rule score. The Z-score is an indicator that measures the distance between a data point and the mean, expressed in standard deviation; the Z-score is used to represent the significance level and the probability of Type II error. The Z-score Z corresponding to the significance level α is found according to the standard normal distribution table. α2 , used for two-tailed tests. Z β This is the Z-score corresponding to the Type II error probability β. Specifically, the minimum sample size n required for comparing the pre-defined rule score and the pre-defined scoring model score can be calculated using the following formula:
[0111] ;
[0112] The minimum sample size obtained from the calculation is the number of sample data.
[0113] It should be noted that for periodic login data, the above algorithm avoids statistical bias caused by time dependence and reduces the impact of small sample periods on the overall results through weighted averaging. For the first statistic and the first degree of freedom, the p-value (i.e., the first probability) can be found using a t-distribution table or statistical software. The p-value represents the probability of observing the current data or more extreme data under the null hypothesis. If the p-value is less than the significance level α, it is considered that group B's performance is significantly better than group A, indicating that the preset scoring model performs better in practical applications and that the data volume is sufficient to support the model's application. The system then switches to using the preset scoring model for scoring.
[0114] In one embodiment, calculating the first statistic and the first degrees of freedom based on the first sample score of each sample data in the first set of sample data and the second sample score of each sample data in the second set of sample data includes:
[0115] The first group of sample data and the second group of samples are each divided into s time periods, where s is a positive integer greater than 1;
[0116] Calculate the statistics corresponding to each time period. The s time periods include a first time period. The statistics corresponding to the first time period are the quotient of the first difference and the first square root. The first difference is the difference between the first mean and the second mean. The first mean is the mean of the first sample score in the first group of sample data within the first time period. The second mean is the mean of the second sample score in the first group of sample data within the first time period. The first square root is the square root of the first sum. The first sum is the sum of the first square value and the second square value. The first square value is the square of the mean of the standard deviation of the first sample score in the first group of sample data within the first time period. The second square value is the square of the mean of the standard deviation of the second sample score in the first group of sample data within the first time period.
[0117] Calculate the first statistic based on the statistics corresponding to the s time periods;
[0118] Calculate the degrees of freedom for each time period. The statistic for the first time period is the quotient of the third square value and the second sum value. The third square value is the square of the first sum value. The second sum value is the sum of the first quotient value and the second quotient value. The first quotient value is the quotient of the square of the first square value and the number of sample data of the first group of sample data in the first time period. The second quotient value is the quotient of the square of the second square value and the number of sample data of the second group of sample data in the first time period.
[0119] The first degree of freedom is calculated based on the degrees of freedom corresponding to the s time periods.
[0120] In this embodiment of the invention, the first statistic and the first degree of freedom are calculated in the above manner, and then the first probability can be determined based on the first statistic and the first degree of freedom. The preset scoring model is then used to score the relevant data by setting a probability threshold.
[0121] It should be noted that the assumption determines whether to reject the null hypothesis H0 (there is no significant difference in performance between groups A and B) or accept the alternative hypothesis H1 (group B's performance is significantly better than group A). Because login environment parameters are periodic, directly using the standard Welch t-statistic and degrees of freedom (df) may lead to erroneous conclusions, as the data may not be independently and identically distributed, and the variance may differ across time periods. In this embodiment of the invention, the data is divided into time blocks, and the t-statistic is calculated for each time period. A weighted average is then used to combine information from all time periods to obtain the first statistic and the first degrees of freedom.
[0122] Specifically, n sample data points are read from historical login data, serving as group A and group B as input data for the preset rule scoring and the preset scoring model scoring, respectively. Groups A and B are then divided into s time blocks. Wherein, group A contains x... Asi For the scoring of the i-th data point in the s-th time period based on preset rules, group B x Bsi This is the safety score for the i-th data point in the s-th time period based on a pre-defined scoring model. The scores for all data points in the s-th time period are summed for both group A and group B, then divided by the total number of data points in each group to obtain the mean. The square of the difference between each score and the mean is calculated, summed, divided by n-1, and the square root is taken to obtain the standard deviation for each group. The mean for group A in the s-th time period is then calculated. The mean of the s-th time interval of Group B And the standard deviation S of group A in the s-th time period. As The standard deviation S of group B in the s-th time period Bs .
[0123] Furthermore, the t-statistic is calculated using the Welch t-test formula to measure whether the difference between the means of the two groups of data is significant. It is expressed by the following formula:
[0124] ;
[0125] Where n As and n BS These represent the sample sizes of group A and group B respectively during time period s, and t s This represents the statistics for the s-th time period.
[0126] After calculating the statistics for the s time periods, the first statistic is obtained using the following formula:
[0127] ;
[0128] t final As the first statistic, w s is the weighting coefficient, which can be the data volume or the reciprocal of the variance in the s-th time period.
[0129] Furthermore, the degrees of freedom for each time period can be calculated using the following formula:
[0130] ;
[0131] After obtaining the degrees of freedom for each time period, the first degree of freedom is calculated using the following formula:
[0132] ;
[0133] In the formula df s Let be the degrees of freedom in the s-th time interval.
[0134] In one embodiment, determining the first risk level corresponding to the first score includes:
[0135] The first risk level corresponding to the first score is determined based on the second mapping relationship, which includes multiple risk levels and a score range corresponding to each risk level. The first score is located within the score range corresponding to the first risk level.
[0136] The determination of the first login method based on the first risk level includes:
[0137] The first login method corresponding to the first risk level is determined based on the third mapping relationship, wherein the third mapping relationship includes the login method corresponding to each of the multiple risk levels.
[0138] In this embodiment of the invention, a first risk level corresponding to the first score is determined based on a second mapping relationship, and a first login method corresponding to the first risk level is determined based on a third mapping relationship, so as to realize the determination of the first login method through a pre-configured second mapping relationship and a third mapping relationship.
[0139] The second and third mapping relationships are pre-configured and used to determine the risk level and the corresponding login method.
[0140] In some implementations, the security score data generated by the security scoring module can be integrated with the user's login request information to obtain a second mapping relationship and a third mapping relationship, ensuring the accuracy and consistency of the data.
[0141] Specifically, the second and third mapping relationships can be represented as follows:
[0142] For scores of 0-30, which are considered high-risk, users are required to undergo secondary verification through methods such as SMS verification code and facial recognition in addition to entering their password, in order to ensure the authenticity of the login user's identity.
[0143] For scores between 31 and 60, which are considered medium risk, users will need to enter a password, and the login device must be the same as the bound device. If logging in from a different device, additional authentication is required. Users can set an IP whitelist; only IP addresses on the whitelist can log in, and logins from other IP addresses require additional verification.
[0144] For security scores of 61-100, which are considered low-risk, users only need to enter a password to log in. This is suitable for scenarios where device information is normal, the network environment is good, and login behavior is normal. Furthermore, a one-click login method can be provided. While ensuring security, this allows users to customize login rules for different scenarios based on their needs and preferences, such as specifying which devices or network environments allow passwordless login. This simplifies the login process and improves the user experience.
[0145] In some implementations, the collected login behavior data can be stored in a database, which can be a relational database or a NoSQL database. Relational databases are suitable for storing structured data, facilitating complex queries and analysis; NoSQL databases are suitable for storing large-scale unstructured data, offering good scalability and flexibility. Creating appropriate indexes for the data improves query efficiency and facilitates subsequent data analysis and model training.
[0146] In some implementations, preset rules can be optimized by analyzing large amounts of login behavior data to identify common abnormal login patterns or emerging risky behaviors. Examples include frequent logins over public Wi-Fi in different cities, or the same account logging in on multiple devices in a short period with geographically dispersed locations. These behavioral patterns are then translated into specific rules. New rules are added to the preset rules, or the thresholds and conditions of existing rules are adjusted (e.g., adjusting the threshold for judging abnormal login frequency). The updated rule engine is then deployed to the production environment, enabling it to monitor and judge user login behavior in real time based on the new rules, and promptly detect and handle abnormal login situations.
[0147] In some implementations, optimization of a pre-defined scoring model can be achieved by periodically extracting the latest login behavior data from a database as training data. By continuously updating the training data, the model can learn the latest user login behavior patterns and security risk characteristics. The model is then evaluated using the new login behavior data, and performance metrics such as accuracy, recall, and F1 score are calculated. Based on the evaluation results, the neural network model is adjusted and optimized. Hyperparameters such as the learning rate, regularization parameters, number of layers, and number of neurons in the neural network are adjusted to achieve better model performance, enabling it to more accurately predict the risk of login behavior and determine the legitimacy of logins.
[0148] Through the comprehensive design and implementation methods described above, user login behavior data can be effectively recorded, and this data can be fully utilized to optimize the preset scoring model and adjust the preset rules, thereby continuously improving the ability to analyze user login behavior and the level of security.
[0149] Please see Figure 2 , Figure 2 This is a structural diagram of a login device provided in an embodiment of the present invention, such as... Figure 2 As shown, the login device 200 includes:
[0150] The acquisition module 201 is used to acquire relevant data of the login device, the relevant data being used to characterize the environmental conditions of the login device.
[0151] The generation module 202 is used to generate a first score based on the relevant data, wherein the first score is used to characterize the security status of the environment in which the login device is located;
[0152] The first determining module 203 is used to determine the first risk level corresponding to the first score;
[0153] The second determining module 204 is used to determine the first login method based on the first risk level;
[0154] The login module 205 is used to log in based on the first login method.
[0155] In one embodiment, the generation module 202 includes:
[0156] The prediction submodule is used to generate the first score corresponding to the relevant data based on preset rules; or, to predict the relevant data based on a preset scoring model to obtain the first score.
[0157] In one embodiment, the prediction submodule includes:
[0158] A determining unit is configured to determine a first corrected score corresponding to the relevant data based on a first mapping relationship, wherein the first mapping relationship includes multiple data and corrected scores corresponding to different data, and the relevant data is at least one of the multiple data;
[0159] The correction unit is used to correct the initial score based on the first correction score to obtain the first score.
[0160] In one embodiment, the prediction submodule includes:
[0161] The generation unit is used to generate the first score corresponding to the relevant data based on the preset rules when the number of received historical relevant data is less than a set number threshold.
[0162] The prediction unit is used to predict the relevant data based on a preset scoring model to obtain the first score when the number of received historical relevant data is greater than or equal to a set number threshold. The preset scoring model is a scoring model that is trained on an initial scoring model based on the historical relevant data and meets preset conditions.
[0163] In one embodiment, the training process of the preset scoring model includes:
[0164] Acquire multiple sets of historical data, each set of historical data including historical related data and historical scores;
[0165] The multiple sets of historical data are divided into a training set and a test set. The training set includes a first part of the multiple sets of historical data, and the test set includes other parts of the multiple sets of historical data. The other parts are the parts of the multiple sets of historical data other than the first part.
[0166] The initial scoring model is trained based on the training set to obtain an intermediate training model;
[0167] Based on the intermediate training model, the historical relevant data included in the test set are used to calculate the predicted score;
[0168] The loss value is calculated based on the predicted score and the historical scores included in the test set;
[0169] If the loss value is less than the set threshold, the intermediate training model is set as the preset scoring model.
[0170] In one embodiment, the prediction unit includes:
[0171] Get sub-units, used to obtain n sets of sample data, where n is a positive integer greater than 1;
[0172] A processing subunit is used to divide the n groups of sample data into a first group of sample data and a second group of sample data.
[0173] The first calculation subunit is used to calculate the first sample score of each sample data in the first group of sample data based on the preset rules, and to calculate the second sample score of each sample data in the second group of sample data based on the preset scoring model.
[0174] The second calculation subunit is used to calculate the first statistic and the first degree of freedom based on the first sample score of each sample data in the first group of sample data and the second sample score of each sample data in the second group of sample data.
[0175] The third calculation subunit is used to determine the first probability based on the first statistic and the first degree of freedom;
[0176] The prediction subunit is used to predict the relevant data based on the preset scoring model to obtain the first score when the first probability is less than a set probability threshold.
[0177] In one embodiment, the second computing subunit is specifically used for:
[0178] The first group of sample data and the second group of samples are each divided into s time periods, where s is a positive integer greater than 1;
[0179] Calculate the statistics corresponding to each time period. The s time periods include a first time period. The statistics corresponding to the first time period are the quotient of the first difference and the first square root. The first difference is the difference between the first mean and the second mean. The first mean is the mean of the first sample score in the first group of sample data within the first time period. The second mean is the mean of the second sample score in the first group of sample data within the first time period. The first square root is the square root of the first sum. The first sum is the sum of the first square value and the second square value. The first square value is the square of the mean of the standard deviation of the first sample score in the first group of sample data within the first time period. The second square value is the square of the mean of the standard deviation of the second sample score in the first group of sample data within the first time period.
[0180] Calculate the first statistic based on the statistics corresponding to the s time periods;
[0181] Calculate the degrees of freedom for each time period. The statistic for the first time period is the quotient of the third square value and the second sum value. The third square value is the square of the first sum value. The second sum value is the sum of the first quotient value and the second quotient value. The first quotient value is the quotient of the square of the first square value and the number of sample data of the first group of sample data in the first time period. The second quotient value is the quotient of the square of the second square value and the number of sample data of the second group of sample data in the first time period.
[0182] The first degree of freedom is calculated based on the degrees of freedom corresponding to the s time periods.
[0183] In one embodiment, the first determining module 203 includes:
[0184] The first determining submodule is used to determine the first risk level corresponding to the first score based on the second mapping relationship. The second mapping relationship includes multiple risk levels and a score range corresponding to each risk level. The first score is located within the score range corresponding to the first risk level.
[0185] The second determining module 204 includes:
[0186] The second determining submodule is used to determine the first login method corresponding to the first risk level based on a third mapping relationship, wherein the third mapping relationship includes the login method corresponding to each of the plurality of risk levels.
[0187] In one embodiment, the relevant data includes at least one of the following: network data of the login device, geographic information data, and user login information data.
[0188] The login device provided in this embodiment of the invention can implement each process of the above-described login method, with one-to-one correspondence of technical features and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0189] It should be noted that the login device in the embodiments of the present invention can be a device, or it can be a component, integrated circuit, or chip in an electronic device.
[0190] This invention also provides an electronic device, including: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the above-described functionality. Figure 1 The various processes of the login method embodiments shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0191] For details, see Figure 3 As shown, this embodiment of the invention also provides an electronic device, including a bus 301, a transceiver 302, an antenna 303, a bus interface 304, a processor 305, and a memory 306.
[0192] The transceiver 302 is used to acquire relevant data of the login device, and the relevant data is used to characterize the environmental conditions of the login device.
[0193] The processor 305 is used to generate a first score based on the relevant data, and the first score is used to characterize the security status of the environment where the login device is located.
[0194] The processor 305 is also used to determine the first risk level corresponding to the first score;
[0195] The processor 305 is further configured to determine a first login method based on the first risk level;
[0196] The processor 305 is also used to log in based on the first login method.
[0197] In one embodiment, generating a first score based on the relevant data includes:
[0198] The first score is generated based on preset rules to correspond to the relevant data; or, the first score is obtained by predicting the relevant data based on a preset scoring model.
[0199] In one embodiment, generating the first score corresponding to the relevant data based on preset rules includes:
[0200] A first corrected score is determined based on a first mapping relationship, wherein the first mapping relationship includes multiple data and corrected scores corresponding to different data, and the relevant data is at least one of the multiple data.
[0201] The initial score is corrected based on the first corrected score to obtain the first score.
[0202] In one embodiment, generating the first score corresponding to the relevant data based on preset rules; or, predicting the relevant data based on a preset scoring model to obtain the first score, includes:
[0203] If the number of received historical relevant data is less than a set threshold, the first score corresponding to the relevant data is generated based on the preset rules;
[0204] If the amount of received historical relevant data is greater than or equal to a set threshold, the relevant data is predicted based on a preset scoring model to obtain the first score. The preset scoring model is a scoring model that is trained on an initial scoring model based on the historical relevant data and meets preset conditions.
[0205] In one embodiment, the training process of the preset scoring model includes:
[0206] Acquire multiple sets of historical data, each set of historical data including historical related data and historical scores;
[0207] The multiple sets of historical data are divided into a training set and a test set. The training set includes a first part of the multiple sets of historical data, and the test set includes other parts of the multiple sets of historical data. The other parts are the parts of the multiple sets of historical data other than the first part.
[0208] The initial scoring model is trained based on the training set to obtain an intermediate training model;
[0209] Based on the intermediate training model, the historical relevant data included in the test set are used to calculate the predicted score;
[0210] The loss value is calculated based on the predicted score and the historical scores included in the test set;
[0211] If the loss value is less than the set threshold, the intermediate training model is set as the preset scoring model.
[0212] In one embodiment, the step of predicting the relevant data based on a preset scoring model to obtain the first score includes:
[0213] Obtain n sets of sample data, where n is a positive integer greater than 1;
[0214] The n sets of sample data are divided into a first set of sample data and a second set of sample data.
[0215] The first sample score is calculated for each sample in the first group of sample data based on the preset rules, and the second sample score is calculated for each sample in the second group of sample data based on the preset scoring model.
[0216] Based on the first sample score of each sample in the first group of sample data and the second sample score of each sample in the second group of sample data, calculate the first statistic and the first degree of freedom;
[0217] The first probability is determined based on the first statistic and the first degree of freedom;
[0218] If the first probability is less than a set probability threshold, the relevant data is predicted based on the preset scoring model to obtain the first score.
[0219] In one embodiment, calculating the first statistic and the first degrees of freedom based on the first sample score of each sample data in the first set of sample data and the second sample score of each sample data in the second set of sample data includes:
[0220] The first group of sample data and the second group of samples are each divided into s time periods, where s is a positive integer greater than 1;
[0221] Calculate the statistics corresponding to each time period. The s time periods include a first time period. The statistics corresponding to the first time period are the quotient of the first difference and the first square root. The first difference is the difference between the first mean and the second mean. The first mean is the mean of the first sample score in the first group of sample data within the first time period. The second mean is the mean of the second sample score in the first group of sample data within the first time period. The first square root is the square root of the first sum. The first sum is the sum of the first square value and the second square value. The first square value is the square of the mean of the standard deviation of the first sample score in the first group of sample data within the first time period. The second square value is the square of the mean of the standard deviation of the second sample score in the first group of sample data within the first time period.
[0222] Calculate the first statistic based on the statistics corresponding to the s time periods;
[0223] Calculate the degrees of freedom for each time period. The statistic for the first time period is the quotient of the third square value and the second sum value. The third square value is the square of the first sum value. The second sum value is the sum of the first quotient value and the second quotient value. The first quotient value is the quotient of the square of the first square value and the number of sample data of the first group of sample data in the first time period. The second quotient value is the quotient of the square of the second square value and the number of sample data of the second group of sample data in the first time period.
[0224] The first degree of freedom is calculated based on the degrees of freedom corresponding to the s time periods.
[0225] In one embodiment, determining the first risk level corresponding to the first score includes:
[0226] The first risk level corresponding to the first score is determined based on the second mapping relationship, which includes multiple risk levels and a score range corresponding to each risk level. The first score is located within the score range corresponding to the first risk level.
[0227] The determination of the first login method based on the first risk level includes:
[0228] The first login method corresponding to the first risk level is determined based on the third mapping relationship, wherein the third mapping relationship includes the login method corresponding to each of the multiple risk levels.
[0229] In one embodiment, the relevant data includes at least one of the following: network data of the login device, geographic information data, and user login information data.
[0230] exist Figure 3 In this context, a bus architecture (represented by bus 301) is used. Bus 301 can include any number of interconnected buses and bridges, linking various circuits including one or more processors represented by processor 305 and memory represented by memory 306. Bus 301 can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. Bus interface 304 provides an interface between bus 301 and transceiver 302. Transceiver 302 can be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 305 is transmitted over a wireless medium via antenna 303, which further receives data and transmits it to processor 305.
[0231] Processor 305 manages bus 301 and general processing, and also provides various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. Memory 306 can be used to store data used by processor 305 during operation.
[0232] Optionally, the processor 305 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or a graphics processing unit (GPU).
[0233] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the above-described functions. Figure 1 The various processes corresponding to the login method embodiments achieve the same technical effect, and will not be described again here to avoid repetition. The computer-readable storage medium mentioned includes, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0234] The present invention also provides a computer program product, including computer instructions that, when executed by a processor, implement the above-described... Figure 1 The various processes corresponding to the login method embodiments can achieve the same technical effect, and will not be described again here to avoid repetition.
[0235] In the embodiments of this invention, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or devices. Additionally, the use of "and / or" in this application indicates at least one of the connected objects, such as A and / or B and / or C, representing eight possibilities: A alone, B alone, C alone, both A and B present, both B and C present, both A and C present, and A, B, and C present.
[0236] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0237] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or second terminal device, etc.) to execute the methods of the various embodiments of this application.
[0238] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A login method, characterized in that, include: Acquire relevant data of the login device, the relevant data being used to characterize the environment in which the login device is located, the relevant data including at least one of the network data, geographic information data and user login information data of the login device; A first score is generated based on the relevant data, and the first score is used to characterize the security status of the environment where the login device is located. Determine the first risk level corresponding to the first score; The first login method is determined based on the first risk level; Log in using the first login method; The generation of the first score based on the relevant data includes: The first score is generated based on preset rules to correspond to the relevant data; or, the first score is obtained by predicting the relevant data based on a preset scoring model. The step of predicting the relevant data based on a preset scoring model to obtain the first score includes: Obtain n sets of sample data, where n is a positive integer greater than 1; The n sets of sample data are divided into a first set of sample data and a second set of sample data. The first sample score is calculated for each sample in the first group of sample data based on the preset rules, and the second sample score is calculated for each sample in the second group of sample data based on the preset scoring model. Based on the first sample score of each sample in the first group of sample data and the second sample score of each sample in the second group of sample data, calculate the first statistic and the first degree of freedom; The first probability is determined based on the first statistic and the first degree of freedom; If the first probability is less than a set probability threshold, the relevant data is predicted based on the preset scoring model to obtain the first score; The calculation of the first statistic and the first degrees of freedom based on the first sample score of each sample data in the first group of sample data and the second sample score of each sample data in the second group of sample data includes: The first group of sample data and the second group of samples are each divided into s time periods, where s is a positive integer greater than 1; Calculate the statistics corresponding to each time period. The s time periods include a first time period. The statistics corresponding to the first time period are the quotient of the first difference and the first square root. The first difference is the difference between the first mean and the second mean. The first mean is the mean of the first sample score in the first group of sample data within the first time period. The second mean is the mean of the second sample score in the first group of sample data within the first time period. The first square root is the square root of the first sum. The first sum is the sum of the first square value and the second square value. The first square value is the square of the mean of the standard deviation of the first sample score in the first group of sample data within the first time period. The second square value is the square of the mean of the standard deviation of the second sample score in the first group of sample data within the first time period. Calculate the first statistic based on the statistics corresponding to the s time periods; Calculate the degrees of freedom for each time period. The statistic for the first time period is the quotient of the third square value and the second sum value. The third square value is the square of the first sum value. The second sum value is the sum of the first quotient value and the second quotient value. The first quotient value is the quotient of the square of the first square value and the number of sample data of the first group of sample data in the first time period. The second quotient value is the quotient of the square of the second square value and the number of sample data of the second group of sample data in the first time period. The first degree of freedom is calculated based on the degrees of freedom corresponding to the s time periods.
2. The method as described in claim 1, characterized in that, The step of generating the first score corresponding to the relevant data based on preset rules includes: A first corrected score is determined based on a first mapping relationship, wherein the first mapping relationship includes multiple data and corrected scores corresponding to different data, and the relevant data is at least one of the multiple data. The initial score is corrected based on the first corrected score to obtain the first score.
3. The method as described in claim 1, characterized in that, The first score corresponding to the relevant data is generated based on preset rules; Alternatively, the first score can be obtained by predicting the relevant data based on a preset scoring model, including: If the number of received historical relevant data is less than a set threshold, the first score corresponding to the relevant data is generated based on the preset rules; If the amount of received historical relevant data is greater than or equal to a set threshold, the relevant data is predicted based on a preset scoring model to obtain the first score. The preset scoring model is a scoring model that is trained on an initial scoring model based on the historical relevant data and meets preset conditions.
4. The method as described in claim 3, characterized in that, The training process of the preset scoring model includes: Acquire multiple sets of historical data, each set of historical data including historical related data and historical scores; The multiple sets of historical data are divided into a training set and a test set. The training set includes a first part of the multiple sets of historical data, and the test set includes other parts of the multiple sets of historical data. The other parts are the parts of the multiple sets of historical data other than the first part. The initial scoring model is trained based on the training set to obtain an intermediate training model; Based on the intermediate training model, the historical relevant data included in the test set are used to calculate the predicted score; The loss value is calculated based on the predicted score and the historical scores included in the test set; If the loss value is less than the set threshold, the intermediate training model is set as the preset scoring model.
5. The method according to any one of claims 1 to 4, characterized in that, Determining the first risk level corresponding to the first score includes: The first risk level corresponding to the first score is determined based on the second mapping relationship, which includes multiple risk levels and a score range corresponding to each risk level. The first score is located within the score range corresponding to the first risk level. The determination of the first login method based on the first risk level includes: The first login method corresponding to the first risk level is determined based on the third mapping relationship, wherein the third mapping relationship includes the login method corresponding to each of the multiple risk levels.
6. A login device, characterized in that, include: The acquisition module is used to acquire relevant data of the login device. The relevant data is used to characterize the environmental conditions of the login device. The relevant data includes at least one of the network data, geographic information data and user login information data of the login device. A generation module is used to generate a first score based on the relevant data, the first score being used to characterize the security status of the environment where the login device is located; The first determining module is used to determine the first risk level corresponding to the first score; The second determining module is used to determine the first login method based on the first risk level; The login module is used to log in based on the first login method; The generation module includes: The prediction submodule is used to generate the first score corresponding to the relevant data based on preset rules; or, to predict the relevant data based on a preset scoring model to obtain the first score. The prediction submodule is specifically used for: Obtain n sets of sample data, where n is a positive integer greater than 1; The n sets of sample data are divided into a first set of sample data and a second set of sample data. The first sample score is calculated for each sample in the first group of sample data based on the preset rules, and the second sample score is calculated for each sample in the second group of sample data based on the preset scoring model. Based on the first sample score of each sample in the first group of sample data and the second sample score of each sample in the second group of sample data, calculate the first statistic and the first degree of freedom; The first probability is determined based on the first statistic and the first degree of freedom; If the first probability is less than a set probability threshold, the relevant data is predicted based on the preset scoring model to obtain the first score; The second calculation subunit is specifically used for: The first group of sample data and the second group of samples are each divided into s time periods, where s is a positive integer greater than 1; Calculate the statistics corresponding to each time period. The s time periods include a first time period. The statistics corresponding to the first time period are the quotient of the first difference and the first square root. The first difference is the difference between the first mean and the second mean. The first mean is the mean of the first sample score in the first group of sample data within the first time period. The second mean is the mean of the second sample score in the first group of sample data within the first time period. The first square root is the square root of the first sum. The first sum is the sum of the first square value and the second square value. The first square value is the square of the mean of the standard deviation of the first sample score in the first group of sample data within the first time period. The second square value is the square of the mean of the standard deviation of the second sample score in the first group of sample data within the first time period. Calculate the first statistic based on the statistics corresponding to the s time periods; Calculate the degrees of freedom for each time period. The statistic for the first time period is the quotient of the third square value and the second sum value. The third square value is the square of the first sum value. The second sum value is the sum of the first quotient value and the second quotient value. The first quotient value is the quotient of the square of the first square value and the number of sample data of the first group of sample data in the first time period. The second quotient value is the quotient of the square of the second square value and the number of sample data of the second group of sample data in the first time period. The first degree of freedom is calculated based on the degrees of freedom corresponding to the s time periods.
7. An electronic device, characterized in that, Including transceivers and processors, The transceiver is used to acquire relevant data of the login device, and the relevant data is used to characterize the environmental conditions of the login device. The processor is used to generate a first score based on the relevant data, and the first score is used to characterize the security status of the environment where the login device is located; The processor is also configured to determine the first risk level corresponding to the first score; The processor is further configured to determine a first login method based on the first risk level; The processor is also used to log in based on the first login method; The generation of the first score based on the relevant data includes: The first score is generated based on preset rules to correspond to the relevant data; or, the first score is obtained by predicting the relevant data based on a preset scoring model. The step of predicting the relevant data based on a preset scoring model to obtain the first score includes: Obtain n sets of sample data, where n is a positive integer greater than 1; The n sets of sample data are divided into a first set of sample data and a second set of sample data. The first sample score is calculated for each sample in the first group of sample data based on the preset rules, and the second sample score is calculated for each sample in the second group of sample data based on the preset scoring model. Based on the first sample score of each sample in the first group of sample data and the second sample score of each sample in the second group of sample data, calculate the first statistic and the first degree of freedom; The first probability is determined based on the first statistic and the first degree of freedom; If the first probability is less than a set probability threshold, the relevant data is predicted based on the preset scoring model to obtain the first score; The calculation of the first statistic and the first degrees of freedom based on the first sample score of each sample data in the first group of sample data and the second sample score of each sample data in the second group of sample data includes: The first group of sample data and the second group of samples are each divided into s time periods, where s is a positive integer greater than 1; Calculate the statistics corresponding to each time period. The s time periods include a first time period. The statistics corresponding to the first time period are the quotient of the first difference and the first square root. The first difference is the difference between the first mean and the second mean. The first mean is the mean of the first sample score in the first group of sample data within the first time period. The second mean is the mean of the second sample score in the first group of sample data within the first time period. The first square root is the square root of the first sum. The first sum is the sum of the first square value and the second square value. The first square value is the square of the mean of the standard deviation of the first sample score in the first group of sample data within the first time period. The second square value is the square of the mean of the standard deviation of the second sample score in the first group of sample data within the first time period. Calculate the first statistic based on the statistics corresponding to the s time periods; Calculate the degrees of freedom for each time period. The statistic for the first time period is the quotient of the third square value and the second sum value. The third square value is the square of the first sum value. The second sum value is the sum of the first quotient value and the second quotient value. The first quotient value is the quotient of the square of the first square value and the number of sample data of the first group of sample data in the first time period. The second quotient value is the quotient of the square of the second square value and the number of sample data of the second group of sample data in the first time period. The first degree of freedom is calculated based on the degrees of freedom corresponding to the s time periods.
8. An electronic device, characterized in that, include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the login method as described in any one of claims 1 to 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the login method as described in any one of claims 1 to 5.
10. A computer program product, characterized in that, It includes computer instructions that, when executed by a processor, implement the steps of the login method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Account information login method and device, computer equipment and computer storage medium
CN110166438A
Risk level login processing method and system, computer equipment and storage medium
CN114357420A