Umbracoの2要素認証をSMS経由のOTPで設定する
概要
Umbraco 二要素認証 (2FA) は、SMS によるワンタイム パスコード (OTP) 認証を有効にすることで、 Umbraco アプリケーションへのログインにセキュリティ層を追加します。ユーザーが正しいユーザー名とパスワードを入力すると、登録済みの携帯電話番号に有効期限付きのワンタイム パスコード (OTP) が送信されます。SMSによる OTP 認証は、フィッシング、ブルートフォース攻撃、不正アクセスからユーザー アカウントを保護する信頼性の高い二要素認証方法です。このプラグインは、Google Authenticator、Microsoft Authenticator、Duo Authenticator、およびメールによる OTP 認証などの方法もサポートしています。
2FAを設定するUmbracoのバージョンを選択してください。
前提条件: ダウンロードとインストール
- Umbracoの二要素認証(2FA)プラグインをダウンロードしてください。
- Umbraco 2FAプラグインを設定するには、以下の名前空間、サービス、ミドルウェアを プログラム.cs ファイル。以下にサンプル例を示します。
以下のハイライトされた部分のみを含めてください。 プログラム.cs アプリケーションのファイル。
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();
- 構成が完了したら、アプリケーションを実行します。
構成手順
UmbracoでSMS経由のワンタイムパスワード(OTP)を使用して二要素認証(2FA)を実装するためのステップバイステップガイド。
1. Umbraco 2FAプラグインダッシュボードにアクセスします。
- 統合後、ブラウザを開き、以下の URL でコネクタ ダッシュボードを参照します。
https://<umbraco-base-url>/tfa/configure
- 登録ページまたはログインページが表示された場合、miniOrange Umbraco 2FAミドルウェアがアプリケーションに正常に追加されています。
- アカウント登録するには、こちらをクリックしてください。 会員登録する Umbraco 2FAプラグインを設定するためのボタン。
- 登録が完了すると、登録したメールアドレスに試用ライセンス キーが送信されます。
- プラグインを有効にするには、次のいずれかの方法を実行してください。
- 入力する ライセンスキー 指定された入力フィールドに電子メールで受信されます。
OR
- ダウンロードしたライセンスファイルをアップロードしてください ライセンスキーをダウンロード ボタンを使用して ファイルを選択してください オプションを選択します。
- 次に、ボックスにチェックを入れます 「上記の条件を読みましたので、プラグインを有効化します。」、をクリックします ライセンス認証
- ライセンスの有効化が成功すると、以下のようにプラグインのダッシュボードが開きます。
2. OTP over SMS を構成する
- プラグインダッシュボードで、 構成 ボタンの下に SMS SMS経由でOTPを設定するためのカード。
- をクリックした後 構成すると、SMS経由のOTPダッシュボードが開きます。 構成、選択 ユーザー電話属性 ドロップダウンから電話番号を入力し、 OTPを取得する
- クリックした後、 OTPを取得する ボタンをクリックすると、入力した携帯電話番号にワンタイムパスコードが送信されます。受信したOTPを入力してください。
- 以下を行うには、 OTPを確認する ボタン。OTPの確認後、認証方法が設定され、エンドユーザーが利用できるようになります。
- エンドユーザーに対してこの方法を有効にするには、SMS 経由の OTP トグル ボタンをクリックします。
- 有効にします エンドユーザー向け2要素認証 トグルボタン。
- 管理者の 2FA を有効にするには、 管理者のみ トグル。
3. Umbraco ログイン ページで OTP over SMS をテストする
- Umbracoアプリケーションにログインしてください。
- ログイン後、エンドユーザーは 2FAの設定 画面。 クリック 横 SMS 経由の OTP.
- ポップアップに電話番号を入力してクリック OTPを送信する.
- 電話番号に送信されたOTPを入力してクリックしてください OTPを確認する.
注:これらの設定手順は、ユーザーの二要素認証(TFA)方式を設定するための1回限りの設定です。次回ユーザーがログインする際には、認証を完了するために「OTP検証」画面(以下の最後の手順)のみが表示されます。
- 次回ログイン時にOTPを入力してクリックしてください OTPを検証.
- ユーザーはUmbracoアプリケーションにログインします。
関連記事
ご返答ありがとうございます。 すぐにご連絡させていただきます。
何か問題が発生しました。 もう一度質問を送信してください
