Search Results :

×

Configure Umbraco 2FA using Microsoft Authenticator

Umbraco Two-Factor Authentication (2FA) adds an extra layer of security to your Umbraco application login by enabling Microsoft Authenticator. After users enter the correct username and password, they are required to enter a time-sensitive passcode generated by the Microsoft Authenticator app. Microsoft Authenticator is a reliable second-factor method that helps protect user accounts against phishing, brute-force attacks, and unauthorized access. The plugin also supports methods such as Google Authenticator, Duo Authenticator, OTP over SMS, and OTP over Email.

Select your umbraco version to configure 2FA with:
  • Download the Umbraco Two-Factor Authentication (2FA) plugin.
  • For setting up the Umbraco 2FA plugin, add the below namespaces, services and middleware in your program.cs file. Below here is a sample example.
    Include only the highlighted section below in the program.cs file of your application.

  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using System.Reflection;
  using miniorange.aspnet.tfa;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();

  app.UseSession();

  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseHttpsRedirection();

  app.MapWhen(
    context => context.Request.Path.StartsWithSegments("/TFA") ||
               context.Request.Path.StartsWithSegments("/Validate"),
    tfa =>
    {
      tfa.UseRouting();
      tfa.UseEndpoints(endpoints =>
      {
        endpoints.MapControllers();
      });
    });

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.EndpointRouteBuilder.MapControllers();

      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using miniorange.aspnet.tfa;
  using System.Reflection;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddDeliveryApi()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();
  app.UseSession();
  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.UseInstallerEndpoints();
      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  using System.Reflection;
  using miniorange.aspnet.tfa;

  WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

  builder.Services.AddDistributedMemoryCache();

  builder.Services.AddSession(options =>
  {
    options.IdleTimeout = TimeSpan.FromMinutes(60);
    options.Cookie.HttpOnly = true;
    options.Cookie.IsEssential = true;
  });

  builder.Services.AddminiOrangeServices(Assembly.GetExecutingAssembly());

  builder.CreateUmbracoBuilder()
    .AddBackOffice()
    .AddWebsite()
    .AddComposers()
    .Build();

  WebApplication app = builder.Build();

  await app.BootUmbracoAsync();

  app.UseSession();

  app.UseMiddleware<RedirectAfterLoginMiddleware>();
  app.UseStateCheck();

  app.UseHttpsRedirection();

  app.MapWhen(
    context => context.Request.Path.StartsWithSegments("/TFA") ||
               context.Request.Path.StartsWithSegments("/Validate"),
    tfa =>
    {
      tfa.UseRouting();
      tfa.UseEndpoints(endpoints =>
      {
        endpoints.MapControllers();
      });
    });

  app.UseUmbraco()
    .WithMiddleware(u =>
    {
      u.UseBackOffice();
      u.UseWebsite();
    })
    .WithEndpoints(u =>
    {
      u.EndpointRouteBuilder.MapControllers();

      u.UseBackOfficeEndpoints();
      u.UseWebsiteEndpoints();
    });

  await app.RunAsync();


  • Run the application when the configuration is done.

Step-by-step guide for implementing Two-Factor Authentication (2FA) in Umbraco using Microsoft Authenticator.

  • After integration, open your browser and browse the connector dashboard with the URL below:
 https://<umbraco-base-url>/tfa/configure
  • If the registration page or login page pops up, you have successfully added the miniOrange Umbraco 2FA middleware in your application.
Umbraco 2FA - Register with miniOrange

  • Register with your account by clicking the Register button to configure the Umbraco 2FA plugin.
  • After successful registration, you will receive a trial license key on your registered email address.
  • To activate the plugin, you can either:

    • Enter the license key received via email in the provided input field.

    OR

    • Upload the license file that you downloaded using the Download License Key button by using the Choose File option.
Umbraco 2FA - Activate License

  • Then, check the box "I have read the above conditions and I want to activate the plugin", and click the Activate License button.
Umbraco 2FA - Activate License button

  • After successful license activation, the plugin dashboard will open as shown below.
Umbraco 2FA - Plugin Dashboard
  • On the plugin dashboard, click the Configure button under the App Authenticator card to configure Microsoft Authenticator.
Umbraco 2FA - Configure App Authenticator

  • After clicking on Configure, the App Authenticator dashboard will open, showing Google Authenticator, Microsoft Authenticator, and Duo Authenticator methods.
Umbraco 2FA - App Authenticator dashboard

  • Click the Configure link beside the Microsoft Authenticator method.
Umbraco 2FA - Configure Microsoft Authenticator

  • To register your device, scan the QR code using the Microsoft Authenticator app or use the secret code.
  • After scanning the QR code, a six-digit token will be generated in the Microsoft Authenticator app. Enter the passcode and click the Validate button to verify.
Umbraco 2FA - Validate Microsoft Authenticator passcode

  • Once the Microsoft Authenticator method is configured, enable it for the end user by clicking the toggle button.
Umbraco 2FA - Microsoft Authenticator configured and active

  • Enable the 2FA for End Users toggle button.
Umbraco 2FA - Enable 2FA for End Users

  • To enable 2FA for admins, turn on the Admin Only toggle.
Umbraco 2FA - Admin Only toggle
  • Log in to your Umbraco application.
Umbraco 2FA - Umbraco login page

  • After login, end users see the Setup 2FA screen. Click Setup beside Microsoft Authenticator.
Umbraco 2FA - Setup 2FA methods

  • Scan the QR code using the Microsoft Authenticator app or enter the secret key manually. Then, enter the generated passcode.
Umbraco 2FA - End user scan QR code

  • After entering the passcode, click the Validate button to complete Microsoft Authenticator registration.
Umbraco 2FA - Validate generated passcode

Note: These configuration steps are a one-time setup for configuring the TFA method for the user. The next time the user logs in, they will only see the Validate screen (the last step below) to complete authentication.


  • On subsequent logins, enter the passcode generated by the Microsoft Authenticator app and click the Validate button.
Umbraco 2FA - Validate Microsoft Authenticator code on login

  • The user will be logged in to their Umbraco application.

 Thank you for your response. We will get back to you soon.

Something went wrong. Please submit your query again

We'll Reach Out to You at the Earliest!


ADFS_sso ×
Hello there!

Need Help? We are right here!

support