1

我的客户有一个 ping federate 安装,它似乎正在生成不兼容的身份验证响应文档。文档格式正确,不包含非法字符。

最大的问题是文档的节点在节点名称中不包含“ds:”。这是不幸的,因为我的身份验证库(omniauth-saml )在验证时专门寻找 ds 名称。

图书馆有错吗?Ping Federate SAML 文档有问题吗?我已经开始修补匹配器以使用 XPath 的“包含”帮助程序,但即便如此,文档的摘要和证书也不会计算到正确的值。

  1. 图书馆有错吗?
  2. Ping Federate SAML 文档有问题吗?
  3. Ping Federate 文档在规范化后是否仍应进行验证?

这是他们的 SAML 响应示例

<samlp:Response Destination="http://a/dest" IssueInstant="2012-07-12T18:21:28.011Z" ID="a.valid.rand.id" Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns="http://www.w3.org/2000/09/xmldsig#" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">http://their/issuer</saml:Issuer>
  <Signature>
    <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="#vZZQnHjOx1.u8c3uupdxDb_cmRu">
        <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>some_digest_value</DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue>some_signature_value</SignatureValue>
    <KeyInfo>
      <X509Data>
        <X509Certificate>their_well_formed_x509_cert</X509Certificate>
      </X509Data>
      <KeyValue>
        <RSAKeyValue>
          <Modulus>a_modulus</Modulus>
          <Exponent>AQAB</Exponent>
        </RSAKeyValue>
      </KeyValue>
    </KeyInfo>
  </Signature>
  <samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
  </samlp:Status>
  <saml:Assertion Version="2.0" IssueInstant="2012-07-12T18:21:28.058Z" ID="SOME_ID">
    <saml:Issuer>http://their/issuer</saml:Issuer>
    <saml:Subject>
      <saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">14096079</saml:NameID>
      <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
        <saml:SubjectConfirmationData NotOnOrAfter="2012-07-12T18:26:28.058Z" Recipient="http://link/back/to/me"/>
      </saml:SubjectConfirmation>
    </saml:Subject>
    <saml:Conditions NotOnOrAfter="2012-07-12T18:26:28.058Z" NotBefore="2012-07-12T18:16:28.058Z">
      <saml:AudienceRestriction>
        <saml:Audience>http://an/audience/restriction</saml:Audience>
      </saml:AudienceRestriction>
    </saml:Conditions>
    <saml:AuthnStatement AuthnInstant="2012-07-12T18:21:28.058Z" SessionIndex="SOME_ID">
      <saml:AuthnContext>
        <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</saml:AuthnContextClassRef>
      </saml:AuthnContext>
    </saml:AuthnStatement>
    <saml:AttributeStatement xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <saml:Attribute NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic" Name="uid">
        <saml:AttributeValue xsi:type="xs:string">a_uid</saml:AttributeValue>
      </saml:Attribute>
      <!-- removed all the other attributes -->
    </saml:AttributeStatement>
  </saml:Assertion>
</samlp:Response>
4

1 回答 1

1

让这成为一个更正式的答案......

我认为您对那行代码的解释可能不正确。我相信它正在根据 dsig 模式(http://w3.org/2000/09/xmldsig#)进行查找,而不是假设前缀是“ds”。请参阅:http ://www.germane-software.com/software/rexml_doc/classes/REXML/XPath.html

如果签名验证失败,您的问题可能与您的库如何处理 CanonicalizationMethod (http://www.w3.org/2001/10/xml-exc-c14n#) 有关。

同样 - 数百种“现成的”SAML 产品可与 PingFederate 互操作。如果您的问题是 PingFederate 从 SAML 2.0 规范中误解的结果,我会感到惊讶。

于 2012-07-17T16:32:12.027 回答