我为其中一位客户开发了自定义SAML IdP。但是,当尝试将以下响应传递给SP时,它将失败。我尝试使用在线提供的一些SAML在线工具验证响应,我看到一些错误,但我无法弄清楚错误。有人可以帮忙吗?
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="_8ad9eb0c-c65c-4327-ae76-ae238ca17e96"
Version="2.0"
IssueInstant="2017-06-28T13:53:06.9612024Z"
Destination="https://crnm.lessonly.com/auth/saml/callback"
xmlns="urn:oasis:names:tc:SAML:2.0:protocol"
>
<saml:Issuer>https://crnm.lessonly.com/auth/saml/metadata</saml:Issuer>
<Status>
<StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</Status>
<saml:Assertion Version="2.0"
ID="_4761e320-64e8-4d8a-a443-2e4e2ccb3e98"
IssueInstant="2017-06-28T13:53:06.9612024Z"
>
<saml:Issuer>https://crnm.lessonly.com/auth/saml/metadata</saml:Issuer>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">amilev1@visualantidote.com</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData Recipient="https://crnm.lessonly.com/auth/saml/callback"
NotOnOrAfter="2017-06-28T13:58:06.9768269Z"
/>
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2017-06-28T13:53:06.9768269Z"
NotOnOrAfter="2017-06-28T13:58:06.9768269Z"
>
<saml:AudienceRestriction>
<saml:Audience>https://crnm.lessonly.com/auth/saml/metadata</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2017-06-28T13:53:06.9768269Z"
SessionIndex="_4761e320-64e8-4d8a-a443-2e4e2ccb3e98"
>
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Attribute Name="UserID"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
>
<saml:AttributeValue xsi:type="xsd:string">125481</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="email"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
>
<saml:AttributeValue xsi:type="xsd:string">amilev1@visualantidote.com</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="first_name"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
>
<saml:AttributeValue xsi:type="xsd:string">Angel1</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="last_name"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
>
<saml:AttributeValue xsi:type="xsd:string">Milev1</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="name"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"
>
<saml:AttributeValue xsi:type="xsd:string">Angel1 Milev1</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="#_4761e320-64e8-4d8a-a443-2e4e2ccb3e98">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>UB/5XN1dGa2/w0aKRmmq2oFvbOE=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>JTkUhfmk2ngPQnFtSC41WQodJj0MyCHw8oCJbEQE32vgViV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BTADAQH/MA0GCSqGSIb3DQEBDQUAA4IBAgCPzeVaQNP3Bm796QT5R2r0Ur537xkN9f6W69paWfh2Ti7FzVyBCUMUMHL55dR24m45Xl7X2rurwZnr3oyibcCUENk2nYQ3uadoXTj3q5jfW2KxTx0DQH2F4D3TqxUpsTcJpt5eG+2mFheAyG6A+k719ShVgV6BtW1A1U9KJMD7UeWbejBGKrAC3AkCQyIaBjw+64sed8NN+jRPaEJxJ/APpHEBRiXQQOtnTKoRoz9ZvRvJTZ0N65/s+Cs7c2Y56PonWjlY2Kt4W5tp4VZTCmwnGmvMApyrWr/IZ9GgJsSz1EmbfVGKjKLHM29xXxnBLmkfGdc1yU4HXZYVFh00Ds6cgA==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</saml:Assertion>
</Response>
使用samltool.com上的验证器我收到以下错误:
XML无效。
行:69 |栏:0 - &gt;元素&#39; {http://www.w3.org/2000/09/xmldsig#}签名&#39;:此元素不是预期的。
答案 0 :(得分:1)
SAML XSD要求Signature元素位于Issuer元素之后