此查詢是在HTTP-Redirect Binding SAML Request之後詢問的問題的補充。HTTP-Redirect綁定SAML請求的URL中的簽名值應該是什麼
我試圖通過HTTP-Redirect綁定發送SAML身份驗證請求來實現dotnet SSO解決方案。 生成SAML AuthnRequest並使用私人證書SP計算簽名後,我嘗試了兩種方法在url中添加簽名。
生成SAML AuthnRequest XML。
<?xml version="1.0" encoding="utf-8"?> <AuthnRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="_d726aced-4c62-4562-8237-062f7faf0750" Version="2.0" IssueInstant="2015-04-03T19:59:58.6709058Z" Destination="https://idp.client.com/adfs/ls/" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" AssertionConsumerServiceURL="https://serviceprovider.clientportal.com/samlsso.aspx" xmlns="urn:oasis:names:tc:SAML:2.0:protocol" > <Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">https://serviceprovider.clientportal.com</Issuer> <NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" /> </AuthnRequest>
- 使用SAML AuthnRequest XML其生成XML簽名標記如下所示
<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="#_d726aced-4c62-4562-8237-062f7faf0750"> <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>rxoGtdmI...rgY=</DigestValue> </Reference> </SignedInfo> <SignatureValue>XRLdJHIGWClJxp....fTPUfIghl5kTfV4=</SignatureValue>
方法-1到在查詢字符串添加簽名
計算簽名
對AuthnRequest XML進行編碼(沒有嵌入簽名)使用利用Base64編碼和URL編碼
Base64編碼和URL編碼
- 編碼上述XML簽名串構建URL以如下方式
https://IDP.com/adfs/ls/?SAMLRequest=UrlEncodedBase64AuthnRequest&RelayState=value&SigAlg=value&Signature=UrlEncodedBase64EncodedXMLSignature
方法-2在添加簽名查詢字符串
使用Base64編碼和URL編碼對AuthnRequest XML(無簽名嵌入)進行編碼
- 從上面的xml簽名字符串中提取標籤的值,作爲「簽名」查詢字符串參數的URL編碼值發送。
構建通過以下方式
https://IDP.com/adfs/ls/?SAMLRequest=UrlEncodedBase64AuthnRequest&RelayState=value&SigAlg=value&Signature=UrlEncodedValueExtractedFromSignatureValueTag
在這兩種情況下我得到簽名驗證失敗在IDP的URL。有關如何生成要在URL中發送的簽名的想法?
對此的任何幫助將有很大的幫助!
謝謝,
Piush
Thanks ComponentSpace。 – Piush