技術配置檔

注意

在 Azure Active Directory B2C 中, 自定義原則 的設計主要是為了解決複雜的案例。 在大部分情況下,我們建議您使用內 建的使用者流程。 如果您尚未這麼做,請了解開始使用 Active Directory B2C 中的自定義原則入門套件。

技術配置檔提供架構,內建機制可與不同類型的合作對象通訊。 技術配置檔可用來與 Azure Active Directory B2C(Azure AD B2C) 租用戶通訊,以建立使用者或讀取使用者配置檔。 技術配置檔可以自我判斷,以啟用與用戶的互動。 例如,技術配置檔可以收集用戶的認證來登入,然後轉譯註冊頁面或密碼重設頁面。

技術配置檔的類型

技術設定檔可啟用下列類型的案例:

技術配置檔流程

所有類型的技術配置檔都會共用相同的概念。 它們一開始會讀取輸入宣告並執行宣告轉換。 然後,他們會與設定的合作對象通訊,例如識別提供者、REST API 或 Microsoft Entra 目錄服務。 程式完成之後,技術配置檔會傳回輸出宣告,而且可能會執行輸出宣告轉換。 下圖顯示如何處理技術配置檔中所參考的轉換和對應。 執行宣告轉換之後,不論技術配置檔與哪些合作對象,輸出宣告都會立即儲存在宣告包中。

Diagram that illustrates the technical profile flow.

  1. 單一登錄 (SSO) 工作階段管理:使用 SSO 工作階段管理還原技術配置檔的作業階段狀態。
  2. 輸入宣告轉換:在技術配置文件啟動之前,Azure AD B2C 會執行輸入 宣告轉換
  3. 輸入宣告:宣告會從用於技術配置檔的宣告包中挑選。
  4. 技術配置檔執行:技術配置檔會與設定的合作對象交換宣告。 例如:
    • 將使用者重新導向至識別提供者,以完成登入。 成功登入之後,用戶會傳回 ,並繼續執行技術配置檔。
    • 呼叫 REST API,同時將參數當做 InputClaims 傳送,並以 OutputClaims 的形式傳回資訊。
    • 建立或更新用戶帳戶。
    • 傳送並驗證多重要素驗證文字訊息。
  5. 驗證技術配置檔自我判斷技術配置檔可以呼叫驗證技術配置檔,以驗證使用者所分析的數據。 只有自我判斷技術配置檔可以使用驗證技術配置檔。
  6. 輸出宣告:宣告會傳回至宣告包。 您可以在下一個協調流程步驟或輸出宣告轉換中使用這些宣告。
  7. 輸出宣告轉換:技術配置檔完成後,Azure AD B2C 會執行輸出 宣告轉換
  8. SSO 工作階段管理:使用 SSO 工作階段管理,將技術配置檔的數據保存到工作階段。

TechnicalProfiles 元素包含宣告提供者支援的一組技術配置檔。 每個宣告提供者都必須至少有一個技術配置檔。 技術配置檔會決定與宣告提供者通訊所需的端點和通訊協定。 宣告提供者可以有多個技術配置檔。

<ClaimsProvider>
  <DisplayName>Display name</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="Technical profile identifier">
      <DisplayName>Display name of technical profile</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        ...
      </Metadata>
      ...
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>

TechnicalProfile 元素包含下列屬性:

屬性 必要 描述
Id Yes 技術配置檔的唯一標識符。 您可以使用原則檔案中其他元素的這個標識碼來參考技術配置檔。 範例包括 OrchestrationStepsValidationTechnicalProfile

TechnicalProfile 元素包含下列元素:

Element 發生次數 描述
網域 0:1 技術配置檔的功能變數名稱。 例如,如果您的技術配置檔指定 Facebook 身分識別提供者,則功能變數名稱會 Facebook.com。
DisplayName 1:1 技術配置文件的顯示名稱。
描述 0:1 技術配置檔的描述。
通訊協定 1:1 用於與另一方通訊的通訊協定。
中繼資料 0:1 一組索引鍵和值,可控制技術配置文件的行為。
InputTokenFormat 0:1 輸入令牌的格式。 可能的值為 JSONJWTSAML11SAML2。 值 JWT 代表每個 IETF 規格的 JSON Web 令牌。 值 SAML11 代表每個 OASIS 規格的 SAML 1.1 安全性令牌。 值 SAML2 代表每個 OASIS 規格的 SAML 2.0 安全性令牌。
OutputTokenFormat 0:1 輸出令牌的格式。 可能的值為 JSONJWTSAML11SAML2
CryptographicKeys 0:1 技術配置檔中使用的密碼編譯密鑰清單。
InputClaimsTransformations 0:1 先前定義的宣告轉換參考清單,這些轉換應在任何宣告傳送至宣告提供者或信賴憑證者之前執行。
InputClaims 0:1 先前定義的宣告型別參考清單,這些宣告型別在技術配置檔中會被視為輸入。
PersistedClaims 0:1 先前定義的宣告型別參考清單,這些宣告類型將由技術配置檔保存。
DisplayClaims 0:1 先前定義的宣告類型參考清單,這些宣告類型是由 自我判斷技術配置檔所呈現。 DisplayClaims 功能目前為預覽狀態。
OutputClaims 0:1 先前定義的宣告型別參考清單,這些宣告類型在技術配置檔中會作為輸出。
OutputClaimsTransformations 0:1 先前定義的宣告轉換參考清單,這些轉換應在從宣告提供者收到宣告之後執行。
ValidationTechnicalProfiles 0:n 技術配置檔用於驗證之其他技術配置檔的參考清單。 如需詳細資訊,請參閱 驗證技術配置檔
SubjectNamingInfo 0:1 控制主體名稱在標記中生產主體名稱,其中主體名稱會與宣告分開指定。 範例包括 OAuth 或 SAML。
IncludeInSso 0:1 此技術配置檔的使用是否應該套用會話的 SSO 行為,還是需要明確的互動。 此元素只在驗證技術配置檔中使用的 SelfAsserted 配置檔中有效。 可能的值為 true (預設值) 或 false
IncludeClaimsFromTechnicalProfile 0:1 技術配置文件的識別碼,您希望所有輸入和輸出宣告新增至此技術配置檔。 參考的技術配置文件必須定義在相同的原則檔中。
IncludeTechnicalProfile 0:1 您希望所有資料新增至此技術配置文件的技術配置文件識別碼。
UseTechnicalProfileForSessionManagement 0:1 用於會話管理的不同技術配置檔。
EnabledForUserJourneys 0:1 控制技術配置檔是否在使用者旅程圖中執行。

通訊協定

Protocol 元素會指定要用於與另一方通訊的通訊協定。 Protocol 元素包含下列屬性:

屬性 必要 描述
姓名 Yes 作為技術配置檔一部分的 Azure AD B2C 所支援的有效通訊協定名稱。 可能的值為 OAuth1、、OAuth2SAML2OpenIdConnectProprietary、 或 None
處理常式 No 當通訊協定名稱設定為 Proprietary時,指定 Azure AD B2C 用來判斷通訊協定處理程式的元件名稱。 如果您將通訊協定 Name 屬性設定為 None,請勿包含 Handler 屬性。

中繼資料

Metadata 元素包含特定通訊協議的相關組態選項。 支援的元數據清單記載於對應的 技術配置檔 規格中。 Metadata 元素包含下列元素:

Element 發生次數 描述
項目 0:n 與技術配置檔相關的元數據。 每種技術配置檔類型都有一組不同的元數據專案。 如需詳細資訊,請參閱技術配置檔類型一節。

項目

Metadata 元素的 Item 元素包含下列屬性:

屬性 必要 描述
索引鍵 Yes 中繼資料金鑰。 如需元數據專案清單,請參閱每個 技術配置檔類型

下列範例說明如何使用與 OAuth2 技術配置檔相關的元數據。

<TechnicalProfile Id="Facebook-OAUTH">
  ...
  <Metadata>
    <Item Key="ProviderName">facebook</Item>
    <Item Key="authorization_endpoint">https://www.facebook.com/dialog/oauth</Item>
    <Item Key="AccessTokenEndpoint">https://graph.facebook.com/oauth/access_token</Item>
    <Item Key="HttpBinding">GET</Item>
    <Item Key="UsePolicyInRedirectUri">0</Item>
    ...
  </Metadata>
  ...
</TechnicalProfile>

下列範例說明如何使用與 REST API 技術配置檔相關的元數據。

<TechnicalProfile Id="REST-Validate-Email">
  ...
  <Metadata>
    <Item Key="ServiceUrl">https://api.sendgrid.com/v3/mail/send</Item>
    <Item Key="AuthenticationType">Bearer</Item>
    <Item Key="SendClaimsIn">Body</Item>
    ...
  </Metadata>
  ...
</TechnicalProfile>

密碼編譯金鑰

若要與它整合的服務建立信任,Azure AD B2C 會以原則密鑰的形式儲存秘密和憑證。 在技術配置檔執行期間,Azure AD B2C 會從 Azure AD B2C 原則密鑰擷取密碼編譯密鑰。 然後,Azure AD B2C 會使用密鑰來建立信任或加密或簽署令牌。 這些信任包含:

CryptographicKeys 元素包含下列元素:

Element 發生次數 描述
索引鍵 1:n 此技術配置檔中使用的密碼編譯金鑰。

索引鍵

Key 元素包含下列屬性:

屬性 必要 描述
Id No 原則檔中其他元素所參考之特定密鑰組的唯一標識符。
儲存體 ReferenceId Yes 原則檔中其他元素所參考之記憶體金鑰容器的標識碼。

輸入宣告轉換

InputClaimsTransformations 元素可能包含用來修改輸入宣告或產生新宣告的輸入宣告轉換元素集合。

宣告轉換集合中先前宣告轉換的輸出宣告可以是後續輸入宣告轉換的輸入宣告。 如此一來,您就可以有一連串相依的宣告轉換。

InputClaimsTransformations 元素包含下列元素:

Element 發生次數 描述
InputClaimsTransformation 1:n 宣告轉換的標識碼,該轉換應在任何宣告傳送至宣告提供者或信賴憑證者之前執行。 宣告轉換可用來修改現有的 ClaimsSchema 宣告或產生新的宣告。

InputClaimsTransformation

InputClaimsTransformation 元素包含下列屬性:

屬性 必要 描述
ReferenceId Yes 已在原則檔或父原則檔案中定義的宣告轉換標識碼。

下列技術配置文件參考 CreateOtherMailsFromEmail 宣告轉換。 宣告轉換會將宣告的值 email 新增至集合, otherMails 再將數據保存到目錄。

<TechnicalProfile Id="AAD-UserWriteUsingAlternativeSecurityId">
  ...
  <InputClaimsTransformations>
    <InputClaimsTransformation ReferenceId="CreateOtherMailsFromEmail" />
  </InputClaimsTransformations>
  <PersistedClaims>
    <PersistedClaim ClaimTypeReferenceId="alternativeSecurityId" />
    <PersistedClaim ClaimTypeReferenceId="userPrincipalName" />
    <PersistedClaim ClaimTypeReferenceId="mailNickName" DefaultValue="unknown" />
    <PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="unknown" />
    <PersistedClaim ClaimTypeReferenceId="otherMails" />
    <PersistedClaim ClaimTypeReferenceId="givenName" />
    <PersistedClaim ClaimTypeReferenceId="surname" />
  </PersistedClaims>
  ...
</TechnicalProfile>

輸入宣告

InputClaims 元素會從用於技術配置檔的宣告包中挑選宣告。 例如, 自我判斷技術配置檔 會使用輸入宣告來預先填入使用者提供的輸出宣告。 REST API 技術配置檔會使用輸入宣告,將輸入參數傳送至 REST API 端點。 Azure AD B2C 會使用輸入宣告作為唯一標識符來讀取、更新或刪除帳戶。

InputClaims 元素包含下列元素:

Element 發生次數 描述
InputClaim 1:n 預期的輸入宣告類型。

InputClaim

InputClaim 元素包含下列屬性:

屬性 必要 描述
ClaimTypeReferenceId Yes 宣告類型的識別碼。 宣告已在原則檔案或父原則檔案的宣告架構區段中定義。
DefaultValue No 如果 ClaimTypeReferenceId 所指示的宣告不存在,則用來建立宣告的預設值,以便技術配置檔將產生的宣告當做 InputClaim 元素使用。
AlwaysUseDefaultValue Yes 強制使用預設值。
PartnerClaimType No 指定之原則宣告類型對應之外部夥伴之宣告類型的標識碼。 如果未指定 PartnerClaimType 屬性,則指定的原則宣告類型會對應至相同名稱的夥伴宣告類型。 當您的宣告類型名稱與其他合作對象不同時,請使用此屬性。 例如,如果第一個宣告名稱為 givenName,而夥伴則使用名為 first_name宣告。

