我编写了一个测试服务来返回 Http Bad 请求来触发错误。我正在尝试从 B2C 调用它。但是 userMessage NOT 没有被显示。它继续进行其他验证。我做错了什么?
Postman 测试我的测试服务。
以下是我在 B2C 中定义的调用该测试服务的方式。请求与Postman测试相同。
<ClaimType Id="testRequestBodyClaimType">
<DisplayName>REST request body</DisplayName>
<DataType>string</DataType>
</ClaimType>
<ClaimsTransformation Id="testGenerateJsonPayloadTransformation" TransformationMethod="GenerateJson">
<InputParameters>
<InputParameter Id="version" DataType="string" Value="1.0.0" />
<InputParameter Id="status" DataType="string" Value="409" />
<InputParameter Id="userMessage" DataType="string" Value="Your error message 2" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="testRequestBodyClaimType" TransformationClaimType="outputClaim" />
</OutputClaims>
</ClaimsTransformation>
<TechnicalProfile Id="REST-Test">
<DisplayName>Check Azure Function web hook testing test</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.RestfulProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ServiceUrl">https://xxxx.azurewebsites.net/api/myTest</Item>
<Item Key="AuthenticationType">Bearer</Item>
<Item Key="SendClaimsIn">Body</Item>
<Item Key="ClaimUsedForRequestPayload">testRequestBodyClaimType</Item>
</Metadata>
<CryptographicKeys>
<Key Id="BearerAuthenticationToken" StorageReferenceId="xxxx" />
</CryptographicKeys>
<InputClaimsTransformations>
<InputClaimsTransformation ReferenceId="testGenerateJsonPayloadTransformation" />
</InputClaimsTransformations>
<InputClaims>
<InputClaim ClaimTypeReferenceId="testRequestBodyClaimType" />
</InputClaims>
</TechnicalProfile>
这是来自应用程序洞察的日志记录。
{
"Key": "TechnicalProfileEnabled",
"Value": {
"EnabledRule": "Always",
"EnabledResult": true,
"TechnicalProfile": "REST-Test"
}
},
{
"Key": "ValidationTechnicalProfile",
"Value": {
"Values": [
{
"Key": "TechnicalProfileId",
"Value": "REST-Test"
},
{
"Key": "ClaimsTransformation",
"Value": {
"Values": [
{
"Key": "Id",
"Value": "testGenerateJsonPayloadTransformation"
},
{
"Key": "InputParameter",
"Value": {
"Id": "version",
"Value": "1.0.0"
}
},
{
"Key": "InputParameter",
"Value": {
"Id": "status",
"Value": "409"
}
},
{
"Key": "InputParameter",
"Value": {
"Id": "userMessage",
"Value": "Your error message 2"
}
},
{
"Key": "Result",
"Value": {
"PolicyClaimType": "testRequestBodyClaimType",
"Value": "{\"version\":\"1.0.0\",\"status\":\"409\",\"userMessage\":\"Your error message 2\"}"
}
}
]
}
},
{
"Key": "MappingPartnerTypeForClaim",
"Value": {
"PartnerClaimType": "testRequestBodyClaimType",
"PolicyClaimType": "testRequestBodyClaimType"
}
}
]
}
}
谷歌和测试...参见上面的代码和日志
我是文卡塔潘楚玛蒂。 太棒了。这篇文章非常好,内容非常丰富。感谢分享这么好的帖子