自定义策略Azure AD B2C发行,并阅读Azure AD用户的价值员工ID

发布于 2025-02-11 06:03:38 字数 1274 浏览 0 评论 0原文

我需要帮助来解决我遇到的问题,我们需要创建一个我们已经创建的自定义策略,但是我们需要阅读Azure AD中用户员工的价值,以便当您第一次签名时,以该值注册在B2C中。我放了图像来理解它:

Azure AD:

但是,当我登录时,Azure AD B2C中的用户没有员工:

我在自定义策略中定义了索赔:

<ClaimType Id="extension_employeeid">
        <DisplayName>EmployeeId</DisplayName>
        <DataType>string</DataType>
        <DefaultPartnerClaimTypes>
          <Protocol Name="OAuth2" PartnerClaimType="employeeid" />
          <Protocol Name="OpenIdConnect" PartnerClaimType="employeeid" />
          <Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/employeeid" />
        </DefaultPartnerClaimTypes>
        <UserHelpText>Your EmployeeId. </UserHelpText>
        <!--<UserInputType>Readonly</UserInputType>-->
        <UserInputType>TextBox</UserInputType>
  </ClaimType>

但是返回的员工的价值是空的。 我如何解决?

I need help to solve a problem I have, we need to create a custom policy, which we already have created, but we need to read the value of the user's employeeid in Azure AD, so that when you sign in the first time, this is registered in B2C with that value. I put images to understand it:

Azure AD:
enter image description here

but when I sign in, the user in Azure AD B2C doesn't have the employeeid:
enter image description here

I defined in the custom policy the claim:

<ClaimType Id="extension_employeeid">
        <DisplayName>EmployeeId</DisplayName>
        <DataType>string</DataType>
        <DefaultPartnerClaimTypes>
          <Protocol Name="OAuth2" PartnerClaimType="employeeid" />
          <Protocol Name="OpenIdConnect" PartnerClaimType="employeeid" />
          <Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/employeeid" />
        </DefaultPartnerClaimTypes>
        <UserHelpText>Your EmployeeId. </UserHelpText>
        <!--<UserInputType>Readonly</UserInputType>-->
        <UserInputType>TextBox</UserInputType>
  </ClaimType>

but the value of employeeid that is returned is empty.
How I can fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别忘他 2025-02-18 06:03:38

请检查获得内置属性的扩展属性,而员工ID是标识符属性。

使用PersistedClaims将数据写入用户配置文件IE;在联邦帐户的首次登录流程和输出批准中写入数据,以在相应的Active Directory技术配置文件中从用户配置文件中读取数据。

在您的trustframeworkextensions文件中,

<!-- Write data during a federated account first-time sign-in flow. -->
<TechnicalProfile Id="AAD-UserWriteUsingAlternativeSecurityId">
<InputClaims>
  <InputClaim ClaimTypeReferenceId=" extension_EmployeeId "  />
</InputClaims>
<PersistedClaims>
  <PersistedClaim ClaimTypeReferenceId=" extension_EmployeeId " />
</PersistedClaims>
<OutputClaims>
  ClaimTypeReferenceId="extension_EmployeeId"  PartnerClaimType="extn.EmployeeId"  " Required="true" />
 </OutputClaims>
</TechnicalProfile>
  • 文件使技术折扣ID =“ aad-userreadusionsobjectId”读取数据
    用户使用本地帐户进行身份验证后。

如果SAML发送索赔“员工”比映射为“员工”

<OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="employeeId" />

,或者尝试使用伙伴ClaimType作为Extension_Employeenumber输出的技术配置文件

,请参见 azure ad b2c:具有自定义政策的自定义主张-Microsoft Q&amp; a

  • 确保启用启用自定义策略中的扩展属性,
    在AAD-Common中提供应用程序ID和应用程序对象ID
    技术资料元数据

    Azure Active Directory

请参见:应用程序属性

请注意,您在InguporSignin中设定的索赔仅是
当时您的注册后返回。自定义属性不会
存放在Azure AD中。确保设置扩展的值
基本策略文件。

参考文献:

  1. azure ad b2c-b2c-b2c saml saml丢失索赔
  2. 在Azure AD B2C中阅读扩展主张 - 堆栈溢出

Please check the User profile attributes in AAD B2C to get extension attributes for builtin attributes and employeeId is identifier attributes.

Use PersistedClaims to write data to the user profile i.e.; Write data during a federated account first-time sign-in flow and OutputClaims to read data from the user profile within the respective Active Directory technical profiles.

In your trustframeworkextensions file

<!-- Write data during a federated account first-time sign-in flow. -->
<TechnicalProfile Id="AAD-UserWriteUsingAlternativeSecurityId">
<InputClaims>
  <InputClaim ClaimTypeReferenceId=" extension_EmployeeId "  />
</InputClaims>
<PersistedClaims>
  <PersistedClaim ClaimTypeReferenceId=" extension_EmployeeId " />
</PersistedClaims>
<OutputClaims>
  ClaimTypeReferenceId="extension_EmployeeId"  PartnerClaimType="extn.EmployeeId"  " Required="true" />
 </OutputClaims>
</TechnicalProfile>
  • Make TechnicalProfile Id =”AAD-UserReadUsingObjectId” to Read data
    after user authenticates with a local account.

If SAML is sending a claim "employeeId" than the mapping is

<OutputClaim ClaimTypeReferenceId="issuerUserId" PartnerClaimType="employeeId" />

Or try Technical Profile to output with PartnerClaimType as extension_employeeNumber

Also see Azure AD B2C: Custom claims with custom policies - Microsoft Q&A

  • Make sure to enable extension attributes in the custom policy,
    provide Application ID and Application Object ID in the AAD-Common
    technical profile metadata

    Azure Active Directory

See: application properties

Please note that the Claim you set in SignUpOrSignin will be only
returned after your sign-up at that time. The custom attribute won't
be stored into Azure AD. Make sure to set the value of extension in
Base policy file .

References:

  1. azure ad b2c - B2C SAML missing claims - Stack Overflow
  2. Reading Extension Claims in Azure AD B2C - Stack Overflow
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文