顯示宣告

DisplayClaims 元素包含要在螢幕上呈現的宣告清單,以從使用者收集數據。 在顯示宣告集合中,您可以包含宣告類型的參考您所建立的顯示控件

  • 宣告類型是要在螢幕上顯示之宣告的參考。
    • 若要強制使用者提供特定宣告的值,請將 DisplayClaim 元素的 Required 屬性設定true
    • 若要預先填入顯示宣告的值,請使用先前所述的輸入宣告。 元素也可能包含預設值。
    • DisplayClaims 集合中的 ClaimType 元素必須將 UserInputType 元素設定為 Azure AD B2C 支援的任何使用者輸入類型。 範例為 TextBoxDropdownSingleSelect
  • 顯示控件是具有特殊功能並與 Azure AD B2C 後端服務互動的使用者介面元素。 它可讓使用者在後端叫用驗證技術配置檔的頁面上執行動作。 例如,驗證電子郵件地址、電話號碼或客戶忠誠度號碼。

DisplayClaims元素的順序會指定 Azure AD B2C 在螢幕上呈現宣告的順序。

DisplayClaims 元素包含下列元素:

Element 發生次數 描述
DisplayClaim 1:n 預期的輸入宣告類型。

DisplayClaim

DisplayClaim 元素包含下列屬性:

屬性 必要 描述
ClaimTypeReferenceId No 原則檔或父原則檔案中 ClaimsSchema 區段中已定義的宣告類型識別碼。
DisplayControlReferenceId No 原則檔或父原則檔案中 ClaimsSchema 區段中已定義的顯示控件識別碼
必要 No 指出是否需要顯示宣告。

下列範例說明如何在自我判斷技術配置檔中使用顯示宣告和顯示控件。

Screenshot that shows a self-asserted technical profile with display claims.

在下列技術設定檔中:

  • 第一個顯示宣告會參考 emailVerificationControl 顯示控件,該控件會收集並驗證電子郵件位址。
  • 第五個顯示宣告會參考 phoneVerificationControl 顯示控件,該控件會收集和驗證電話號碼。
  • 其他顯示宣告是要從使用者收集的 ClaimType 元素。
<TechnicalProfile Id="Id">
  <DisplayClaims>
    <DisplayClaim DisplayControlReferenceId="emailVerificationControl" />
    <DisplayClaim ClaimTypeReferenceId="displayName" Required="true" />
    <DisplayClaim ClaimTypeReferenceId="givenName" Required="true" />
    <DisplayClaim ClaimTypeReferenceId="surName" Required="true" />
    <DisplayClaim DisplayControlReferenceId="phoneVerificationControl" />
    <DisplayClaim ClaimTypeReferenceId="newPassword" Required="true" />
    <DisplayClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
  </DisplayClaims>
</TechnicalProfile>

保存的宣告

PersistedClaims 元素包含 Microsoft Entra ID 技術配置檔應保存的所有值,這些值在原則和 Microsoft Entra 屬性名稱的 ClaimsSchema 區段中已定義的宣告類型之間可能對應的資訊。

宣告的名稱是 Microsoft Entra 屬性的名稱,除非指定 PartnerClaimType 屬性,其中包含 Microsoft Entra 屬性名稱。

PersistedClaims 元素包含下列元素:

Element 發生次數 描述
PersistedClaim 1:n 要保存的宣告類型。

PersistedClaim

PersistedClaim 元素包含下列屬性:

屬性 必要 描述
ClaimTypeReferenceId Yes 原則檔或父原則檔案中 ClaimsSchema 區段中已定義的宣告類型識別碼。
DefaultValue No 如果宣告不存在,則為用來建立宣告的預設值。
PartnerClaimType No 指定之原則宣告類型對應之外部夥伴之宣告類型的標識碼。 如果未指定 PartnerClaimType 屬性,則指定的原則宣告類型會對應至相同名稱的夥伴宣告類型。 當您的宣告類型名稱與其他合作對象不同時,請使用此屬性。 例如,如果第一個宣告名稱為 givenName,而夥伴則使用名為 first_name宣告。

