• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Two-Factor Authentication (2FA) in Delphi with TMS Sphinx

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,486
Баллы
155
In today's digital landscape, ensuring robust security for user data is paramount.

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

is a comprehensive framework tailored for Delphi developers, providing powerful tools for managing user authentication and authorization seamlessly. Whether you're building a new application or enhancing an existing one, TMS Sphinx equips you with the essential components to secure user interactions effectively.

Introducing Two-Factor Authentication (2FA) in TMS Sphinx


We are excited to announce that TMS Sphinx now supports

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

, a critical feature designed to fortify your application's security. This blog post delves into the importance of 2FA, how it works, and guides you through implementing it using TMS Sphinx.

What is Two-Factor Authentication (2FA)?


Two-Factor Authentication (2FA) is an advanced security process that requires users to verify their identity through two distinct factors: something they know (a password) and something they have (a

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

). This extra layer of protection ensures that even if a user's password is compromised, unauthorized access is still prevented.

Many of you might be familiar with 2FA through services like

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

, which generates a unique TOTP every 30 seconds. This code, in combination with the user's password, is required to log in, significantly reducing the risk of account breaches.

Why Use Two-Factor Authentication?

  1. Enhanced Security: 2FA adds an additional layer of security, making it significantly harder for unauthorized users to gain access to accounts.
  2. Protection Against Phishing: Even if a user's password is stolen, the attacker would still need the TOTP, which they wouldn't have access to.
  3. User Trust: Implementing 2FA shows your commitment to protecting user data, thereby increasing user trust and confidence in your application.
  4. Regulatory Compliance: Many regulations and standards now recommend or require 2FA for sensitive data access, ensuring your application complies with industry standards.
Enabling 2FA for Users in TMS Sphinx


Implementing 2FA in TMS Sphinx is straightforward and can be done in a few steps. Here's how you can enable it for your users:


  1. Retrieve the User Context:


    var
    Context: ISphinxContext;
    begin
    Context := SphinxServer1.CreateContext;
    end;




  2. Enable Two-Factor Authentication for the User:

    var
    User: TUser;
    AuthenticatorKey: string;
    begin
    User := Context.UserManager.FindByName('username');
    if User = nil then
    raise Exception.Create('User not found');

    User.TwoFactorEnabled := True;
    Context.UserManager.UpdateUser(User);

    if Context.UserManager.GetAuthenticatorKey(User) = '' then
    Context.UserManager.ResetAuthenticatorKey(User);

    AuthenticatorKey := Context.UserManager.GetAuthenticatorKey(User);
    Log('Two-factor QR code URI: ' + TOtpUri.Build(AuthenticatorKey, 'YourApp', User.UserName));
    end;

  3. Generate and Share the QR Code: Provide the generated QR code URI to your users for scanning with their authenticator app.
How the QR Code URI Works


The

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

simplifies the process of setting up 2FA for users. When you generate a QR code using the URI, it encapsulates all the necessary information (such as the secret key, the account name, and the issuer) required by the authenticator app to generate TOTPs. Here’s how you can generate and use the QR code:

  • Generate the QR Code URI: The TOtpUri.Build method constructs a URI containing the secret key and other details.
  • Share the QR Code: This URI is then encoded into a QR code, which the user can scan with their authenticator app (like Google Authenticator or Authy).

When the user scans the QR code with their app, the app automatically configures itself with the necessary information to start generating TOTPs for that account. This means users don’t have to manually enter the secret key, reducing the risk of errors and making the setup process quick and user-friendly.

The 2FA Login Experience


Once 2FA is enabled, the user’s login experience will involve an additional step. After entering their password, users will be prompted to enter the TOTP generated by their authenticator app. This ensures that even if a password is compromised, unauthorized access is thwarted by the requirement of the second authentication factor.

TMS Software Delphi  Components





Conclusion


Integrating Two-Factor Authentication with TMS Sphinx elevates the security of your applications by adding an essential layer of verification. This not only protects against unauthorized access but also enhances user trust and compliance with industry standards.

We encourage you to explore the full capabilities of TMS Sphinx. Implement 2FA today and take a significant step towards securing your applications. For more details, refer to our

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

and download the

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

to get started.

Secure your applications with TMS Sphinx and ensure the highest level of protection for your users’ data.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу