このチュートリアルでは、Windows Server 2012 R2 で AD FS のカスタム認証方法を実装する手順について説明します。 詳細については、「 追加の認証方法」を参照してください。
警告
ここで構築できる例は、教育目的のみです。 これらの手順は、モデルの必要な要素を公開できる最も単純で最小限の実装を目的としたものです。 認証バックエンド、エラー処理、または構成データはありません。
開発ボックスの設定
このチュートリアルでは、Visual Studio 2012 を使用します。 このプロジェクトは、Windows 用の .NET クラスを作成できる任意の開発環境を使用してビルドできます。 BeginAuthentication メソッドと TryEndAuthentication メソッドでは、.NET Framework バージョン 4.5 の一部である System.Security.Claims.Claim 型を使用するため、プロジェクトは .NET 4.5 をターゲットにする必要があります。 プロジェクトには 1 つの参照が必要です。
参照 dll | 格納されている場所 | 対象 |
---|---|---|
Microsoft.IdentityServer.Web.dll | dll は、AD FS がインストールされている Windows Server 2012 R2 サーバーの %windir%\ADFS にあります。 このDLLは開発用コンピューターにコピーし、プロジェクト内で明示的な参照を作成する必要があります。 |
IAuthenticationContext、IProofData などのインターフェイスの種類 |
プロバイダーを作成する
Visual Studio 2012 の場合: [ファイル]->[新規作成]->[プロジェクト] の順に選択します。
[クラス ライブラリ] を選択し、.NET 4.5 を対象にしていることを確認します。
AD FS がインストールされている Windows Server 2012 R2 サーバー %windir%\ADFS から Microsoft.IdentityServer.Web.dll のコピーを作成し、開発用コンピューターの Project フォルダーに貼り付けます。
ソリューション エクスプローラーで、[参照] と [参照の追加] を右クリックします。..
Microsoft.IdentityServer.Web.dll のローカルコピーを開いて、追加...
[ OK] を クリックして、新しい参照を確認します。
これで、プロバイダーに必要なすべての型を解決するように設定する必要があります。
新しいクラスをプロジェクトに追加します (プロジェクトを右クリックして [追加]...クラス...)次に示すように、 MyAdapter のような名前を付けます。
新しいファイル MyAdapter.csで、既存のコードを次のように置き換えます。
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Globalization; using System.IO; using System.Net; using System.Xml.Serialization; using Microsoft.IdentityServer.Web.Authentication.External; using Claim = System.Security.Claims.Claim; namespace MFAadapter { class MyAdapter : IAuthenticationAdapter { public IAuthenticationAdapterMetadata Metadata { //get { return new <instance of IAuthenticationAdapterMetadata derived class>; } } public IAdapterPresentation BeginAuthentication(Claim identityClaim, HttpListenerRequest request, IAuthenticationContext authContext) { //return new instance of IAdapterPresentationForm derived class } public bool IsAvailableForUser(Claim identityClaim, IAuthenticationContext authContext) { return true; //its all available for now } public void OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData) { //this is where AD FS passes us the config data, if such data was supplied at registration of the adapter } public void OnAuthenticationPipelineUnload() { } public IAdapterPresentation OnError(HttpListenerRequest request, ExternalAuthenticationException ex) { //return new instance of IAdapterPresentationForm derived class } public IAdapterPresentation TryEndAuthentication(IAuthenticationContext authContext, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims) { //return new instance of IAdapterPresentationForm derived class } } }
まだビルドする準備ができていません...さらに 2 つのインターフェイスがあります。
プロジェクトにさらに 2 つのクラスを追加します。1 つはメタデータ用、もう 1 つはプレゼンテーション フォーム用です。 これらは、上記のクラスと同じファイル内に追加できます。
class MyMetadata : IAuthenticationAdapterMetadata { } class MyPresentationForm : IAdapterPresentationForm { }
次に、それぞれに必要なメンバーを追加できます。まず、メタデータ (役に立つインライン コメントを含む)
class MyMetadata : IAuthenticationAdapterMetadata { //Returns the name of the provider that will be shown in the AD FS management UI (not visible to end users) public string AdminName { get { return "My Example MFA Adapter"; } } //Returns an array of strings containing URIs indicating the set of authentication methods implemented by the adapter /// AD FS requires that, if authentication is successful, the method actually employed will be returned by the /// final call to TryEndAuthentication(). If no authentication method is returned, or the method returned is not /// one of the methods listed in this property, the authentication attempt will fail. public virtual string[] AuthenticationMethods { get { return new[] { "http://example.com/myauthenticationmethod1", "http://example.com/myauthenticationmethod2" }; } } /// Returns an array indicating which languages are supported by the provider. AD FS uses this information /// to determine the best language\locale to display to the user. public int[] AvailableLcids { get { return new[] { new CultureInfo("en-us").LCID, new CultureInfo("fr").LCID}; } } /// Returns a Dictionary containing the set of localized friendly names of the provider, indexed by lcid. /// These Friendly Names are displayed in the "choice page" offered to the user when there is more than /// one secondary authentication provider available. public Dictionary<int, string> FriendlyNames { get { Dictionary<int, string> _friendlyNames = new Dictionary<int, string>(); _friendlyNames.Add(new CultureInfo("en-us").LCID, "Friendly name of My Example MFA Adapter for end users (en)"); _friendlyNames.Add(new CultureInfo("fr").LCID, "Friendly name translated to fr locale"); return _friendlyNames; } } /// Returns a Dictionary containing the set of localized descriptions (hover over help) of the provider, indexed by lcid. /// These descriptions are displayed in the "choice page" offered to the user when there is more than one /// secondary authentication provider available. public Dictionary<int, string> Descriptions { get { Dictionary<int, string> _descriptions = new Dictionary<int, string>(); _descriptions.Add(new CultureInfo("en-us").LCID, "Description of My Example MFA Adapter for end users (en)"); _descriptions.Add(new CultureInfo("fr").LCID, "Description translated to fr locale"); return _descriptions; } } /// Returns an array indicating the type of claim that the adapter uses to identify the user being authenticated. /// Note that although the property is an array, only the first element is currently used. /// MUST BE ONE OF THE FOLLOWING /// "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname" /// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" /// "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" /// "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid" public string[] IdentityClaims { get { return new[] { "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" }; } } //All external providers must return a value of "true" for this property. public bool RequiresIdentity { get { return true; } } }
これで、IAuthenticationAdapter で F12 (右クリック - 定義に移動) して、必要なインターフェイス メンバーのセットを表示できるようになります。
次に、これらの実装を実行できます。
クラスの内容全体を次のように置き換えます。
namespace MFAadapter { class MyAdapter : IAuthenticationAdapter { public IAuthenticationAdapterMetadata Metadata { //get { return new <instance of IAuthenticationAdapterMetadata derived class>; } } public IAdapterPresentation BeginAuthentication(Claim identityClaim, HttpListenerRequest request, IAuthenticationContext authContext) { //return new instance of IAdapterPresentationForm derived class } public bool IsAvailableForUser(Claim identityClaim, IAuthenticationContext authContext) { return true; //its all available for now } public void OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData) { //this is where AD FS passes us the config data, if such data was supplied at registration of the adapter } public void OnAuthenticationPipelineUnload() { } public IAdapterPresentation OnError(HttpListenerRequest request, ExternalAuthenticationException ex) { //return new instance of IAdapterPresentationForm derived class } public IAdapterPresentation TryEndAuthentication(IAuthenticationContext authContext, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims) { //return new instance of IAdapterPresentationForm derived class } } }
次に、プレゼンテーション フォームを次に示します。
class MyPresentationForm : IAdapterPresentationForm { /// Returns the HTML Form fragment that contains the adapter user interface. This data will be included in the web page that is presented /// to the cient. public string GetFormHtml(int lcid) { string htmlTemplate = Resources.FormPageHtml; //todo we will implement this return htmlTemplate; } /// Return any external resources, ie references to libraries etc., that should be included in /// the HEAD section of the presentation form html. public string GetFormPreRenderHtml(int lcid) { return null; } //returns the title string for the web page which presents the HTML form content to the end user public string GetPageTitle(int lcid) { return "MFA Adapter"; } }
上記の Resources.FormPageHtml 要素の 'todo' に注意してください。 1 分で修正できますが、最初に、新しく実装された型に基づいて、最終的に必要な return ステートメントを最初の MyAdapter クラスに追加します。 これを行うには、既存の IAuthenticationAdapter 実装に次のコードを追加します。
class MyAdapter : IAuthenticationAdapter { public IAuthenticationAdapterMetadata Metadata { //get { return new <instance of IAuthenticationAdapterMetadata derived class>; } get { return new MyMetadata(); } } public IAdapterPresentation BeginAuthentication(Claim identityClaim, HttpListenerRequest request, IAuthenticationContext authContext) { //return new instance of IAdapterPresentationForm derived class return new MyPresentationForm(); } public bool IsAvailableForUser(Claim identityClaim, IAuthenticationContext authContext) { return true; //its all available for now } public void OnAuthenticationPipelineLoad(IAuthenticationMethodConfigData configData) { //this is where AD FS passes us the config data, if such data was supplied at registration of the adapter } public void OnAuthenticationPipelineUnload() { } public IAdapterPresentation OnError(HttpListenerRequest request, ExternalAuthenticationException ex) { //return new instance of IAdapterPresentationForm derived class return new MyPresentationForm(); } public IAdapterPresentation TryEndAuthentication(IAuthenticationContext authContext, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims) { //return new instance of IAdapterPresentationForm derived class outgoingClaims = new Claim[0]; return new MyPresentationForm(); } }
次に、html フラグメントを含むリソース ファイルについて説明します。 次の内容を含む新しいテキスト ファイルをプロジェクト フォルダーに作成します。
<div id="loginArea"> <form method="post" id="loginForm" > <!-- These inputs are required by the presentation framework. Do not modify or remove --> <input id="authMethod" type="hidden" name="AuthMethod" value="%AuthMethod%" /> <input id="context" type="hidden" name="Context" value="%Context%" /> <!-- End inputs are required by the presentation framework. --> <p id="pageIntroductionText">This content is provided by the MFA sample adapter. Challenge inputs should be presented below.</p> <label for="challengeQuestionInput" class="block">Question text</label> <input id="challengeQuestionInput" name="ChallengeQuestionAnswer" type="text" value="" class="text" placeholder="Answer placeholder" /> <div id="submissionArea" class="submitMargin"> <input id="submitButton" type="submit" name="Submit" value="Submit" onclick="return AuthPage.submitAnswer()"/> </div> </form> <div id="intro" class="groupMargin"> <p id="supportEmail">Support information</p> </div> <script type="text/javascript" language="JavaScript"> //<![CDATA[ function AuthPage() { } AuthPage.submitAnswer = function () { return true; }; //]]> </script> </div>
次に、Project->Add Component... リソースファイルを選択し、ファイル名をリソースにし、追加をクリックします。
次に、 Resources.resx ファイル内で[ リソースの追加]を選択します。既存のファイルを追加します。 上記で保存したテキスト ファイル (html フラグメントを含む) に移動します。
GetFormHtml コードで、リソース ファイル (.resx ファイル) 名プレフィックスの後にリソース自体の名前が続く新しいリソースの名前が正しく解決されていることを確認します。
public string GetFormHtml(int lcid) { string htmlTemplate = Resources.MfaFormHtml; //Resxfilename.resourcename return htmlTemplate; }
これでビルドできるようになります。
アダプターをビルドする
アダプターは、Windows の GAC にインストールできる厳密な名前の .NET アセンブリに組み込む必要があります。 Visual Studio プロジェクトでこれを実現するには、次の手順を実行します。
ソリューション エクスプローラーでプロジェクト名を右クリックし、[ プロパティ] をクリックします。
[署名] タブで、[アセンブリに署名] をオンにし、[<] で >[New...] を選択します。キー ファイル名とパスワードを入力し、[OK] をクリックします。 次に、アセンブリに署名する がチェックされており、遅延サインのみ がチェックされていないことを確認します。 プロパティの [署名] ページは次のようになります。
次に、ソリューションをビルドします。
アダプターを AD FS テスト マシンにデプロイする
外部プロバイダーを AD FS によって呼び出すには、その前にシステムに登録する必要があります。 アダプター プロバイダーは、GAC へのインストールを含む必要なインストール操作を実行するインストーラーを提供する必要があり、インストーラーは AD FS での登録をサポートする必要があります。 これが行われなければ、管理者は以下の Windows PowerShell の手順を実行する必要があります。 これらの手順は、ラボでテストとデバッグを有効にするために使用できます。
テスト AD FS マシンを準備する
ファイルをコピーして GAC に追加します。
Windows Server 2012 R2 コンピューターまたは仮想マシンがあることを確認します。
AD FS 役割サービスをインストールし、少なくとも 1 つのノードでファームを構成します。
ラボ環境でフェデレーション サーバーを設定する詳細な手順については、 Windows Server 2012 R2 AD FS 展開ガイドを参照してください。
Gacutil.exe ツールをサーバーにコピーします。
Gacutil.exe は、Windows 8 コンピューター上の %homedrive%Program Files (x86)Microsoft SDKsWindowsv8.0AbinNETFX 4.0 Tools にあります。 gacutil.exe ファイル自体と、NETFX 4.0 Tools の場所の下にある 1033、 en-US、およびその他のローカライズされたリソース フォルダーが必要です。
プロバイダー ファイル (1 つ以上の厳密な名前で署名された .dll ファイル) を gacutil.exe と同じフォルダーの場所にコピーします (場所は便宜上の理由です)。
ファーム内の各 AD FS フェデレーション サーバーの GAC に .dll ファイルを追加します。
例: コマンド ライン ツールを使用して gac に dll を追加 GACutil.exe。
C:>.gacutil.exe /if .<yourdllname>.dll
GAC で結果のエントリを表示するには:
C:>.gacutil.exe /l <yourassemblyname>
AD FS にプロバイダーを登録する
上記の前提条件が満たされたら、フェデレーション サーバーで Windows PowerShell コマンド ウィンドウを開き、次のコマンドを入力します (Windows Internal Database を使用するフェデレーション サーバー ファームを使用している場合は、ファームのプライマリ フェデレーション サーバーでこれらのコマンドを実行する必要があります)。
Register-AdfsAuthenticationProvider –TypeName YourTypeName –Name “AnyNameYouWish” [–ConfigurationFilePath (optional)]
ここで、YourTypeName は .NET の厳密な型名です。"YourDefaultNamespace.YourIAuthenticationAdapterImplementationClassName, YourAssemblyName, Version=YourAssemblyVersion, Culture=neutral, PublicKeyToken=YourPublicKeyTokenValue, processorArchitecture=MSIL"
これにより、外部プロバイダーが AD FS に登録され、上記の AnyNameYouWish として指定した名前が付けられます。
(Windows サービス スナップインなどを使用して) AD FS サービスを再起動します。
次のコマンドを実行します:
Get-AdfsAuthenticationProvider
これにより、プロバイダーがシステム内のプロバイダーの 1 つとして表示されます。
例:
$typeName = "MFAadapter.MyAdapter, MFAadapter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e675eb33c62805a0, processorArchitecture=MSIL” Register-AdfsAuthenticationProvider -TypeName $typeName -Name “MyMFAAdapter” net stop adfssrv net start adfssrv
AD FS 環境でデバイス登録サービスを有効にしている場合は、次の PowerShell コマンドも実行します。
net start drs
登録済みプロバイダーを確認するには、次の PowerShell コマンドを使用します:
Get-AdfsAuthenticationProvider
。これにより、プロバイダーがシステム内のプロバイダーの 1 つとして表示されます。
アダプターを呼び出す AD FS 認証ポリシーを作成する
AD FS 管理スナップインを使用して認証ポリシーを作成する
AD FS 管理スナップインを開きます ([サーバー マネージャー ツール ] メニューから)。
[ 認証ポリシー] をクリックします。
中央のウィンドウの [Multi-Factor Authentication] で、[グローバル設定] の右側にある [編集] リンクをクリックします。
ページの下部にある [ 追加の認証方法の選択 ] で、プロバイダーの AdminName のチェック ボックスをオンにします。 [適用] をクリックします。
アダプターを使用して MFA を呼び出す "トリガー" を提供するには、[ 場所] で エクストラネット と イントラネットの両方を確認します。 OK をクリックします。 (証明書利用者ごとにトリガーを構成するには、以下の「Windows PowerShell を使用して認証ポリシーを作成する」を参照してください)。
次のコマンドを使用して結果を確認します。
最初に
Get-AdfsGlobalAuthenticationPolicy
を使用します。 プロバイダー名は、AdditionalAuthenticationProvider 値の 1 つとして表示されます。次に、
Get-AdfsAdditionalAuthenticationRule
を使用します。 管理者 UI でポリシーを選択した結果として構成されたエクストラネットとイントラネットの規則が表示されます。
Windows PowerShell を使用して認証ポリシーを作成する
まず、グローバル ポリシーでプロバイダーを有効にします。
Set-AdfsGlobalAuthenticationPolicy -AdditionalAuthenticationProvider “YourAuthProviderName”`
注
AdditionalAuthenticationProvider パラメーターに指定された値は、上記の Register-AdfsAuthenticationProvider コマンドレットの "Name" パラメーターおよび Get-AdfsAuthenticationProvider コマンドレット出力の "Name" プロパティとして指定した値に対応しています。
Set-AdfsGlobalAuthenticationPolicy –AdditionalAuthenticationProvider “MyMFAAdapter”`
次に、MFA をトリガーするようにグローバルまたは証明書利用者固有のルールを構成します。
例 1: 外部要求に MFA を要求するグローバル ルールを作成するには:
Set-AdfsAdditionalAuthenticationRule –AdditionalAuthenticationRules 'c:[type == "http://schemas.microsoft.com/ws/2012/01/insidecorporatenetwork", value == "false"] => issue(type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod", value = "http://schemas.microsoft.com/claims/multipleauthn" );'
例 2: 特定の証明書利用者への外部要求に対して MFA を要求する MFA ルールを作成する。 (注: 個々のプロバイダーは、Windows Server 2012 R2 の AD FS の個々の証明書利用者に接続できません)。
$rp = Get-AdfsRelyingPartyTrust –Name <Relying Party Name> Set-AdfsRelyingPartyTrust –TargetRelyingParty $rp –AdditionalAuthenticationRules 'c:[type == "http://schemas.microsoft.com/ws/2012/01/insidecorporatenetwork", value == "false"] => issue(type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod", value = "http://schemas.microsoft.com/claims/multipleauthn" );'
アダプターを使用して MFA で認証する
最後に、次の手順を実行してアダプターをテストします。
AD FS グローバル プライマリ認証の種類がエクストラネットとイントラネットの両方のフォーム認証として構成されていることを確認します (これにより、デモは特定のユーザーとして簡単に認証できます)。
AD FS スナップインの [認証ポリシー] の [プライマリ認証] 領域で、[グローバル設定] の横にある [編集] をクリックします。
- または、多要素ポリシー UI の [プライマリ] タブをクリックするだけです。
エクストラネットとイントラネットの両方の認証方法で、 フォーム認証 がチェックされている唯一のオプションであることを確認します。 OK をクリックします。
IDP によって開始されたサインオン html ページ (https://<fsname>/adfs/ls/idpinitiatedsignon.htm) を開き、テスト環境で有効な AD ユーザーとしてサインインします。
プライマリ認証の資格情報を入力します。
チャレンジの質問の例が表示された MFA フォーム ページが表示されます。
複数のアダプターが構成されている場合は、上記のフレンドリ名を含む MFA の選択ページが表示されます。
これで、インターフェイスの実用的な実装が作成され、モデルの動作に関する知識が得られます。 BeginAuthentication と TryEndAuthentication でブレークポイントを設定する追加の例として試すことができます。 ユーザーが最初に MFA フォームに入ったときに BeginAuthentication がどのように実行されるかに注目してください。一方、TryEndAuthentication はフォームの各送信でトリガーされます。
認証が成功するためにアダプターを更新する
しかし、待つ - あなたのサンプルアダプタは正常に認証されることはありません! これは、コード内に TryEndAuthentication の null が返されないためです。
上記の手順を完了することで、基本的なアダプター実装を作成し、AD FS サーバーに追加しました。 MFA フォーム ページは取得できますが、TryEndAuthentication 実装に正しいロジックをまだ配置していないため、まだ認証できません。 それでは、これを追加しましょう。
TryEndAuthentication の実装を思い出してください。
public IAdapterPresentation TryEndAuthentication(IAuthenticationContext authContext, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims)
{
//return new instance of IAdapterPresentationForm derived class
outgoingClaims = new Claim[0];
return new MyPresentationForm();
}
MyPresentationForm() が常に返されるとは限らないように更新しましょう。 このため、クラス内に 1 つの単純なユーティリティ メソッドを作成できます。
static bool ValidateProofData(IProofData proofData, IAuthenticationContext authContext)
{
if (proofData == null || proofData.Properties == null || !proofData.Properties.ContainsKey("ChallengeQuestionAnswer"))
{
throw new ExternalAuthenticationException("Error - no answer found", authContext);
}
if ((string)proofData.Properties["ChallengeQuestionAnswer"] == "adfabric")
{
return true;
}
else
{
return false;
}
}
次に、次のように TryEndAuthentication を更新します。
public IAdapterPresentation TryEndAuthentication(IAuthenticationContext authContext, IProofData proofData, HttpListenerRequest request, out Claim[] outgoingClaims)
{
outgoingClaims = new Claim[0];
if (ValidateProofData(proofData, authContext))
{
//authn complete - return authn method
outgoingClaims = new[]
{
// Return the required authentication method claim, indicating the particulate authentication method used.
new Claim( "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod", "http://example.com/myauthenticationmethod1" )
};
return null;
}
else
{
//authentication not complete - return new instance of IAdapterPresentationForm derived class
return new MyPresentationForm();
}
}
テスト ボックスでアダプターを更新する必要があります。 まず AD FS ポリシーを元に戻し、AD FS から登録を解除してから AD FS を再起動してから、GAC から .dll を削除してから、GAC に新しい .dll を追加してから、AD FS に登録し、AD FS を再起動して、AD FS ポリシーを再構成する必要があります。
更新されたアダプターをテスト AD FS マシンに展開して構成する
AD FS ポリシーをクリアする
以下に示すように、MFA UI のすべての MFA 関連のチェック ボックスをオフにし、[OK] をクリックします。
プロバイダーの登録解除 (Windows PowerShell)
PS C:> Unregister-AdfsAuthenticationProvider –Name “YourAuthProviderName”
例:PS C:> Unregister-AdfsAuthenticationProvider –Name “MyMFAAdapter”
"Name" に渡す値は、Register-AdfsAuthenticationProvider コマンドレットに指定した "Name" と同じ値です。 また、Get-AdfsAuthenticationProvider から出力される "Name" プロパティでもあります。
プロバイダーの登録を解除する前に、AdfsGlobalAuthenticationPolicy からプロバイダーを削除する必要があります (AD FS 管理スナップインでオンにしたチェック ボックスをオフにするか、Windows PowerShell を使用します)。
この操作の後、AD FS サービスを再起動する必要があります。
GAC からアセンブリを削除する
最初に、次のコマンドを使用して、エントリの完全修飾厳密な名前を検索します。
C:>.gacutil.exe /l <yourAdapterAssemblyName>
例:
C:>.gacutil.exe /l mfaadapter
次に、次のコマンドを使用して GAC から削除します。
.gacutil /u “<output from the above command>”
例:
C:>.gacutil /u “mfaadapter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e675eb33c62805a0, processorArchitecture=MSIL”
更新されたアセンブリを GAC に追加する
更新された .dll を最初にローカルに貼り付けてください。 C:>.gacutil.exe /if .MFAAdapter.dll
GAC でのアセンブリの表示 (コマンド ライン)
C:> .gacutil.exe /l mfaadapter
AD FS にプロバイダーを登録する
PS C:>$typeName = "MFAadapter.MyAdapter, MFAadapter, Version=1.0.0.1, Culture=neutral, PublicKeyToken=e675eb33c62805a0, processorArchitecture=MSIL”
PS C:>Register-AdfsAuthenticationProvider -TypeName $typeName -Name “MyMFAAdapter1”
AD FS サービスを再起動します。
AD FS 管理スナップインを使用して認証ポリシーを作成する
AD FS 管理スナップインを開きます ([サーバー マネージャー ツール ] メニューから)。
[ 認証ポリシー] をクリックします。
[Multi-Factor Authentication] で、[グローバル設定] の右側にある [編集] リンクをクリックします。
[ 追加の認証方法の選択] で、プロバイダーの AdminName のチェック ボックスをオンにします。 [適用] をクリックします。
アダプターを使用して MFA を呼び出す "トリガー" を提供するには、[場所] で エクストラネット と イントラネットの両方を確認します。 OK をクリックします。
アダプターを使用して MFA で認証する
最後に、次の手順を実行してアダプターをテストします。
AD FS グローバル プライマリ認証の種類がエクストラネットとイントラネットの両方の フォーム認証 として構成されていることを確認します (これにより、特定のユーザーとして簡単に認証できます)。
AD FS 管理スナップインの [認証ポリシー] の [プライマリ認証] 領域で、[グローバル設定] の横にある [編集] をクリックします。
- または、多要素ポリシー UI の [ プライマリ ] タブをクリックするだけです。
エクストラネットとイントラネットの両方の認証方法で、フォーム認証がチェックされている唯一のオプションであることを確認します。 OK をクリックします。
IDP によって開始されたサインオン html ページ (https://<fsname>/adfs/ls/idpinitiatedsignon.htm) を開き、テスト環境で有効な AD ユーザーとしてサインインします。
プライマリ認証の資格情報を入力します。
チャレンジ テキストの例が表示された MFA フォーム ページが表示されます。
- 複数のアダプターが構成されている場合は、フレンドリ名を含む MFA の選択ページが表示されます。
MFA 認証ページに adfabric を入力すると、正常にサインインしたことが表示されます。