返回有关自定义政策的电子邮件

Ger*_*riz 3 azure azure-ad-b2c

我使用的是自定义策略,我看到内置策略中存在“电子邮件”字段,但自定义策略中不存在该字段。otherMails而是有一个索取名称。

  • 我想emails用用户电子邮件列表返回令牌中的索赔。
  • 我希望对我的注册/登录和密码重置政策提出要求。

我正在使用入门包中的自定义策略。但是我不知道该TechnicalProfiles改哪个。我尝试了几件事,但是没有用。

提前致谢!

Chr*_*ett 5

编写本地帐户时:必须使用“ CreateOtherMailsFromEmail”声明转换从“ email”声明创建“ otherMails”声明,然后将“ otherMails”声明保留在“ AAD-UserWriteUsingLogonEmail”技术配置文件中:

<TechnicalProfile Id="AAD-UserWriteUsingLogonEmail">
  ...
  <IncludeInSso>false</IncludeInSso>
  <InputClaimsTransformations>
    <InputClaimsTransformation ReferenceId="CreateOtherMailsFromEmail" />
  </InputClaimsTransformations>
  <InputClaims>
    ...
  </InputClaims>
  <PersistedClaims>
    ...
    <PersistedClaim ClaimTypeReferenceId="otherMails" />
  </PersistedClaims>
  <OutputClaims>
    ...
    <OutputClaim ClaimTypeReferenceId="otherMails" />
  </OutputClaims>
  ...
</TechnicalProfile>
Run Code Online (Sandbox Code Playgroud)

然后,您必须从“ LocalAccountSignUpWithLogonEmail”技术资料中传递“ otherMails”声明,该资料被调用以注册本地帐户:

<TechnicalProfile Id="LocalAccountSignUpWithLogonEmail">
    ...
    <OutputClaims>
        ...
        <OutputClaim ClaimTypeReferenceId="otherMails" />
    </OutputClaims>
</TechnicalProfile>
Run Code Online (Sandbox Code Playgroud)

编写社交帐户时:已经从“电子邮件”声明中创建了“ otherMails”声明,然后将其保留在“ AAD-UserWriteUsingAlternativeSecurityId”技术配置文件中。

然后,您必须将“ otherMails”声明从“ SelfAsserted-Social”技术资料传递出去,该资料被调用以注册社交帐户:

<TechnicalProfile Id="SelfAsserted-Social">
    ...
    <OutputClaims>
        ...
        <OutputClaim ClaimTypeReferenceId="otherMails" />
    </OutputClaims>
</TechnicalProfile>
Run Code Online (Sandbox Code Playgroud)

在读取本地帐户或社交帐户时:在“ AAD-UserReadUsingObjectId”,“ AAD-UserReadUsingEmailAddress”和“ AAD-UserReadUsingAlternativeSecurityId”技术配置文件中已经读取了“ otherMails”声明。

然后,您必须从“ LocalAccountDiscoveryUsingEmailAddress”技术配置文件中传递“ otherMails”声明,并调用该技术配置文件来恢复本地密码:

<TechnicalProfile Id="LocalAccountDiscoveryUsingEmailAddress">
    ...
    <OutputClaims>
        ...
        <OutputClaim ClaimTypeReferenceId="otherMails" />
    </OutputClaims>
</TechnicalProfile>
Run Code Online (Sandbox Code Playgroud)

要从注册/登录和密码重置策略中将“ otherMails”声明作为“电子邮件”发布:您必须添加<OutputClaim />关于依赖方策略的“ otherMails”声明:

<RelyingParty>
    ...
    <TechnicalProfile Id="PolicyProfile">
        <OutputClaims>
            ...
            <OutputClaim ClaimTypeReferenceId="otherMails" PartnerClaimType="emails" />
        </OutputClaims>
    </TechnicalProfile>
</RelyingParty>
Run Code Online (Sandbox Code Playgroud)


Way*_*ang 5

对于 Chris Padgett 的回答,您可以将其他电子邮件(备用电子邮件)添加到声明中。

如果您只想将 SignIn 名称中的电子邮件声明添加到令牌中,您只需执行以下步骤:

  1. 打开你的SignUporSignIn.xml文件

  2. 替换<OutputClaim ClaimTypeReferenceId="email" /><OutputClaim ClaimTypeReferenceId="signInNames.emailAddress" PartnerClaimType="email" />

  3. 保存此 SignUporSignIn.xml 文件并将其上传到 Azure AD B2C 以覆盖策略。

  4. 运行 SignUporSignIn 策略以对其进行测试。这是我的测试结果,您可以在令牌中看到电子邮件声明: 在此处输入图片说明