[英]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.