密码重置自定义策略中的输出自定义属性

Output custom attribute in Password Reset Custom Policy

我有密码重置的自定义策略。 Azure B2C 上自定义策略入门包附带的那个。我希望它输出两个我已经定义的自定义属性。我让这些属性与自定义 signup/signin 和 edif 配置文件一起使用,我可以在执行这些策略后在 jwt 中看到它们。但我不知道如何使用密码重置策略输出它们。可能吗?或者用户必须登录才能运行?

提前致谢!

您可以通过在 "LocalAccountWritePasswordUsingObjectId" 技术配置文件在第 2 步保存密码后和 "PasswordReset" 用户旅程中添加新的编排步骤来实现此目的=24=] 第 3 步的技术简介。

这个新的编排步骤通过调用 "AAD-UserReadUsingObjectId" 技术配置文件读取用户,包括自定义声明:

(我假设您已将自定义声明作为 <OutputClaim /> 添加到此技术配置文件中。)

<UserJourney Id="PasswordReset">
  <OrchestrationSteps>
    <OrchestrationStep Order="1" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="PasswordResetUsingEmailAddressExchange" TechnicalProfileReferenceId="LocalAccountDiscoveryUsingEmailAddress" />
      </ClaimsExchanges>
    </OrchestrationStep>
    <OrchestrationStep Order="2" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="NewCredentials" TechnicalProfileReferenceId="LocalAccountWritePasswordUsingObjectId" />
      </ClaimsExchanges>
    </OrchestrationStep>
    <OrchestrationStep Order="3" Type="ClaimsExchange">
      <ClaimsExchanges>
        <ClaimsExchange Id="AADUserReadWithObjectId" TechnicalProfileReferenceId="AAD-UserReadUsingObjectId" />
      </ClaimsExchanges>
    </OrchestrationStep>
    <OrchestrationStep Order="4" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer" />
  </OrchestrationSteps>
  <ClientDefinition ReferenceId="DefaultWeb" />
</UserJourney>

然后您必须将自定义声明作为 <OutputClaim /> 添加到 "PasswordReset" 依赖方策略:

<RelyingParty>
  <DefaultUserJourney ReferenceId="PasswordReset" />
  <TechnicalProfile Id="PolicyProfile">
    <DisplayName>PolicyProfile</DisplayName>
    <Protocol Name="OpenIdConnect" />
    <OutputClaims>
      <OutputClaim ClaimTypeReferenceId="email" />
      <OutputClaim ClaimTypeReferenceId="objectId" PartnerClaimType="sub" />
      <OutputClaim ClaimTypeReferenceId="myCustomClaim1" />
      <OutputClaim ClaimTypeReferenceId="myCustomClaim2" />
    </OutputClaims>
    <SubjectNamingInfo ClaimType="sub" />
  </TechnicalProfile>
</RelyingParty>