Multi-factor authentication method, system and computer device based on cloud application platform
By automatically generating encrypted token keys and independently configuring two-factor authentication switches on the cloud application platform, combined with static passwords and TOTP offline secondary verification, the problem of single-factor authentication being vulnerable to attacks and authentication failure in offline environments on the cloud application platform is solved. This achieves a balance between high security and convenience, adapting to the needs of different security level scenarios.
Patent Information
- Application Number
- CN202611336168.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-31
- Publication Date
- 2026-11-24
AI Technical Summary
Existing cloud application platforms' single-factor authentication is vulnerable to brute-force attacks and phishing attacks, while two-factor authentication fails in environments without internet access and lacks flexible configuration capabilities at the user level, failing to meet the access control requirements of high-security scenarios.
The platform automatically generates a globally unique encrypted token key and generates a binding QR code through the standard OTP Auth protocol to achieve key synchronization and binding without requiring an external network. Each user is independently configured with a two-factor authentication switch, which combines static password primary verification and TOTP-based offline secondary verification, selectively activating the offline secondary verification.
It achieves a fully offline closed loop for key synchronization and binding, enhancing the autonomy, controllability, and security of the authentication system. It flexibly adapts to different security level scenarios, balances high security strength with convenient login experience, resists replay attacks and credential leakage risks, and ensures authentication continuity and robustness.
Smart Images

