Skip to content

An umbraco nuget package to setup two factor authentication

License

Notifications You must be signed in to change notification settings

garpunkal/punkTwoFactor

Repository files navigation

punkTwoFactor

NuGet release

A simple Umbraco package that uses the documented implementation from Umbraco https://our.umbraco.com/documentation/Reference/Security/two-factor-authentication/#two-factor-authentication-for-users and adds some additional tweaks.

Nuget

Install-Package punkTwoFactor

https://www.nuget.org/packages/punkTwoFactor/

Installation

Add the following section to your appsettings.json:

"punkTwoFactor": {
    "ProviderName": "Two Factor Authentication",
    "Issuer": "Two Factor Authentication - Dev",
    "BackOfficeView": "..\\App_Plugins\\punkTwoFactor\\twoFactorProviderGoogleAuthenticator.html"
  }

Add using statement:

using punkTwoFactor.Extensions;

Add the following code block within your ConfigureServices section above the Umbraco setup:

var twoFactorConfiguration = services.ConfigureTwoFactorConfig(_config);

Now add the "AddBackOfficeTwoFactorAuthentication" extension to the Umbraco setup.

services
    .AddUmbraco(_env, _config)
    .AddBackOffice()
    .AddWebsite()
    .AddComposers()
    .AddServices()
    .AddNotifications()               
    .AddBackOfficeTwoFactorAuthentication(twoFactorConfiguration)
    .Build();

Compatibility

  • Umbraco 10+