在下列範例中, AAD-UserWriteUsingLogonEmail 技術配置檔或 會建立新本機帳戶的入門套件會保存下列宣告:

<PersistedClaims>
  <PersistedClaim ClaimTypeReferenceId="email" PartnerClaimType="signInNames.emailAddress" />
  <PersistedClaim ClaimTypeReferenceId="newPassword" PartnerClaimType="password"/>
  <PersistedClaim ClaimTypeReferenceId="displayName" DefaultValue="unknown" />
  <PersistedClaim ClaimTypeReferenceId="passwordPolicies" DefaultValue="DisablePasswordExpiration" />
  <PersistedClaim ClaimTypeReferenceId="givenName" />
  <PersistedClaim ClaimTypeReferenceId="surname" />
</PersistedClaims>

輸出宣告

OutputClaims 元素是宣告的集合,在完成技術配置文件之後會傳回至宣告包。 您可以在下一個協調流程步驟或輸出宣告轉換中使用這些宣告。 OutputClaims 元素包含下列元素:

Element 發生次數 描述
OutputClaim 1:n 預期的輸出宣告類型。

OutputClaim

OutputClaim 元素包含下列屬性:

屬性 必要 描述
ClaimTypeReferenceId Yes 原則檔或父原則檔案中 ClaimsSchema 區段中已定義的宣告類型識別碼。
DefaultValue No 如果宣告不存在,則為用來建立宣告的預設值。
AlwaysUseDefaultValue No 強制使用預設值。
PartnerClaimType No 指定之原則宣告類型對應之外部夥伴之宣告類型的標識碼。 如果未指定夥伴宣告類型屬性,則指定的原則宣告類型會對應至相同名稱的夥伴宣告類型。 當您的宣告類型名稱與其他合作對象不同時,請使用此屬性。 例如,如果第一個宣告名稱為 givenName,而夥伴則使用名為 first_name宣告。

輸出宣告轉換

OutputClaimsTransformations 元素可能包含 OutputClaimsTransformation 元素的集合。 輸出宣告轉換可用來修改輸出宣告或產生新的宣告。 執行之後,輸出宣告會放回宣告包中。 您可以在下一個協調流程步驟中使用這些宣告。

宣告轉換集合中先前宣告轉換的輸出宣告可以是後續輸入宣告轉換的輸入宣告。 如此一來,您就可以有一連串相依的宣告轉換。

OutputClaimsTransformations 元素包含下列元素:

Element 發生次數 描述
OutputClaimsTransformation 1:n 宣告轉換的標識碼,應在任何宣告傳送至宣告提供者或信賴憑證者之前執行。 宣告轉換可用來修改現有的 ClaimsSchema 宣告或產生新的宣告。

OutputClaimsTransformation

OutputClaimsTransformation 元素包含下列屬性:

屬性 必要 描述
ReferenceId Yes 已在原則檔或父原則檔案中定義的宣告轉換標識碼。

下列技術配置文件會參考 AssertAccountEnabledIsTrue 宣告轉換,以評估從目錄讀取 accountEnabled 宣告之後是否啟用帳戶。

<TechnicalProfile Id="AAD-UserReadUsingEmailAddress">
  ...
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
    <OutputClaim ClaimTypeReferenceId="displayName" />
    <OutputClaim ClaimTypeReferenceId="accountEnabled" />
    <OutputClaim ClaimTypeReferenceId="otherMails" />
    <OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" />
  </OutputClaims>
  <OutputClaimsTransformations>
    <OutputClaimsTransformation ReferenceId="AssertAccountEnabledIsTrue" />
  </OutputClaimsTransformations>
  ...
</TechnicalProfile>

驗證技術配置檔

驗證技術配置檔用於驗證自我判斷技術配置檔中的輸出宣告。 驗證技術配置檔是來自任何通訊協定的一般技術配置檔,例如 Microsoft Entra IDREST API。 驗證技術配置檔會傳回輸出宣告或傳回錯誤碼。 錯誤訊息會在畫面上轉譯給使用者,讓使用者重試。

下圖說明 Azure AD B2C 如何使用驗證技術配置檔來驗證用戶認證。