Figure CN123163833A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of identity security authentication technology for cloud application platforms, and in particular to a multi-factor authentication method, system, and computer device based on a cloud application platform. Background Technology
[0002] With the widespread deployment of cloud-based application platforms (such as cloud PC management systems) in enterprise intranets and confidential environments, platform account security has become a core aspect of information system protection. Traditional single-factor authentication, relying solely on static account passwords, is highly vulnerable to brute-force attacks, phishing attacks, and credential leaks, making it insufficient to meet the access control requirements of high-security scenarios.
[0003] Existing two-factor authentication schemes generally rely on SMS verification codes, email push notifications, or third-party online authentication services (such as Auth0 and Okta). Essentially, all of these require external networks to complete key distribution, time synchronization, or verification callbacks. However, in physically isolated intranet environments without internet access, these schemes become completely ineffective due to the inability to establish external connections, making it difficult to implement two-factor authentication in high-security scenarios. Furthermore, existing systems often lack the flexible configuration capability to independently start and stop secondary authentication at the user level, frequently adopting a one-size-fits-all approach that fails to cater to the differentiated needs of users in different roles and with varying security levels. Summary of the Invention
[0004] This invention provides a multi-factor authentication method, system, and computer device based on a cloud-based application platform, aiming to solve at least one of the technical problems existing in the prior art.
[0005] The technical solution of this invention is a multi-factor authentication method based on a cloud application platform, which includes: During the key binding phase, the platform automatically generates a globally unique encrypted TOKEN key for the user and generates a binding QR code based on the standard OTPAUTH protocol, which is then scanned by the mobile authenticator to complete key synchronization and binding. The entire process does not require connection to an external network or third-party authentication service. On the platform side, a two-factor authentication switch is configured independently for each user to support individual activation and deactivation of secondary authentication on a user-by-user basis; During the login authentication phase, a first-level verification of the validity of the static account password is performed. After the first-level verification passes, the offline second-level verification based on the user's two-factor authentication switch status is selectively invoked. If the offline second-level verification passes, a session credential is issued to complete the login.
[0006] According to some embodiments of the present invention, the offline secondary verification includes: If the two-factor authentication switch is on, the server retrieves the user's bound TOKEN key; The system independently calculates the standard dynamic password based on the server's local clock and performs a two-way consistency comparison and authentication with the dynamic password generated locally on the user's mobile device.
[0007] According to some embodiments of the present invention, in the key binding stage, the platform automatically generates a globally unique encrypted token key for the user and generates a binding QR code based on the standard OTPAUTH protocol, which is then scanned by the mobile authenticator to complete key synchronization and binding, including: When creating a new user on the platform, the key generation interface is automatically called to generate a globally unique encrypted TOKEN key through a secure random number algorithm. The encrypted TOKEN key is stored in the platform's local database after being symmetrically encrypted, and plaintext echoing from the front end is prohibited throughout the process. Concatenate the standard otpauth: / / totp protocol link, fully encapsulate the user's account name, encryption key, dynamic code refresh cycle and hash algorithm parameters, convert the protocol link into a visual QR code image and return it to the front end for display; After the universal mobile TOTP authenticator scans the QR code to complete key synchronization, the user enters the current dynamic verification code on the platform's binding confirmation page. The server independently verifies the verification code based on the local clock. Once the verification matches, the binding is successful.
[0008] According to some embodiments of the present invention, the dynamic password is independently calculated based on the TOTP algorithm, and the calculation method includes: Divide the current Unix seconds in Coordinated Universal Time by 30 seconds and round down to obtain an integer time counter. The time counter is converted into an 8-byte big-endian integer, and HMAC-SHA1 operation is performed on it using the user's unique TOKEN key as the key to obtain a 20-byte digest. Take the lower four bits of the last byte of the 20-byte digest as the offset, take four bytes consecutively from the position indicated by the offset and concatenate them into an integer, and remove its highest sign bit to obtain a 31-bit positive integer. The 31-bit positive integer is divided by one million, and the remainder is padded with zeros to a total of 6 bits to obtain the final dynamic password; A dynamic verification code is generated based on the final dynamic password.
[0009] According to some embodiments of the present invention, it further includes: Both the server and the mobile device independently calculate the dynamic password using the local clock as the time base. The server simultaneously calculates the dynamic verification codes corresponding to the current time step, the previous time step, and the next time step. The server adopts a clock tolerance mechanism with a preset time window before and after. When the dynamic verification code submitted by the user on the mobile terminal hits any one of the current time step, the previous time step, and the next time step, the offline secondary verification is determined to be successful.
[0010] According to some embodiments of the present invention, it further includes: If the offline secondary verification fails, a hierarchical differential error message will be returned; For different fault types, such as incorrect password, mismatched dynamic password, expired dynamic password, invalid key, or local clock deviation exceeding the tolerance range, the system returns the corresponding standardized error code and repair guidance information.
[0011] According to some embodiments of the present invention, it further includes: The TOKEN key is encrypted using the AES-256 symmetric encryption algorithm and then stored in the database; the encryption master key is independently managed. The backend interface returns data that does not contain the plaintext TOKEN key. It is only encoded into the QR code image in the form of otpauth: / / URI when the QR code is generated, and the QR code image data is returned.
[0012] According to some embodiments of the present invention, the step of selectively initiating offline secondary verification based on the TOTP time-dynamic password according to the user's two-factor authentication switch status after the primary verification passes includes: Obtain the user's two-factor authentication switch status; When the two-factor authentication switch is turned on, users are forced to complete offline secondary verification based on TOTP time-dynamic password when logging in; When the two-factor authentication switch is off, the user can directly create session credentials and log in after passing the first-level verification.
[0013] The technical solution of the present invention also relates to a multi-factor authentication system based on a cloud-based application platform, used to execute the multi-factor authentication method based on a cloud-based application platform as described in the above embodiments, comprising: The user key generation module is used to automatically generate a globally unique encrypted token key for the user on the platform side during the key binding stage. The QR code generation and distribution module is used to generate binding QR codes based on the standard OTPAUTH protocol, which can be scanned by mobile verifiers to complete key synchronization and binding, without the need to connect to external networks or third-party authentication services throughout the process. The two-factor switch control module is used to independently configure a two-factor authentication switch for each user on the platform side, so as to support the individual activation and deactivation of secondary authentication for each user. The layered login verification module is used to first perform a first-level verification of the validity of the static account password during the login authentication phase. After the first-level verification passes, it selectively invokes an offline second-level verification based on the user's two-factor authentication switch status and the TOTP time-dynamic password. If the offline second-level verification passes, a session credential is issued to complete the login.
[0014] The present invention also relates to a computer device, including a memory and a processor, wherein the processor performs the above-described method when executing a computer program stored in the memory.
[0015] The present invention also relates to a computer-readable storage medium storing computer program instructions thereon, which, when executed by a processor, implement the above-described method.
[0016] The multi-factor authentication method, system, and computer device based on a cloud-based application platform provided in this invention have at least one of the following advantages or beneficial effects: By automatically generating a globally unique encrypted token key on the platform side and generating a binding QR code based on the standard OTP Auth protocol, a fully offline closed-loop key synchronization and binding is achieved, fundamentally eliminating dependence on external networks and third-party authentication services. Independent configuration of the two-factor authentication switch allows for flexible adaptation to different security levels and user needs, balancing mandatory secondary verification in high-security scenarios with convenient single-verification login in ordinary scenarios. During the login phase, a layered architecture combining static password primary verification with TOTP offline dynamic password secondary verification is adopted. On the one hand, time-based dynamic passwords effectively resist replay attacks and credential leakage risks; on the other hand, the offline verification mechanism ensures authentication continuity and robustness in scenarios with limited network coverage or unavailable external services. Simultaneously, the selective wake-up mechanism avoids unnecessary authentication steps, optimizing the user login experience and achieving an effective balance between security and availability.
[0017] Furthermore, additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating the overall process of the multi-factor authentication method based on a cloud-based application platform provided in this embodiment of the invention. Figure 2 This is a detailed flowchart of step S300 in the multi-factor authentication method based on a cloud application platform provided in this embodiment of the invention; Figure 3 This is a detailed flowchart of step S100 in the multi-factor authentication method based on a cloud application platform provided in this embodiment of the invention; Figure 4This is a flowchart of the dynamic password calculation method provided in the embodiments of the present invention; Figure 5 This is a flowchart of the offline two-level verification method provided in the embodiments of the present invention; Figure 6 This is a flowchart of TOTP two-factor switch control, TOKEN key and QR code generation provided in the embodiments of the present invention; Figure 7 This is a complete flowchart of two-factor user login based on TOTP dynamic password provided in an embodiment of the present invention. Detailed Implementation
[0019] The following will provide a clear and complete description of the concept, specific structure, and technical effects of the present invention in conjunction with the embodiments and accompanying drawings, so as to fully understand the purpose, solution, and effects of the present invention.
[0020] It should be noted that, unless otherwise specified, when a feature is referred to as "fixed" or "connected" to another feature, it can be directly fixed or connected to the other feature, or indirectly fixed or connected to the other feature. The singular forms "a," "described," and "the" used herein are also intended to include the plural forms, unless the context clearly indicates otherwise. Furthermore, unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing particular embodiments only and not for limiting the invention. The term "and / or" as used herein includes any combination of one or more of the associated listed items.
[0021] It should be understood that although the terms first, second, third, etc., may be used to describe various elements in this disclosure, these elements should not be limited to these terms. These terms are used only to distinguish elements of the same type from one another. For example, a first element may also be referred to as a second element without departing from the scope of this disclosure, and similarly, a second element may also be referred to as a first element. Any and all instances or exemplary language (“e.g.,” “such as,” etc.) provided herein are intended only to better illustrate embodiments of the invention and, unless otherwise required, do not impose a limitation on the scope of the invention.
[0022] Reference Figures 1 to 7 The present invention will further elaborate on the multi-factor authentication method, system and computer device based on a cloud application platform provided in the embodiments of the present invention.
[0023] Reference Figure 1 As shown, Figure 1This is a general flowchart of the multi-factor authentication method based on a cloud-based application platform provided in this embodiment of the invention. The multi-factor authentication method based on a cloud-based application platform includes, but is not limited to, steps S100 to S300. Specifically, S100: During the key binding phase, the platform automatically generates a globally unique encrypted TOKEN key for the user and generates a binding QR code based on the standard OTPAUTH protocol, which is scanned by the mobile authenticator to complete key synchronization and binding. No external network or third-party authentication service is required throughout the process. S200: Configure a two-factor authentication switch independently for each user on the platform side to support individual activation and deactivation of secondary authentication for each user; S300: During the login authentication phase, a first-level verification of the validity of the static account password is performed first. After the first-level verification passes, the offline second-level verification based on the user's two-factor authentication switch status is selectively invoked. If the offline second-level verification passes, a session credential is issued to complete the login.
[0024] The multi-factor authentication method based on a cloud-based application platform provided by this invention automatically generates a globally unique encrypted token key on the platform side and generates a binding QR code based on the standard OTPAUTH protocol. This achieves a fully offline closed loop for key synchronization and binding, ensuring that the key does not rely on external networks or third-party services throughout the entire chain of generation, transmission, and synchronization. This completely avoids the risks of man-in-the-middle attacks, DNS hijacking, and data leakage from third-party service providers caused by internet transmission, thus improving the autonomy and controllability of the authentication system and its security boundaries. The key is stored only locally on the user's mobile authenticator, and no plaintext seed is retained on the platform side, realizing a closed-loop security system of offline generation, offline synchronization, and offline verification, significantly reducing the supply chain attack surface.
[0025] The two-factor authentication switch can be configured independently at the user level, which can flexibly adapt to different security level scenarios and user needs. It takes into account both the mandatory secondary verification in high-security scenarios and the convenient login experience of one-time verification in ordinary scenarios, thus enhancing the configurability and applicability of the authentication method.
[0026] During the login phase, a time-based one-time password (TOTP) dynamic password is introduced as a secondary verification. A layered architecture is adopted, consisting of a static password as the primary verification and a TOTP offline dynamic password as the secondary verification. On the one hand, the time-based dynamic password effectively resists replay attacks and credential leakage risks; on the other hand, the offline verification mechanism ensures authentication continuity in scenarios with limited network access or unavailable external services, improving the robustness and reliability of the authentication method. The entire authentication method achieves high-security two-factor authentication capabilities purely in software without additional hardware investment, reducing deployment and maintenance costs. Simultaneously, the selective wake-up mechanism avoids unnecessary authentication steps, optimizing the user login experience and achieving an effective balance between security and availability.
[0027] In some embodiments of the present invention, in step S300, after the first-level verification passes, offline second-level verification based on the user's two-factor authentication switch status is selectively invoked, including but not limited to steps S301 to S303, as detailed in the following figures. Figure 2 As shown, S301: Obtain the user's two-factor authentication switch status; S302: When the two-factor authentication switch is on, users are forced to complete offline secondary verification based on the TOTP time-dynamic password when logging in; S303: When the two-factor authentication switch is off, the user can directly create session credentials and log in after passing the first-level verification.
[0028] By acquiring the two-factor authentication switch status at the user level and implementing a selective wake-up mechanism, fine-grained dynamic control of security policies is achieved. When the two-factor authentication switch is enabled, mandatory supplementary TOTP offline secondary verification is enforced, effectively blocking the risk of unauthorized access caused by static password leakage and significantly improving the protection level of accounts with high security requirements. When the two-factor authentication switch is disabled, users who have passed the primary verification are directly allowed access, avoiding redundant authentication steps in low-risk scenarios and reducing the user's operational burden and system authentication overhead. This mechanism achieves on-demand adaptation of security and convenience within a unified authentication framework, satisfying the differentiated security strength needs of different user groups, while optimizing the response efficiency and user experience of the login process through conditional triggering strategies, enhancing the system's flexibility and scalability. In some embodiments of the present invention, in step S300, the offline secondary verification includes, but is not limited to, steps S310 to S320, specifically: S310: If the two-factor authentication switch is on, the server retrieves the user's bound TOKEN key; S320: Relying on the server's local clock, it independently calculates the standard dynamic password and performs a two-way consistency comparison and authentication with the dynamic password generated locally on the mobile device submitted by the user.
[0029] The server independently calculates the dynamic password based on its local clock and performs a two-way consistency comparison with the mobile port password, achieving a completely offline TOTP authentication closed loop. This eliminates the need for external network connections or reliance on third-party time services. By leveraging the securely stored TOKEN key and independent clock source on the server, the autonomous controllability of dynamic password generation and verification is ensured. The two-way comparison strategy effectively eliminates single-point calculation errors, improving the accuracy and reliability of authentication results. Simultaneously, the one-time dynamic password feature based on a time window fundamentally blocks replay attacks and credential theft risks, significantly enhancing the system's authentication continuity and robustness in weak network or offline environments while maintaining high security.
[0030] Reference Figure 3 As shown, Figure 3 This is a detailed flowchart of step S100 in the multi-factor authentication method based on a cloud application platform provided in this embodiment of the invention. Step S100 includes, but is not limited to, steps S110 to S130. Specifically, S110: When creating a new user on the platform side, the key generation interface is automatically called to generate a globally unique encrypted TOKEN key through a secure random number algorithm. The encrypted TOKEN key is stored in the platform's local database after being symmetrically encrypted, and plaintext echoing from the front end is prohibited throughout the process. S120: Concatenates standard otpauth: / / totp protocol links, fully encapsulates the user's account name, encryption key, dynamic code refresh cycle and hash algorithm parameters, converts the protocol link into a visual QR code image and returns it to the front end for display; S130: After scanning the QR code to complete key synchronization, the universal mobile TOTP authenticator enters the current dynamic verification code on the platform-side binding confirmation page. The server independently verifies the verification code based on the local clock. Once the verification is successful, the binding is complete.
[0031] The key generation process is automatically triggered when a new user is created. A globally unique encrypted token key is generated using a secure random number algorithm, achieving automation and standardization of key creation and eliminating the weak randomness and duplication risks associated with manual configuration. The key is securely stored in the platform's local database after symmetric encryption, and plaintext display on the front end is strictly prohibited, constructing a closed-loop protection mechanism for the entire key lifecycle and effectively reducing the risk of leakage during transmission and display. By concatenating a standard otpauth: / / totp protocol link and encapsulating complete account, key, refresh cycle, and hash algorithm parameters, the generated QR code is compatible with mainstream TOTP authenticators. Cross-platform key synchronization can be achieved without developing a dedicated client, significantly improving the solution's versatility and ease of deployment.
[0032] The binding confirmation phase relies on the server's local clock to independently verify the dynamic verification code entered by the user. Bidirectional consistency verification can be completed in a completely offline environment, which not only ensures the accuracy of key synchronization, but also avoids dependence on external networks or third-party authentication services. This enhances the availability and self-controllability of the authentication method in isolated network scenarios, and organically combines high-security key management with low-threshold user operation, achieving an effective balance between security and ease of use.
[0033] In some embodiments of the present invention, after automatically generating a globally unique encrypted token key for the user on the platform side, the method further includes: The TOKEN key is encrypted using the AES-256 symmetric encryption algorithm and then stored in the database; the encryption master key is independently managed. The backend interface returns data that does not contain the plaintext TOKEN key. It is only encoded into the QR code image in the form of otpauth: / / URI when the QR code is generated, and the QR code image data is returned.
[0034] Understandably, employing the AES-256 high-strength symmetric encryption algorithm for static storage protection of the token key, coupled with an independent escrow mechanism for the encrypted master key, achieves hierarchical isolation and least privilege management of the key, effectively mitigating the risk of key leakage due to database breaches and unauthorized internal access. The backend interface strictly blocks the return of the plaintext token key, only transmitting it once via otpauth: / / URI in the image data during QR code generation, significantly reducing the network transmission exposure of sensitive information and the risk of front-end retention. This design ensures high-security key storage while also considering the convenience of the binding process and protocol compatibility, forming a comprehensive security protection system from generation, encryption, storage to transmission.
[0035] In some embodiments of the present invention, the dynamic password is calculated independently based on the TOTP algorithm, as shown in the reference. Figure 4 As shown, the method for calculating the dynamic password includes, but is not limited to, steps S320 to S324. Specifically, S320: Divide the current Unix seconds in Coordinated Universal Time by 30 seconds and round down to obtain an integer time counter; S321: Convert the time counter to an 8-byte big-endian integer, use the user's unique TOKEN key as the key, perform HMAC-SHA1 operation on it, and obtain a 20-byte digest; S322: Take the lower four bits of the last byte of the 20-byte digest as the offset, take four consecutive bytes from the position indicated by the offset and concatenate them into an integer, and remove its highest sign bit to obtain a 31-bit positive integer; S323: Take the remainder of the 31-bit positive integer divided by one million and pad with zeros to a total of 6 bits to obtain the final dynamic password; S324: Generate dynamic verification codes based on the final dynamic password.
[0036] The dynamic password calculation method follows international standards to construct the TOTP dynamic password generation logic. A time counter is obtained by rounding the standard Coordinated Universal Time (UTC) seconds (Unix seconds) into a 30-second time window, ensuring the time synchronization accuracy between the server and mobile device and the timeliness of the password. After converting the time counter into an 8-byte big-endian integer, an HMAC-SHA1 operation is performed using the user's unique token key to achieve a strong cryptographic binding between the time factor and the key, effectively guaranteeing the integrity and tamper resistance of the generation process. A dynamic truncation algorithm is employed, using the lower four bits of the last byte of the digest as a random offset to continuously truncate 4 bytes, concatenate them into an integer, and then remove the highest sign bit to obtain a 31-bit positive integer. This eliminates the compression of the numerical space by the sign bit and enhances the unpredictability of the password through the dynamic offset mechanism. Finally, the modulo of one million is taken and zeros are padded to 6 bits, generating a short verification code that is easy for manual input while maintaining sufficient entropy, balancing security and usability. The entire calculation process is completed offline based on the local clock and pre-shared key, without the need for network interaction. The generated dynamic password has strict one-time and time sensitivity, which can effectively resist replay attacks and credential theft risks, and significantly improve the security and reliability of offline authentication scenarios.
[0037] In one specific embodiment, the method for calculating the dynamic password includes: The first step is time discretization: Divide the current Coordinated Universal Time (UTC) Unix seconds by 30 seconds and round down to obtain an integer time counter T. This effectively divides the continuously passing time into 30-second increments: within the same 30-second increment, the calculated time counter T remains the same regardless of the second position within that increment, thus keeping the dynamic CAPTCHA unchanged. Once the 30-second boundary is crossed, the time counter T automatically increments, and the dynamic CAPTCHA is refreshed. This is the mathematical basis for the 6-digit dynamic CAPTCHA's automatic refresh every 30 seconds and immediate expiration upon timeout.
[0038] The second step is keyed hashing: the time counter T is converted to an 8-byte big-endian integer, and then HMAC-SHA1 is performed on it using the user's unique TOKEN key as the key, resulting in a 20-byte digest. HMAC is a keyed message authentication algorithm. Without the TOKEN key, it is impossible to calculate the digest or deduce the key from the digest. Furthermore, hashing has an avalanche effect; even a change of only one unit in the time counter T will drastically alter the output digest, making it completely unpredictable. Therefore, even if an attacker intercepts several historical CAPTCHAs, they cannot predict the next CAPTCHA or recover the key.
[0039] The third step is dynamic truncation: The lower four bits of the last byte of the 20-byte digest are taken as an offset ranging from 0 to 15. Starting from this offset, four consecutive bytes are extracted and concatenated into an integer, with the highest sign bit removed, resulting in a 31-bit positive integer. "Dynamic" means that the starting position for truncation is not fixed but dynamically determined by the digest content itself, further enhancing the unpredictability of the output and preventing attackers from analyzing a fixed position over a long period.
[0040] The fourth step is to take the modulus and reduce the number of bits: take the remainder of the 31-bit integer obtained in the previous step when divided by one million (i.e., ten to the power of six), and get a decimal number of no more than six digits. Then, pad the left side with zeros to make it 6 digits, which is the final 6-digit dynamic verification code presented to the user.
[0041] The verification code entered by the user during login is generated by the mobile authenticator using the exact same algorithm described above. Upon receiving it, the server uses the same token key and reads its own local clock to calculate a time counter, independently calculating the expected verification code using the same four-step process. This code is then compared with the verification code submitted by the user. Only if the two match and are within the valid time window is the login successful.
[0042] In some embodiments of the present invention, step S300 includes, but is not limited to, steps S330 to S332, as described above. Figure 5 shown, specifically, S330: Both the server and mobile devices independently calculate dynamic passwords using the local clock as the time base. S331: The server simultaneously calculates the dynamic verification codes corresponding to the current time step, the previous time step, and the next time step. S332: The server adopts a clock tolerance mechanism with a preset time window before and after. When the dynamic verification code submitted by the user on the mobile terminal hits any one of the current time step, the previous time step, and the next time step, the offline secondary verification is determined to be successful.
[0043] In the offline two-level verification method, the server and mobile device independently calculate the dynamic password offline based on their local clocks, completely eliminating the reliance on network time synchronization services and ensuring authentication availability in weak or no network environments. The server employs a clock tolerance mechanism with two preset time windows, simultaneously calculating three dynamic verification codes corresponding to the current, previous, and next time steps. Verification is considered successful as long as the user's submitted value matches any one of these codes. This mechanism effectively compensates for potential clock drift errors between the mobile device and the server, significantly reducing the authentication failure rate caused by device time discrepancies. While maintaining the high security strength of the TOTP time-based dynamic password, it greatly improves the login success rate and user experience. By extending the verification window to achieve fault-tolerant verification, the one-time replay protection of the dynamic password is not weakened, while the robustness and adaptability of the system in complex deployment environments are enhanced.
[0044] In one embodiment, the preset time window is 30 seconds. The 6-digit dynamic verification code is automatically refreshed every 30 seconds and expires immediately after the timeout. Attackers cannot reuse historical verification codes to complete replay login. This is suitable for high-risk access scenarios such as public network access to cloud management platforms and cross-network segment operation and maintenance.
[0045] In this embodiment of the invention, it can be further stipulated that verification codes successfully used within the same time frame cannot be used again, thereby completely preventing replay logins within the same time window. If the clock tolerance range of the preset time window is exceeded, the server returns a prompt indicating that the verification code is incorrect or the clock deviation is too large, guiding the user to calibrate the device time or rescan the code for binding.
[0046] The entire dynamic verification code calculation requires only two inputs: the user's unique token and the current standard time. The former is statically stored by both the server and the mobile device after a one-time scan synchronization during the binding phase and is not transmitted again; the latter is obtained by both devices reading their local clocks. Since Coordinated Universal Time (UTC) is a globally unified objective standard, it is naturally consistent without requiring network synchronization. Therefore, the generation and verification of the dynamic verification code do not rely on any network interaction, do not require the server to issue verification codes, and do not call any third-party network services. The server and the mobile device can independently calculate codes and complete local comparisons without establishing a network connection. This is the core difference between this invention and traditional two-factor schemes such as SMS verification codes and network push notifications, enabling its stable implementation in physically isolated intranet environments without internet access.
[0047] In some embodiments of the present invention, the multi-factor authentication method based on a cloud application platform further includes, but is not limited to, steps S400 to S410. Specifically, S400: If offline secondary verification fails, a layered differentiation error message will be returned; S420: For different fault types such as password error, dynamic password mismatch, dynamic password timeout, key failure, or local clock deviation exceeding the tolerance range, the corresponding standardized error code and repair guidance information are returned respectively.
[0048] By employing a layered and differentiated error message mechanism, accurate identification and targeted feedback of fault types are achieved, avoiding the low troubleshooting efficiency and degraded user experience caused by traditional vague error reports. For different fault scenarios such as incorrect passwords, mismatched dynamic passwords, timeouts, expired keys, and local clock deviations exceeding tolerance, standardized error codes and corresponding repair instructions are returned. This allows the server to accurately record the root cause of the anomaly, facilitating operation and maintenance auditing and problem tracing. Simultaneously, it guides users to perform targeted repair operations according to the fault type, such as re-entering the password, synchronizing the device time, or rebinding the key, significantly reducing manual intervention costs and false alarm handling overhead. This design, while ensuring authentication security, improves system maintainability, diagnosability, and user self-troubleshooting capabilities through transparent, layered error information delivery.
[0049] In some embodiments of the present invention, the multi-factor authentication method based on a cloud application platform further includes: In response to the administrator's one-click reset command, the user's original TOKEN key is immediately destroyed and a new encrypted TOKEN key is regenerated. The corresponding binding QR code is refreshed simultaneously, and the original QR code becomes invalid immediately.
[0050] This mechanism enables second-level emergency key rotation, allowing key reset without deleting and rebuilding user accounts, significantly reducing the complexity of operation and maintenance. Old keys are destroyed immediately and old QR codes are invalidated simultaneously, compressing the window of opportunity for key leakage from a time perspective and effectively blocking unauthorized logins in scenarios such as departing employees or accidental key leaks. At the same time, the entire reset process is traceable, meeting the requirements for security auditing and behavior tracing in an intranet operation and maintenance environment, and balancing the timeliness of emergency response with the rigor of security compliance.
[0051] The multi-factor authentication method based on cloud application platforms also includes a local audit mechanism: it fully records every login behavior, password verification result, dynamic password verification result and key reset operation log, and all logs are retained locally, supporting offline audit traceability in intranet environments.
[0052] In this invention, all logs are stored locally without needing to be uploaded to any external system, perfectly adapting to the deployment constraints of classified internal networks without an internet connection. This mechanism provides accurate behavioral credentials for post-incident investigations of security incidents, supports administrators in tracing the source and operation trajectory of unauthorized logins offline, effectively implements accountability, significantly improves operational transparency, and meets the compliance requirements for security audits at Level 3 and above of the Information Security Protection System.
[0053] Reference Figure 6 and Figure 7 As shown, a general embodiment of the multi-factor authentication method based on a cloud application platform provided by the present invention will be described.
[0054] Understandably, the cloud application platform manages cloud PCs. When an administrator logs into the cloud PC management platform and enters the backend user management page, a new operations and maintenance user is added. The system automatically calls the key generation module to randomly generate a unique, globally exclusive encrypted token key for that user. The key is stored in encrypted form in the backend and is prohibited from being displayed in plaintext on the frontend. For operations and maintenance users, the administrator can enable or disable the two-factor authentication switch as needed. When the two-factor authentication switch is disabled, the user can log in directly with just their username and password. When the two-factor authentication switch is enabled, subsequent logins are required to supplement with a dynamic password for secondary verification.
[0055] After enabling two-factor authentication, administrators can click to view the binding QR code. Based on the OTPAUth standard URI format, the username, key, algorithm, and refresh cycle information are encapsulated to generate a compliant binding QR code. One-click reset of the token key is supported in the backend. After reset, the original QR code immediately becomes invalid, requiring the user to scan the code again to complete the mobile binding. Maintenance users can scan the QR code using a general mobile authenticator to automatically synchronize the key information. Then, on the platform's binding confirmation page, the current dynamic verification code is entered. After the platform verifies the code and confirms its consistency, a message indicates successful binding, officially enabling two-factor login capability.
[0056] The entire two-factor authentication login process includes: The operations and maintenance user accesses the unified login page of the cloud PC management platform, enters their username and static password, and submits a login request; the platform performs the first layer of verification, comparing the username and password information stored in the database. If the password is incorrect, a login failure message is returned, and the process terminates; after successful password verification, the platform checks the user's two-factor authentication status. If the two-factor authentication is off, the platform directly creates a valid session and redirects the user to the management platform homepage without secondary verification; if the two-factor authentication is on, the platform displays a dynamic verification code input pop-up, waiting for the operations and maintenance user to submit a dynamic password generated on their mobile device. The operations and maintenance user then opens the authenticator app bound to their mobile device to obtain the password. The system displays a 6-digit dynamic verification code valid for 30 seconds. The operations and maintenance user enters the dynamic verification code in the pop-up window and submits it. The platform server retrieves the user's bound token key and independently calculates the standard dynamic password using the server's local clock. This calculation is compatible with both the preceding and following time windows, offsetting minor local clock discrepancies between the mobile phone and the server. No external time or authentication service requests are required throughout the process. The system also verifies that the password is within the valid time window. If the verification matches and the password has not expired, the two-factor authentication is successful, a session token is issued, and the user is redirected to the management platform homepage. If the verification fails or the password expires, a corresponding error message is returned, allowing the operations and maintenance user to re-enter the verification code or return to the login homepage to retry.
[0057] This invention also provides a multi-factor authentication system based on a cloud-based application platform, used to execute the multi-factor authentication method based on a cloud-based application platform as described in the above embodiments, comprising: The user key generation module is used to automatically generate a globally unique encrypted token key for the user on the platform side during the key binding stage. The QR code generation and distribution module is used to generate binding QR codes based on the standard OTPAUTH protocol, which can be scanned by mobile verifiers to complete key synchronization and binding, without the need to connect to external networks or third-party authentication services throughout the process. The two-factor switch control module is used to independently configure a two-factor authentication switch for each user on the platform side, so as to support the individual activation and deactivation of secondary authentication for each user. The layered login verification module is used to perform a first-level verification of the validity of the static account password during the login authentication phase. After the first-level verification passes, it selectively invokes an offline second-level verification based on the user's two-factor authentication switch status and the TOTP time-dynamic password. If the offline second-level verification passes, a session credential is issued to complete the login.
[0058] This invention presents a multi-factor authentication system based on a cloud-based application platform. Through the collaborative operation of a user key generation module, a QR code generation and distribution module, a two-factor switch control module, and a hierarchical login verification module, a closed-loop authentication system covering the entire user lifecycle is formed. Each module is decoupled and operates independently. Automatic key generation and standardized QR code distribution enable seamless, zero-cost binding on mobile devices. Independent user-level switches meet the hierarchical access management needs of multi-level maintenance personnel, and two-level serial verification logic effectively intercepts unauthorized logins. The entire system, from user creation to login authentication, operates offline using a local clock and local database, requiring no internet interaction. It perfectly adapts to intranet isolation deployment scenarios, significantly improving the security level of cloud-based application platform account logins without relying on external services. It boasts the triple advantages of high security, flexible control, and low-cost deployment.
[0059] It should be understood that the method steps in the embodiments of the present invention can be implemented or carried out by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable storage medium. The method can use standard programming techniques. Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system. However, if necessary, the program can be implemented in assembly or machine language. In any case, the language can be a compiled or interpreted language. Furthermore, for this purpose, the program can run on a programmed application-specific integrated circuit (ASIC).
[0060] Furthermore, the procedures described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by the context. The procedures described herein (or variations and / or combinations thereof) may be executed under the control of one or more computer systems configured with executable instructions, and may be implemented by hardware or a combination thereof as code (e.g., executable instructions, one or more computer programs, or one or more applications) that commonly executes on one or more processors. The computer program comprises a plurality of instructions executable by one or more processors.
[0061] Furthermore, the method can be implemented in any suitable type of computing platform, including but not limited to personal computers, minicomputers, mainframes, workstations, networked or distributed computing environments, standalone or integrated computer platforms, or in communication with charged particle tools or other imaging devices, etc. Aspects of the invention can be implemented as machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, optical read and / or write storage medium, RAM, ROM, etc., such that it is readable by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the processes described herein. Furthermore, the machine-readable code, or portions thereof, can be transmitted via wired or wireless networks. The invention described herein includes these and other different types of non-transitory computer-readable storage media when such media comprises instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. When programmed according to the methods and techniques described in the invention, the invention may also include the computer itself.
[0062] A computer program can be applied to input data to perform the functions described herein, thereby transforming the input data to generate output data stored in non-volatile memory. The output information can also be applied to one or more output devices, such as a display. In a preferred embodiment of the invention, the transformed data represents physical and tangible objects, including specific visual depictions of physical and tangible objects generated on the display.
[0063] The above description is merely a preferred embodiment of the present invention. The present invention is not limited to the above-described embodiments. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention, as long as they achieve the technical effects of the present invention by the same means, should be included within the scope of protection of the present invention. Within the scope of protection of the present invention, the technical solutions and / or implementation methods can have various modifications and variations.
Claims
1. A multi-factor authentication method based on a cloud-based application platform, characterized in that, include: During the key binding phase, the platform automatically generates a globally unique encrypted TOKEN key for the user and generates a binding QR code based on the standard OTPAUTH protocol, which is then scanned by the mobile authenticator to complete key synchronization and binding. The entire process does not require connection to an external network or third-party authentication service. On the platform side, a two-factor authentication switch is configured independently for each user to support individual activation and deactivation of secondary authentication on a user-by-user basis; During the login authentication phase, a first-level verification of the validity of the static account password is performed. After the first-level verification passes, the offline second-level verification based on the user's two-factor authentication switch status is selectively invoked. If the offline second-level verification passes, a session credential is issued to complete the login.
2. The multi-factor authentication method based on a cloud-based application platform according to claim 1, characterized in that, The offline secondary verification includes: If the two-factor authentication switch is on, the server retrieves the user's bound TOKEN key; The system independently calculates the standard dynamic password based on the server's local clock and performs a two-way consistency comparison and authentication with the dynamic password generated locally on the user's mobile device.
3. The multi-factor authentication method based on a cloud-based application platform according to claim 1, characterized in that, During the key binding phase, the platform automatically generates a globally unique encrypted token key for the user and generates a binding QR code based on the standard OTPAUTH protocol. This QR code is then scanned by the mobile authenticator to complete key synchronization and binding, including: When creating a new user on the platform, the key generation interface is automatically called to generate a globally unique encrypted TOKEN key through a secure random number algorithm. The encrypted TOKEN key is stored in the platform's local database after being symmetrically encrypted, and plaintext echoing from the front end is prohibited throughout the process. Concatenate the standard otpauth: / / totp protocol link, fully encapsulate the user's account name, encryption key, dynamic code refresh cycle and hash algorithm parameters, convert the protocol link into a visual QR code image and return it to the front end for display; After the universal mobile TOTP authenticator scans the QR code to complete key synchronization, the user enters the current dynamic verification code on the platform's binding confirmation page. The server independently verifies the verification code based on the local clock. Once the verification matches, the binding is successful.
4. The multi-factor authentication method based on a cloud-based application platform according to claim 2, characterized in that, The dynamic password is calculated independently based on the TOTP algorithm, and the calculation method includes: Divide the current Unix seconds in Coordinated Universal Time by 30 seconds and round down to obtain an integer time counter. The time counter is converted into an 8-byte big-endian integer, and HMAC-SHA1 operation is performed on it using the user's unique TOKEN key as the key to obtain a 20-byte digest. Take the lower four bits of the last byte of the 20-byte digest as the offset, take four bytes consecutively from the position indicated by the offset and concatenate them into an integer, and remove its highest sign bit to obtain a 31-bit positive integer. The 31-bit positive integer is divided by one million, and the remainder is padded with zeros to a total of 6 bits to obtain the final dynamic password; A dynamic verification code is generated based on the final dynamic password.
5. The multi-factor authentication method based on a cloud-based application platform according to claim 4, characterized in that, Also includes: Both the server and the mobile device independently calculate the dynamic password using the local clock as the time base. The server simultaneously calculates the dynamic verification codes corresponding to the current time step, the previous time step, and the next time step. The server adopts a clock tolerance mechanism with a preset time window before and after. When the dynamic verification code submitted by the user on the mobile terminal hits any one of the current time step, the previous time step, and the next time step, the offline secondary verification is determined to be successful.
6. The multi-factor authentication method based on a cloud-based application platform according to claim 1, characterized in that, Also includes: If the offline secondary verification fails, a hierarchical differential error message will be returned; For different fault types, such as incorrect password, mismatched dynamic password, expired dynamic password, invalid key, or local clock deviation exceeding the tolerance range, the system returns the corresponding standardized error code and repair guidance information.
7. The multi-factor authentication method based on a cloud-based application platform according to claim 1, characterized in that, Also includes: The TOKEN key is encrypted using the AES-256 symmetric encryption algorithm and then stored in the database; the encryption master key is independently managed. The backend interface returns data that does not contain the plaintext TOKEN key. It is only encoded into the QR code image in the form of otpauth: / / URI when the QR code is generated, and the QR code image data is returned.
8. The multi-factor authentication method based on a cloud-based application platform according to claim 1, characterized in that, After the first-level verification passes, the offline second-level verification based on the user's two-factor authentication switch status is selectively invoked, including: Obtain the user's two-factor authentication switch status; When the two-factor authentication switch is turned on, users are forced to complete offline secondary verification based on TOTP time-dynamic password when logging in; When the two-factor authentication switch is off, the user can directly create session credentials and log in after passing the first-level verification.
9. A multi-factor authentication system based on a cloud-based application platform, used to execute the multi-factor authentication method based on a cloud-based application platform as described in any one of claims 1 to 8, characterized in that, include: The user key generation module is used to automatically generate a globally unique encrypted token key for the user on the platform side during the key binding stage. The QR code generation and distribution module is used to generate binding QR codes based on the standard OTPAUTH protocol, which can be scanned by mobile verifiers to complete key synchronization and binding, without the need to connect to external networks or third-party authentication services throughout the process. The two-factor switch control module is used to independently configure a two-factor authentication switch for each user on the platform side, so as to support the individual activation and deactivation of secondary authentication for each user. The layered login verification module is used to first perform a first-level verification of the validity of the static account password during the login authentication phase. After the first-level verification passes, it selectively invokes an offline second-level verification based on the user's two-factor authentication switch status and the TOTP time-dynamic password. If the offline second-level verification passes, a session credential is issued to complete the login.
10. A computer device comprising a memory and a processor, characterized in that, When the processor executes a computer program stored in the memory, it performs the method as described in any one of claims 1 to 8.
