Azure B2C 自定义策略 - 从电子邮件决定 claim 交换

标签 azure azure-ad-b2c identity-experience-framework

我想要使用以下流程使用 Azure B2C 自定义策略进行身份验证

  1. 用户应该看到用户输入电子邮件 ID 的字段
  2. 根据电子邮件 ID(域名),我们决定用于对用户进行身份验证的声明交换。
  3. 可用的声明提供商 - 本地帐户,使用 Azure B2B AD 租户登录。

对于第 2 点,我们可以使用 Parse Domain Claims Transformation 解析域。 .

对于第 3 点,我已经使用默认的“使用本地和社交签名”入门包设置了必要的声明提供程序并验证了其是否有效。

最佳答案

您可以创建这样的用户旅程。

<OrchestrationSteps>
  <OrchestrationStep Order="1" Type="ClaimsExchange">
    <ClaimsExchanges>
      <ClaimsExchange Id="SelfAsserted-HRD" TechnicalProfileReferenceId="SelfAsserted-HRD" />
    </ClaimsExchanges>
  </OrchestrationStep>
  <OrchestrationStep Order="2" Type="ClaimsExchange">
    <Preconditions>
      <Precondition Type="ClaimEquals" ExecuteActionsIf="false">
        <Value>domainName</Value>
        <Value>contoso.com</Value>
        <Action>SkipThisOrchestrationStep</Action>
      </Precondition>
    </Preconditions>
    <ClaimsExchanges>
      <ClaimsExchange Id="AAD-OIDC" TechnicalProfileReferenceId="AAD-OIDC" />
    </ClaimsExchanges>
  </OrchestrationStep>
  <OrchestrationStep Order="3" Type="CombinedSignInAndSignUp" ContentDefinitionReferenceId="api.signuporsignin">
    <Preconditions>
      <Precondition Type="ClaimEquals" ExecuteActionsIf="true">
        <Value>domainName</Value>
        <Value>contoso.com</Value>
        <Action>SkipThisOrchestrationStep</Action>
      </Precondition>
    </Preconditions>
    <ClaimsProviderSelections>
      <ClaimsProviderSelection ValidationClaimsExchangeId="SelfAsserted-LocalAccountSignin-Email" />
    </ClaimsProviderSelections>
    <ClaimsExchanges>
      <ClaimsExchange Id="SelfAsserted-LocalAccountSignin-Email" TechnicalProfileReferenceId="SelfAsserted-LocalAccountSignin-Email" />
    </ClaimsExchanges>
  </OrchestrationStep>
  ...
</OrchestrationSteps>

第一个编排步骤执行 SelfAsserted-HRD 技术配置文件,可以在其中输入电子邮件地址,然后调用 SetDomainName 声明转换来解析电子邮件域。

<ClaimsProvider>
  <DisplayName>Self-Asserted</DisplayName>
  <TechnicalProfiles>
    <TechnicalProfile Id="SelfAsserted-HRD">
      <DisplayName>Self-Asserted HRD</DisplayName>
      <Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
      <Metadata>
        <Item Key="ContentDefinitionReferenceId">api.selfasserted</Item>
      </Metadata>
      <IncludeInSso>false</IncludeInSso>
      <InputClaims>
        <InputClaim ClaimTypeReferenceId="email" />
      </InputClaims>
      <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="email" Required="true" />
      </OutputClaims>
      <OutputClaimsTransformations>
        <OutputClaimsTransformation ReferenceId="SetDomainName" />
      </OutputClaimsTransformations>
      <UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
    </TechnicalProfile>
  </TechnicalProfiles>
</ClaimsProvider>

如果电子邮件域等于联合域,则第二个编排步骤将执行重定向外部身份提供商的 AAD-OIDC 技术配置文件。

如果电子邮件域不等于联合域,则第三个编排步骤将执行显示本地帐户注册或登录的 SelfAsserted-LocalAccountSignin-Email 技术配置文件页。

关于Azure B2C 自定义策略 - 从电子邮件决定 claim 交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63372404/

相关文章:

azure - 自动备份 Azure 门户中 WebApp 使用的 Azure 表

Azure b2c 注销时注销所有应用程序(单点注销)

azure-ad-b2c - B2C 是否支持 PKCE 的授予流程?

azure-ad-b2c - Azure AD B2C - Refresh_Token 通过 REST 刷新声明(身份体验框架)

azure - 资源所有者密码凭据流程 - 修改声明

Azure AD B2C LinkedIn 个人资料图片

azure - 将数据从 Azure SQL 托管实例导出到 Azure Data Lake Storage 作为 json

Azure AD 云用户帐户密码策略的基于 Java 的正则表达式

powershell - 使用 Powershell New-AzureADUser 创建 Azure AD B2C 本地帐户用户

c# - Azure B2C 拒绝 asp.net MVC 中的 ="?"