Single sign on Ping联邦成员在验证SAML响应时抛出错误:cvc-complex-type.2.4c:
我正在向Ping Federate发送SAML响应。如果SAML响应包含SAML属性,则其工作正常,而如果SAML响应不包含SAML属性,则抛出以下错误: 响应XML无效。错误:[错误:cvc-complex-type.2.4c: 预期要素Attribute@urn:oasis:names:tc:SAML:2.0:assertion EncryptedAttribute@urn:oasis:names:tc:SAML:2.0:assertion在 元素中内容的结尾 AttributeStatement@urn:oasis:names:tc:SAML:2.0:assertion] 下面是不带引发此错误的SAML属性的SAML响应:Single sign on Ping联邦成员在验证SAML响应时抛出错误:cvc-complex-type.2.4c:,single-sign-on,saml,opensaml,pingfederate,Single Sign On,Saml,Opensaml,Pingfederate,我正在向Ping Federate发送SAML响应。如果SAML响应包含SAML属性,则其工作正常,而如果SAML响应不包含SAML属性,则抛出以下错误: 响应XML无效。错误:[错误:cvc-complex-type.2.4c: 预期要素Attribute@urn:oasis:names:tc:SAML:2.0:assertion EncryptedAttribute@urn:oasis:names:tc:SAML:2.0:assertion在 元素中内容的结尾 AttributeStatem
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" Destination="https://test/sp/ACS.saml2" ID="frtgckggfpwphf_vxeatxzlvgrq" IssueInstant="2018-08-30T11:50:38.183Z" Version="2.0">
<saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">Test</saml2:Issuer>
<saml2p:Status>
<saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="_4947dc191f01c1e98d448c2fadd5c289" IssueInstant="2018-08-30T11:50:38.183Z" Version="2.0">
<saml2:Issuer>Test</saml2:Issuer>
<saml2:Subject>
<saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">testUser</saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml2:SubjectConfirmationData NotOnOrAfter="2018-08-30T11:52:38.183Z" Recipient="https://test/sp/ACS.saml2"/>
</saml2:SubjectConfirmation>
</saml2:Subject>
<saml2:Conditions NotBefore="2018-08-30T11:50:38.183Z" NotOnOrAfter="2018-08-30T11:52:38.183Z">
<saml2:AudienceRestriction>
<saml2:Audience>TestAudience</saml2:Audience>
</saml2:AudienceRestriction>
</saml2:Conditions>
<saml2:AuthnStatement AuthnInstant="2018-08-30T11:50:38.184Z" SessionIndex="_4947dc191f01c1e98d448c2fadd5c289">
<saml2:AuthnContext>
<saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml2:AuthnContextClassRef>
</saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement/>
</saml2:Assertion>
</saml2p:Response>
我相信这可能是因为
<saml2:AttributeStatement/>
但是在线工具说上面的XML是有效的
Ping联邦成员是否需要SAML响应的特定格式,即如果不存在SAML属性,则不使用“saml2:AttributeStatement”,或者这是完全不同的问题
谢谢SAML核心规范说:
2.7.3要素
元素描述SAML权威机构声明
断言主题与指定的属性相关联。
包含元素的断言必须包含
要素它的类型为AttributeStatementType,它扩展了
语句AbstractType,添加了以下元素:
或[一个或多个]
元素指定断言主题的属性。加密文件
SAML属性可能包含在元素中。
下面的模式片段定义了元素
及其AttributeStatementType复杂类型:
<element name="AttributeStatement" type="saml:AttributeStatementType"/>
<complexType name="AttributeStatementType">
<complexContent>
<extension base="saml:StatementAbstractType">
<choice maxOccurs="unbounded">
<element ref="saml:Attribute"/>
<element ref="saml:EncryptedAttribute"/>
</choice>
</extension>
</complexContent>
</complexType>
您使用的在线工具不正确,它们可能只是验证XML,而不是根据SAML模式进行验证:您必须在AttributeStatement中包含和一个或多个属性或EncryptedAttribute
FWIW:如果你不打算发送任何属性,你可以一起省略AttributeStatement,只是发送一个空属性违反了规范。谢谢,我相信在这种情况下我将不得不跳过“AttributeStatement”。