Diagram that shows a validation technical profile flow.

ValidationTechnicalProfiles 元素包含下列元素:

Element 發生次數 描述
ValidationTechnicalProfile 1:n 所使用的技術配置檔標識碼會驗證參考技術配置檔的某些或所有輸出宣告。 參考技術配置檔的所有輸入宣告都必須出現在參考技術配置文件的輸出宣告中。

ValidationTechnicalProfile

ValidationTechnicalProfile 元素包含下列屬性:

屬性 必要 描述
ReferenceId Yes 已在原則檔或父原則檔案中定義的技術配置檔標識碼。

SubjectNamingInfo

SubjectNamingInfo 元素會定義信賴憑證者原則令牌中使用的主體名稱。 SubjectNamingInfo 元素包含下列屬性:

屬性 必要 描述
ClaimType Yes 原則檔案中 ClaimsSchema 區段中已定義的宣告類型標識碼。

包含技術配置檔

技術配置檔可以包含另一個技術配置檔來變更設定或新增新功能。 IncludeTechnicalProfile 元素是衍生技術配置檔之通用技術配置文件的參考。 若要減少原則元素的備援和複雜度,當您有多個共用核心元素的技術配置檔時,請使用包含。 使用一般技術配置檔搭配一組常見的組態,以及包含一般技術配置檔的特定工作技術配置檔。

假設您有具有單一 端點的 REST API 技術配置檔 ,而您需要針對不同的案例傳送不同的宣告集。 建立具有共用功能的通用技術配置檔,例如 REST API 端點 URI、元數據、驗證類型和密碼編譯密鑰。 建立包含一般技術配置檔的特定工作技術配置檔。 然後新增輸入和輸出宣告,或覆寫與該技術配置檔相關的 REST API 端點 URI。

IncludeTechnicalProfile 元素包含下列屬性:

屬性 必要 描述
ReferenceId Yes 已在原則檔或父原則檔案中定義的技術配置檔標識碼。

下列範例說明如何使用 包含:

  • REST-API-Common:具有基本組態的通用技術配置檔。
  • REST-ValidateProfile:包含 REST-API-Common 技術配置檔,並指定輸入和輸出宣告。
  • REST-UpdateProfile:包含 REST-API-Common 技術配置檔、指定輸入宣告,以及覆寫 ServiceUrl 元數據。
<ClaimsProvider>
  <DisplayName>REST APIs</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="REST-API-Common">
      <DisplayName>Base REST API configuration</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        <Item Key="ServiceUrl">https://your-app-name.azurewebsites.NET/api/identity</Item>
        <Item Key="AuthenticationType">Basic</Item>
        <Item Key="SendClaimsIn">Body</Item>
      </Metadata>
      <CryptographicKeys>
        <Key Id="BasicAuthenticationUsername" StorageReferenceId="B2C_1A_B2cRestClientId" />
        <Key Id="BasicAuthenticationPassword" StorageReferenceId="B2C_1A_B2cRestClientSecret" />
      </CryptographicKeys>
      <UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop" />
    </TechnicalProfile>

    <TechnicalProfile Id="REST-ValidateProfile">
      <DisplayName>Validate the account and return promo code</DisplayName>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="objectId" />
        <InputClaim ClaimTypeReferenceId="email" />
        <InputClaim ClaimTypeReferenceId="userLanguage" PartnerClaimType="lang" DefaultValue="{Culture:LCID}" AlwaysUseDefaultValue="true" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="promoCode" />
      </OutputClaims>
      <IncludeTechnicalProfile ReferenceId="REST-API-Common" />
    </TechnicalProfile>

    <TechnicalProfile Id="REST-UpdateProfile">
      <DisplayName>Update the user profile</DisplayName>  
      <Metadata>
        <Item Key="ServiceUrl">https://your-app-name.azurewebsites.NET/api/identity/update</Item>
      </Metadata>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="objectId" />
        <InputClaim ClaimTypeReferenceId="email" />
      </InputClaims>
      <IncludeTechnicalProfile ReferenceId="REST-API-Common" />
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>

多層次包含

