在执行我的自定义 SignUpSignIn 策略后,如何 return PolicyId 声明?
How can I return the PolicyId Claim after executing my Custom SignUpSignIn policy?
我希望 policyId 包含在执行我的自定义 SignUpSignIn 政策时返回的声明中。
我认为这应该在索赔 ID tfp
中。
有 is an article 如何做到这一点。
在 "Setting claim representing policy ID" 部分中,它说要在 "Token Issuer" ClaimsProvider 覆盖中包含密钥 AuthenticationContextReferenceClaimPattern
。
<ClaimsProviders>
<ClaimsProvider>
<DisplayName>Token Issuer</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="JwtIssuer">
<Metadata>
.....
<Item Key="AuthenticationContextReferenceClaimPattern">None</Item>
</Metadata>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
</ClaimsProviders>
然后您必须在 outputClaims
中添加 trustFrameworkPolicy
。我是这样想的:
<RelyingParty>
<DefaultUserJourney ReferenceId="SignUpOrSignIn" />
<TechnicalProfile Id="PolicyProfile">
<DisplayName>PolicyProfile</DisplayName>
<Protocol Name="OpenIdConnect" />
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" />
<OutputClaim ClaimTypeReferenceId="givenName" />
<OutputClaim ClaimTypeReferenceId="surname" />
......
<OutputClaim ClaimTypeReferenceId="trustFrameworkPolicy" Required="true" DefaultValue="{policy}" />
</OutputClaims>
<SubjectNamingInfo ClaimType="sub" />
</TechnicalProfile>
但是当我上传这个自定义策略文件时显示错误:
"Policy "B2C_1A_xxxx" of tenant "yyyyy.onmicrosoft.com" makes a reference to ClaimType with id "trustframeworkPolicy" but neither the policy nor any of its base policies contain such an element."
意味着找不到 ClaimTypeReferenceId:"trustFrameworkPolicy"。
我是否必须添加 ClaimType "trustframeworkPolicy" 的声明定义?在 ClaimsSchema 中?
如果有:它是什么样的?
使用 Starter Pack
时,PolicyId
在 ACR 声明中
将以下 ClaimType
添加到 TrustFrameworkExtensions.xml
:
<ClaimType Id="trustFrameworkPolicy">
<DisplayName>Trust Framework Policy</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="tfp" />
<Protocol Name="OpenIdConnect" PartnerClaimType="tfp" />
</DefaultPartnerClaimTypes>
</ClaimType>
注意:ClaimType
应该是<ClaimsSchema><BuildingBlocks>
的子节点
我希望 policyId 包含在执行我的自定义 SignUpSignIn 政策时返回的声明中。
我认为这应该在索赔 ID tfp
中。
有 is an article 如何做到这一点。
在 "Setting claim representing policy ID" 部分中,它说要在 "Token Issuer" ClaimsProvider 覆盖中包含密钥 AuthenticationContextReferenceClaimPattern
。
<ClaimsProviders>
<ClaimsProvider>
<DisplayName>Token Issuer</DisplayName>
<TechnicalProfiles>
<TechnicalProfile Id="JwtIssuer">
<Metadata>
.....
<Item Key="AuthenticationContextReferenceClaimPattern">None</Item>
</Metadata>
</TechnicalProfile>
</TechnicalProfiles>
</ClaimsProvider>
</ClaimsProviders>
然后您必须在 outputClaims
中添加 trustFrameworkPolicy
。我是这样想的:
<RelyingParty>
<DefaultUserJourney ReferenceId="SignUpOrSignIn" />
<TechnicalProfile Id="PolicyProfile">
<DisplayName>PolicyProfile</DisplayName>
<Protocol Name="OpenIdConnect" />
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" />
<OutputClaim ClaimTypeReferenceId="givenName" />
<OutputClaim ClaimTypeReferenceId="surname" />
......
<OutputClaim ClaimTypeReferenceId="trustFrameworkPolicy" Required="true" DefaultValue="{policy}" />
</OutputClaims>
<SubjectNamingInfo ClaimType="sub" />
</TechnicalProfile>
但是当我上传这个自定义策略文件时显示错误:
"Policy "B2C_1A_xxxx" of tenant "yyyyy.onmicrosoft.com" makes a reference to ClaimType with id "trustframeworkPolicy" but neither the policy nor any of its base policies contain such an element."
意味着找不到 ClaimTypeReferenceId:"trustFrameworkPolicy"。
我是否必须添加 ClaimType "trustframeworkPolicy" 的声明定义?在 ClaimsSchema 中?
如果有:它是什么样的?
使用 Starter Pack
时,PolicyId
在 ACR 声明中
将以下 ClaimType
添加到 TrustFrameworkExtensions.xml
:
<ClaimType Id="trustFrameworkPolicy">
<DisplayName>Trust Framework Policy</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="tfp" />
<Protocol Name="OpenIdConnect" PartnerClaimType="tfp" />
</DefaultPartnerClaimTypes>
</ClaimType>
注意:ClaimType
应该是<ClaimsSchema><BuildingBlocks>