将 DefaultValue 设置为 DateTime.Now() 等效
Set DefaultValue to DateTime.Now() Equivalent
如何将默认值设置为当前日期和时间?
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_MyCustomClaim" DefaultValue="DateTime.Now()">
</OutputClaims>
ClaimType
供参考:
<ClaimType Id="extension_MyCustomClaim">
<DisplayName>Some Date/Time</DisplayName>
<DataType>date</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="myCustomClaim" />
<Protocol Name="OpenIdConnect" PartnerClaimType="myCustomClaim" />
</DefaultPartnerClaimTypes>
<AdminHelpText>Some date time</AdminHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
更新
Unable to upload policy. Reason : Validation failed: 1 validation error(s) found in policy "B2C_1A_TRUSTFRAMEWORK_BUILDINGBLOCKS" of tenant "my-tenant.onmicrosoft.com".The OutputClaims mismatched in ClaimsTransformation with id "GetSystemDateTime" with TransformationMethod "GetCurrentDateTime".
The following OutputClaims were declared in the Policy but were not expected by the TransformMethod: [Date]currentDateTime. The following OutputClaims were expected by the TransformMethod but were not declared in the Policy: [DateTime]currentDateTime.
想知道我是否需要更新的 base.xml
文件?想法?
您可以声明类型为 GetCurrentDateTime 的声明转换,然后从技术配置文件中调用它作为输出声明转换:
<ClaimsTransformation Id="GetNow" TransformationMethod="GetCurrentDateTime">
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_MyCustomClaim" TransformationClaimType="currentDateTime" />
</OutputClaims>
</ClaimsTransformation>
此外,ClaimType
的 DataType
必须是 dateTime
<ClaimType Id="extension_MyCustomClaim">
...
<DataType>dateTime</DataType>
...
</ClaimType>
如何将默认值设置为当前日期和时间?
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_MyCustomClaim" DefaultValue="DateTime.Now()">
</OutputClaims>
ClaimType
供参考:
<ClaimType Id="extension_MyCustomClaim">
<DisplayName>Some Date/Time</DisplayName>
<DataType>date</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="myCustomClaim" />
<Protocol Name="OpenIdConnect" PartnerClaimType="myCustomClaim" />
</DefaultPartnerClaimTypes>
<AdminHelpText>Some date time</AdminHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
更新
Unable to upload policy. Reason : Validation failed: 1 validation error(s) found in policy "B2C_1A_TRUSTFRAMEWORK_BUILDINGBLOCKS" of tenant "my-tenant.onmicrosoft.com".The OutputClaims mismatched in ClaimsTransformation with id "GetSystemDateTime" with TransformationMethod "GetCurrentDateTime".
The following OutputClaims were declared in the Policy but were not expected by the TransformMethod: [Date]currentDateTime. The following OutputClaims were expected by the TransformMethod but were not declared in the Policy: [DateTime]currentDateTime.
想知道我是否需要更新的 base.xml
文件?想法?
您可以声明类型为 GetCurrentDateTime 的声明转换,然后从技术配置文件中调用它作为输出声明转换:
<ClaimsTransformation Id="GetNow" TransformationMethod="GetCurrentDateTime">
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_MyCustomClaim" TransformationClaimType="currentDateTime" />
</OutputClaims>
</ClaimsTransformation>
此外,ClaimType
的 DataType
必须是 dateTime
<ClaimType Id="extension_MyCustomClaim">
...
<DataType>dateTime</DataType>
...
</ClaimType>