azure - Azure AD B2C 自定义策略 - 仅使用 String.Format 删除连字符
问题描述
在 Azure B2C 自定义策略中,我想从 objectId(GUID) 声明类型中删除连字符“-”并将其分配给另一个声明类型。
例如:
输入:e8023a66-30ed-4e31-a17e-c013081704a0 输出:e8023a6630ed4e31a17ec013081704a0
我目前尝试了以下方法:
<InputParameter Id="stringFormat" DataType="string" Value="00000000000000000000000000000000,{0}" />
<InputParameter Id="stringFormat" DataType="string" Value="{0:################################}" />
<InputParameter Id="stringFormat" DataType="string" Value="{0:#}" />
我在 ClaimsTransformation 中使用 FormatStringClaim 转换方法来实现相同的目的,但是该值被分配给带有连字符的目标声明类型。
你能帮我删除连字符吗?
注意:我不能使用任何其他字符串操作,如替换或拆分,因为 Azure AD 仅支持 String.Format 方法。
解决方案
I am using FormatStringClaim transformationmethod in ClaimsTransformation to achieve the same however the value is getting assigned to the target claimtype with hyphen.
It sounds like you incorrectly configured your Claims Transformation and have assigned your original GUID as both your input and output claims. You need to update the ClaimTypeReferenceId with the claim you want to store your modified GUID in.
Example:
<ClaimsTransformation Id="RemoveHash" TransformationMethod="FormatStringClaim">
<InputClaims>
<InputClaim ClaimTypeReferenceId="originalGuid" TransformationClaimType="inputClaim" />
</InputClaims>
<InputParameters>
<InputParameter Id="stringFormat" DataType="string" Value="{0}" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="modifiedGuid" TransformationClaimType="outputClaim" />
</OutputClaims>
</ClaimsTransformation>
推荐阅读
- initialization - 如何决定使用哪种模式进行“kaiming_normal”初始化
- html - 如何使用键盘输入在 WebGL 中创建具有 n 边的 2D 形状?
- jekyll - 试图从 Front Matter 值中获取集合
- java - 无法设置我的 RecyclerView 以显示来自 API 回调的全部数据
- reactjs - Engagespot Bell 图标在 React 应用程序中不起作用
- python - Graphen Django 动态查询
- python - 如何将 Pandas Dataframe 中的字符串转换为列表或字符数组?
- javascript - 如何从 npm 构建日志中消除资金和广告噪音?
- python - 有没有办法在 matplotlib 箱线图图例中标记平均值和中位数?
- phpstorm - 如何在 PhpStorm 中的“Find in path”对话框中选择在活动文件的目录中搜索?