如何使用 WSO2 Identity Server 5.3 生成多值属性 SAML2 断言?

How to generate multivalued attribute SAML2 assertion using WSO2 Identity Server 5.3?

我正在使用 WSO2 身份服务器 5.3

我必须使用用户配置文件中的一些多值属性生成 SAML2 断言。

假设我有一个特定声明的逗号分隔值列表,我必须在我的 saml 断言响应中使用以下结构来组织这些属性:

<saml2:Attribute Name="attribute1">
    <saml2:AttributeValue>value1</saml2:AttributeValue>
    <saml2:AttributeValue>value2</saml2:AttributeValue>
    <saml2:AttributeValue>value3</saml2:AttributeValue>
    <saml2:AttributeValue>value4</saml2:AttributeValue>
</saml2:Attribute>

我配置了一个 STS 客户端以从我设置了多值声明的特定用户那里获取 SAML2 断言和声明。

我的问题是我得到的 SAML 断言响应结构如下:

<saml2:Attribute Name="attribute1">
    <saml2:AttributeValue>value1,value2,value3,value4</saml2:AttributeValue>
 </saml2:Attribute>

我在 tomcat 上设置了一个 travelocity 应用程序的实例,再次测试并在登录应用程序并选择 SAML 流程后获得了预期的 SAML 断言。我可以通过查看身份服务器的日志文件来验证它。

我也使用 STS 客户端 [1] 来获取 SAML 断言,但是当涉及到多值属性时,我得到的是该特定属性的逗号分隔值。

我直接使用 SOAP UI 作为我的客户端使用管理服务 https://localhost:9443/services/wso2carbon-sts?wsdl,但 SAML 响应与我之前所说的完全相同,多值属性以逗号分隔值的形式出现特定属性。

这是我在“属性声明”部分获得的示例:

<saml2:AttributeStatement>
    <saml2:Attribute Name="http://wso2.org/claims/im" NameFormat="http://wso2.org/claims/im">
        <saml2:AttributeValue
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">jairo_fernandezr,jb_fernandez
        </saml2:AttributeValue>
    </saml2:Attribute>
    <saml2:Attribute Name="http://wso2.org/claims/emailaddress" NameFormat="http://wso2.org/claims/emailaddress">
        <saml2:AttributeValue
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">jairo.fernandez@chakray.com
        </saml2:AttributeValue>
    </saml2:Attribute>
    <saml2:Attribute Name="http://wso2.org/claims/givenname" NameFormat="http://wso2.org/claims/givenname">
        <saml2:AttributeValue
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Jairo
        </saml2:AttributeValue>
    </saml2:Attribute>
</saml2:AttributeStatement>

现在,我想问您是否有另一种方法可以使用管理服务 https://localhost:9443/services/wso2carbon-sts?wsdl 或其他无需设置的方法来获得结构为单个值而不是逗号分隔值的多值属性的 SAML 断言启动 Travelocity 应用程序。

[1] https://github.com/wso2/product-is/tree/5.x.x/modules/samples/sts

任何意见将不胜感激。

谢谢

WSO2 身份服务器 5.3.0 在涉及 Web SAML SSO 流程时表现正确。

但是默认情况下可以在 https://localhost:9443/services/wso2carbon-sts 找到的服务 wso2carbon-sts 的行为与我在原始 post 中描述的不同。

我已将此报告给 WSO2 团队,他们在 Identity Server 的项目中注册了一个错误,您可以查看详细信息here,如果您有兴趣,可以跟进。

感谢您的支持