技術配置檔可以包含單一技術配置檔。 包含層級的數目沒有限制。 例如, AAD-UserReadUsingAlternativeSecurityId-NoError 技術配置檔包含 AAD-UserReadUsingAlternativeSecurityId。 此技術配置檔會將 RaiseErrorIfClaimsPrincipalDoesNotExist 元數據項目設定為 , true 並在目錄中沒有社交帳戶時引發錯誤。 AAD-UserReadUsingAlternativeSecurityId-NoError 會覆寫此行為,並停用該錯誤訊息。

<TechnicalProfile Id="AAD-UserReadUsingAlternativeSecurityId-NoError">
  <Metadata>
    <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">false</Item>
  </Metadata>
  <IncludeTechnicalProfile ReferenceId="AAD-UserReadUsingAlternativeSecurityId" />
</TechnicalProfile>

AAD-UserReadUsingAlternativeSecurityId 包含 AAD-Common 技術配置檔。

<TechnicalProfile Id="AAD-UserReadUsingAlternativeSecurityId">
  <Metadata>
    <Item Key="Operation">Read</Item>
    <Item Key="RaiseErrorIfClaimsPrincipalDoesNotExist">true</Item>
    <Item Key="UserMessageIfClaimsPrincipalDoesNotExist">User does not exist. Please sign up before you can sign in.</Item>
  </Metadata>
  <InputClaims>
    <InputClaim ClaimTypeReferenceId="AlternativeSecurityId" PartnerClaimType="alternativeSecurityId" Required="true" />
  </InputClaims>
  <OutputClaims>
    <OutputClaim ClaimTypeReferenceId="objectId" />
    <OutputClaim ClaimTypeReferenceId="userPrincipalName" />
    <OutputClaim ClaimTypeReferenceId="displayName" />
    <OutputClaim ClaimTypeReferenceId="otherMails" />
    <OutputClaim ClaimTypeReferenceId="givenName" />
    <OutputClaim ClaimTypeReferenceId="surname" />
  </OutputClaims>
  <IncludeTechnicalProfile ReferenceId="AAD-Common" />
</TechnicalProfile>

AAD-UserReadUsingAlternativeSecurityId-NoError 和 AAD-UserReadUsingAlternativeSecurityId 不會指定必要的 Protocol 元素,因為它是在 AAD-Common 技術配置檔中指定。

<TechnicalProfile Id="AAD-Common">
  <DisplayName>Azure Active Directory</DisplayName>
  <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.AzureActiveDirectoryProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
  ...
</TechnicalProfile>

使用技術配置檔進行會話管理

UseTechnicalProfileForSessionManagement 元素會參考 SSO 會話技術配置檔UseTechnicalProfileForSessionManagement 元素包含下列屬性:

屬性 必要 描述
ReferenceId Yes 已在原則檔或父原則檔案中定義的技術配置檔標識碼。

啟用使用者旅程圖

使用者 旅程圖中的 ClaimsProviderSelections 會定義宣告提供者選取選項及其順序的清單。 使用 EnabledForUserJourneys 元素,您可以篩選哪些宣告提供者可供使用者使用。 EnabledForUserJourneys 元素包含下列其中一個值:

  • 一律:執行技術配置檔。
  • 永不:略過技術配置檔。
  • OnClaimsExistence:只有在技術配置檔中指定的特定宣告存在時,才會執行 。
  • OnItemExistenceInStringCollectionClaim:只有在字串集合宣告中有專案時才執行。
  • OnItemAbsenceInStringCollectionClaim:只有在字串集合宣告中沒有專案時才執行。

使用 OnClaimsExistenceOnItemExistenceInStringCollectionClaimOnItemAbsenceInStringCollectionClaim 需要您提供下列元數據:

  • ClaimTypeOnWhichToEnable:指定要評估的宣告類型。
  • ClaimValueOnWhichToEnable:指定要比較的值。

只有當 identityProviders 字串集合包含 的值facebook.com時,才會執行下列技術配置檔:

<TechnicalProfile Id="UnLink-Facebook-OAUTH">
  <DisplayName>Unlink Facebook</DisplayName>
...
    <Metadata>
      <Item Key="ClaimTypeOnWhichToEnable">identityProviders</Item>
      <Item Key="ClaimValueOnWhichToEnable">facebook.com</Item>
    </Metadata>
...
  <EnabledForUserJourneys>OnItemExistenceInStringCollectionClaim</EnabledForUserJourneys>
</TechnicalProfile>