共用方式為


在 PAM 角色啟用期間或在 SSPR 中透過 API 使用自訂多重要素驗證提供者

MIM 客戶在 SSPR 和 PAM 案例中有兩個多重要素驗證的選項:

  • 使用自訂的單次密碼傳遞提供者,其僅適用於 MIM SSPR 案例,並記載於 Configure Self-Service Password Reset with OTP SMS Gate (使用 OTP SMS 閘道設定自助式密碼重設) 指南中
  • 使用自訂的多重要素驗證電話語音提供者。 這適用於本文所述的 MIM SSPR 和 PAM 案例

本文概述如何透過 API 和客戶開發的整合 SDK 以搭配使用 MIM 與自訂多重要素驗證提供者。

必要條件

若要搭配 MIM 使用自訂多重要素驗證提供者 API,您需要:

  • 所有候選使用者的電話號碼
  • MIM Hotfix 4.5.202.0 或更新版本 - 請參閱版本歷程記錄以取得相關公告
  • 為 SSPR 或 PAM 設定 MIM 服務

使用自訂多重要素驗證碼的方法

步驟 1:確定 MIM 服務為 4.5.202.0 版或更新版本

下載並安裝 MIM Hotfix 4.5.202.0 或更新版本。

步驟 2:建立 DLL 以實作 IPhoneServiceProvider 介面

DLL 必須包含類別,以實作下列三種方法:

  • InitiateCall:MIM 服務會叫用此方法。 服務會將電話號碼和要求識別碼作為參數傳遞。 此方法必須傳回 PendingSuccessFailedPhoneCallStatus 值。
  • GetCallStatus:如果先前對 initiateCall 的呼叫傳回 Pending,則 MIM 服務會叫用此方法。 這個方法也會傳回 PendingSuccessFailedPhoneCallStatus 值。
  • GetFailureMessage:如果先前對 InitiateCall 或是 GetCallStatus 的叫用傳回 Failed,則 MIM 服務會叫用此方法。 這個方法會傳回診斷訊息。

這些方法的實作必須是安全線程,此外,的 GetFailureMessageGetCallStatus 作也不得假設它們會由與先前呼叫 相同的執行緒呼叫 InitiateCall

將 DLL 儲存在 C:\Program Files\Microsoft Forefront Identity Manager\2010\Service\ 目錄中。

範例程式碼;您可以使用 Visual Studio 2010 或更新版本加以編譯。

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.IdentityManagement.PhoneServiceProvider;

namespace CustomPhoneGate
{
    public class CustomPhoneGate: IPhoneServiceProvider
    {
        string path = @"c:\Test\phone.txt";
        public PhoneCallStatus GetCallStatus(string callId)
        {
            int res = 2;
            foreach (string line in File.ReadAllLines(path))
            {
                var info = line.Split(new char[] { ';' });
                if (string.Compare(info[0], callId) == 0)
                {
                    if (info.Length > 2)
                    {
                        bool b = Int32.TryParse(info[2], out res);
                        if (!b)
                        {
                            res = 2;
                        }
                    }
                    break;
                }
            }
            switch(res)
            {
                case 0:
                    return PhoneCallStatus.Pending;
                case 1:
                    return PhoneCallStatus.Success;
                case 2:
                    return PhoneCallStatus.Failed;
                default:
                    return PhoneCallStatus.Failed;
            }       
        }
        public string GetFailureMessage(string callId)
        {
            string res = "Call ID is not found";
            foreach (string line in File.ReadAllLines(path))
            {
                var info = line.Split(new char[] { ';' });
                if (string.Compare(info[0], callId) == 0)
                {
                    if (info.Length > 2)
                    {
                        res = info[3];
                    }
                    else
                    {
                        res = "Description is not found";
                    }
                    break;
                }
            }
            return res;            
        }
        
        public PhoneCallStatus InitiateCall(string phoneNumber, Guid requestId, Dictionary<string,object> deliveryAttributes)
        {
            // Here should be some logic for performing voice call
            // For testing purposes we just write details in file             
            string info = string.Format("{0};{1};{2};{3}", requestId, phoneNumber, 0, string.Empty);
            using (StreamWriter sw = File.AppendText(path))
            {
                sw.WriteLine(info);                
            }
            return PhoneCallStatus.Pending;    
        }
    }
}

步驟 3:儲存現有的 MfaSettings

備份位於 「C:\Program Files\Microsoft Forefront Identity Manager\2010\Service」 資料夾中的MfaSettings.xml。

步驟 4:編輯 MfaSettings.xml 檔案

更新或清除下列幾行:

  • 移除/清除所有的設定項目行

  • 使用您的自訂電話提供者,更新或將下列幾行新增至 MfaSettings.xml
    <CustomPhoneProvider>C:\Program Files\Microsoft Forefront Identity Manager\2010\Service\CustomPhoneGate.dll</CustomPhoneProvider>

步驟 5:重新啟動 MIM 服務

重新啟動服務之後,使用 SSPR 和/或 PAM 驗證自訂身分識別提供者的功能。

注意

若要還原設定,請將 MfaSettings.xml 取代為您在步驟 3 中的備份檔案

後續步驟