繁体   English   中英

缓解来自外部 IdP 的声明可以是 string 或 stringCollection 的场景

[英]Mitigating scenario where claim from external IdP can be either string or stringCollection

我的公司必须与发出组声明的多个外部 IdP(使用行业标准解决方案,如 AD FS、F5 等)联合。

当用户有多个组时,这些 IdP 会使用以下格式的声明发出响应:

"groups": ["Domain Users", "US Users", "Administrators"]

但是当用户只有一个组时:

"groups": "Domain Users"

这是 TrustFrameworkExtensions 中定义的 b2cGroups ClaimType:

<ClaimType Id="b2cGroups">
    <DisplayName>Groups</DisplayName>
    <DataType>stringCollection</DataType>
    <AdminHelpText>User's groups.</AdminHelpText>
</ClaimType>

以及外部 IdP TechnicalProfile 中的 OutputClaim:

<OutputClaim ClaimTypeReferenceId="b2cGroups" PartnerClaimType="groups" />

在当前配置中,当用户只有一个组时,B2C 会抛出一个致命异常:

The data type 'String' of the claim with id 'groups' does not match the DataType 'StringCollection' of ClaimType with id 'b2cGroups' specified in the policy.

我可以将声明定义从 stringCollection 更改为字符串:

<ClaimType Id="b2cGroups">
    <DisplayName>Groups</DisplayName>
    <DataType>string</DataType>
    <AdminHelpText>User's groups.</AdminHelpText>
</ClaimType>

但是现在当一个用户有多个组时:

The data type 'StringCollection' of the claim with id 'groups' does not match the DataType 'String' of ClaimType with id 'b2cGroups' specified in the policy.

异常发生在 OIDC 或 SAML2 技术配置文件本身的执行期间,因此我无法使用声明转换来操作数据。 似乎 B2C 对这种潜在的数据类型不一致毫不宽容,这在理论上是正确的,但在实践中,主要的联合身份解决方案(例如 AD FS,它也是 MS 产品)不遵守此标准。

这已成为一个未解决的主要问题,将迫使我们拆除现有的 B2C 基础设施并迁移到另一个 CIAM 解决方案。 是否有可以应用的修复程序或 hack 来缓解此问题?

唯一的解决方法是不在 IdP 技术配置文件中返回声明,而是在后续步骤中调用 API 并让它从 IdP 获取值并始终将数组返回给 B2C。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM