【发布时间】:2015-10-24 00:39:25
【问题描述】:
我正在实施 SAML 单点登录并使用 idp 发起的登录请求方法。登录后,它使用 base64 编码的 SAML 响应将用户重定向到请求中定义的登录 url。
现在,我已提取此响应,对其进行验证并获取 Idp 发送的属性值,例如电子邮件地址、姓名等。
我已从 base64 解码并得到以下 XML。此 XML 已加密 Signature、CipherData、Certificate 等。但不知道如何验证和解码/提取属性值,以便我们进一步使用它。
我通过提供私钥来搜索它并喜欢正在解码它的online tool。我试了一下,得到了属性值。
我必须在使用 PHP 的应用程序中做同样的事情,并且必须使用这个属性值。如果有人做过同样的事情并且可以对此有所了解,那将不胜感激。
请检查下面的 SAML 响应。
<samlp:Response Version="2.0" ID="vafmraxdfkermx" IssueInstant="2015-07-31T07:26:00.180Z" Destination="http://domain.com/saml/SSO" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">MI-TEST-SAML2-EntityID</saml:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#DLSr8z03t7WZ-F7ZFwbxUw91vQF">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>gnvnDwu/eDBpLnPtiaHeOI7UCD4=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
Signature Value
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
Certifivate Contents
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</samlp:Status>
<saml:EncryptedAssertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
<xenc:EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<xenc:EncryptedKey>
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
<xenc:CipherData>
<xenc:CipherValue>CIPHER VALUE</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedKey>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>CIPHER CONTETNS</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
</saml:EncryptedAssertion>
【问题讨论】:
标签: php single-sign-on saml opensaml