Azure B2C:在哪里创建要在自定义策略中使用的DateTime扩展属性-门户或自定义策略,还是两者兼而有之? [英] Azure B2C: Where to Create DateTime Extension Attribute to be used in Custom Policy- Portal or Custom Policy or Both?
本文介绍了Azure B2C:在哪里创建要在自定义策略中使用的DateTime扩展属性-门户或自定义策略,还是两者兼而有之?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在数据类型&DateTime&Quot;的自定义策略中使用扩展属性。我按如下方式定义了声明类型。
<ClaimType Id="extension_myAttribute">
<DisplayName>myAttrbute</DisplayName>
<DataType>dateTime</DataType>
<UserHelpText>This is for X</UserHelpText>
</ClaimType>
我希望能够将此属性与当前时间进行比较,从而指导用户旅程。但是,当我查看应用程序洞察时,该值是&unfined";,因此,将其与包含当前时间的声明类型进行比较对我没有好处。即使我将该属性添加到信赖方文件的OutputClaims中,也缺少该属性作为声明。
第一季度。这样申报就够了吗? Q2.我是否也需要在门户中的用户属性下创建它?我不确定,因为在门户中只有int、boolean和字符串数据类型可用。我可以用它们中的任何一个来代替日期时间吗?
编辑 下面是使用属性
的转换 <ClaimsTransformation Id="SetMyAttribute" TransformationMethod="GetCurrentDateTime">
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_MyAttribute" TransformationClaimType="currentDateTime" />
</OutputClaims>
</ClaimsTransformation>
感谢您的帮助!
推荐答案
非常感谢你们两位的努力。在我的场景中,我需要在登录时更新扩展属性,而不是在建议的示例中进行注册。为了解决此问题,我在Azure AD Claims提供程序中添加了一个额外的AAD-XXX技术配置文件,该配置文件可以执行‘WRITE’操作,但带有RaiseErrorIfClaimsPulalAlreadyExist=>;‘False’。这使我能够在InputClaimtsTransform元素中调用我的Claims转换,然后使用PersistedClaims元素写入AAD。类似于下面的内容。我希望这对其他人有帮助。
<TechnicalProfile Id="AAD-XXXX">
<Metadata>
<Item Key="Operation">Write</Item>
<Item Key="RaiseErrorIfClaimsPrincipalAlreadyExists">false</Item>
</Metadata>
<InputClaimsTransformations>
<!--call claims transformation-->
<InputClaimsTransformation ReferenceId="MyClaimsTransformation" />
</InputClaimsTransformations>
<InputClaims>
<InputClaim ClaimTypeReferenceId="objectId" />
</InputClaims>
<PersistedClaims>
<!-- Required claims -->
<PersistedClaim ClaimTypeReferenceId="objectId" />
<PersistedClaim ClaimTypeReferenceId="userPrincipalName" />
<PersistedClaim ClaimTypeReferenceId="displayName" />
<PersistedClaim ClaimTypeReferenceId="extension_MyExtensionAttribute" />
</PersistedClaims>
<IncludeTechnicalProfile ReferenceId="AAD-Common" />
<UseTechnicalProfileForSessionManagement ReferenceId="SM-AAD" />
</TechnicalProfile>
这篇关于Azure B2C:在哪里创建要在自定义策略中使用的DateTime扩展属性-门户或自定义策略,还是两者兼而有之?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文