Azure ad b2c Azure AD B2C:如何在自定义策略中引用内置声明?

Azure ad b2c Azure AD B2C:如何在自定义策略中引用内置声明?,azure-ad-b2c,Azure Ad B2c,我正在为AAD B2C编写一份自定义政策,需要包括一些内置声明(国家/地区、邮政编码、城市、地址) 我使用了starter pack并注意到,甚至像电子邮件这样的声明也在TrustFrameworkBase ClaimSchema元素的模式中声明,如下面的示例,其中一些声明按协议引用了DefaultPartnerClaimTypes元素: <ClaimsSchema> ... <ClaimType Id="displayName"> <Disp

我正在为AAD B2C编写一份自定义政策,需要包括一些内置声明(国家/地区、邮政编码、城市、地址)

我使用了starter pack并注意到,甚至像电子邮件这样的声明也在TrustFrameworkBase ClaimSchema元素的模式中声明,如下面的示例,其中一些声明按协议引用了DefaultPartnerClaimTypes元素:

<ClaimsSchema>
...

  <ClaimType Id="displayName">
        <DisplayName>Display Name</DisplayName>
        <DataType>string</DataType>
        <DefaultPartnerClaimTypes>
          <Protocol Name="OAuth2" PartnerClaimType="unique_name" />
          <Protocol Name="OpenIdConnect" PartnerClaimType="name" />
          <Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" />
        </DefaultPartnerClaimTypes>
        <UserHelpText>Your display name.</UserHelpText>
        <UserInputType>TextBox</UserInputType>
      </ClaimType>
...
      <ClaimType Id="email">
        <DisplayName>Email Address</DisplayName>
        <DataType>string</DataType>
        <DefaultPartnerClaimTypes>
          <Protocol Name="OpenIdConnect" PartnerClaimType="email" />
        </DefaultPartnerClaimTypes>
        <Restriction>
          <Pattern RegularExpression="^[a-zA-Z0-9.!#$%&amp;'^_`{}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$" HelpText="Please enter a valid email address." />
        </Restriction>
      </ClaimType>
...
</ClaimsSchema>

...
显示名称
一串
您的显示名称。
文本框
...
电子邮件地址
一串
...
这些是文本类型的声明,例如电子邮件声明有一个regex限制来验证电子邮件地址,我的问题是关于国家/地区声明,例如,在内置声明中,该声明是枚举限制的,并显示为下拉列表。是否可以从我的自定义策略中引用它,而不定义所有元素和规则?只是引用内置的ClaimType


谢谢

国家索赔映射到的国家属性。用户对象的国家属性可以包含任何字符串值

因此,由保单制定者决定是否应将国家索赔限制在一个众所周知的价值清单内


如果是,则必须添加到索赔类型。

感谢您的回复!因此,我不认为,如果我要以与内置权利要求相同的方式限制这些值,我必须删除限制列表,因为无法重用内置权利要求中的权利要求定义。我说的对吗?嗨,亚历克斯,我遇到了和你一样的问题。那么你的最终决定是什么?我还希望在自定义策略中重用内置索赔控制/区域。但我不想把所有的国家都列在海关政策的元素中,你能找到其他的方法吗?