[英]How do you implement SAML for SSO with Influitive?
我正在尝试通过SAML为我的Influitive集线器实现SSO。 我在这里遵循了他们的文档,并根据他们的规范设置了我的环境。 我具有证书的指纹以及通过QueryString处理其SAMLRequest的端点。
我正在使用此处概述的Web浏览器SSO用例。
为了形成我的SAML响应,我遵循了此处的示例。
我还按照此示例生成证书,以及生成并签名SAML响应。 但是,在修复实现过程中,我将签名方法更改为SHA1。
为了提交表单,我将代码背后的值绑定到了一个HTML表单,该表单本质上就是这样发布的:
<form method="post" action="https://{myhub}.influitive.com/saml/consume" />
<input type="hidden" name="SAMLResponse" value="{Base64EncodedStringofSAMLResponse}" />
<input type="hidden" name="RelayState" value="https://{myhub}.influitive.com/about" />
</form>
<script>
if ("{Base64EncodedStringofSAMLResponse}" != "") {
window.onload = function () {
document.forms[0].submit();
}
}
</script>
问题是,无论我的表单POST何时,即使我的SAML响应已正确形成,签名和编码,我仍会收到500 Internal Server错误。 我该如何解决?
问题实际上出在我的SAML响应中不必要的“ Issuer”标签上。
根据在网上找到的示例,我包括了其中的两个。 我取出了Issuer标记的第一个实例,但是将第二个实例留在了Assertion标记内,并且可以正常工作。 有影响力的支持人员在我的集线器的日志中查找并向我发送了一条错误消息,大致说明了这一点。
这是格式正确的已签名SAML响应的示例。
<samlp:Response
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Destination="https://{YOURHUB}.influitive.com/saml/consume"
ID="{A GUID}"
IssueInstant="{CURRENT UTC TIME}"
Version="2.0"
InResponseTo="{ID of Influitive SAMLRequest, or leave blank for IdP initiated SSO}">
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
<Reference URI="#_f44dfe01e93143d7b1e1b9e826ace708">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<DigestValue>{The DigestValue}</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>{The SignatureValue}<SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>{The X509Cert}</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</samlp:Status>
<saml:Assertion
ID="{A SECOND GUID}"
IssueInstant="{CURRENT UTC TIME}"
Version="2.0">
<saml:Issuer>{Name of the Issuer. Shouldn't really matter}</saml:Issuer>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress" NameQualifier="Influitive-AdvocateHub">example@gmail.com</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml:SubjectConfirmationData NotOnOrAfter="{CURRENT UTC TIME + 1 MINUTE}" Recipient="https://{YOURHUB}.influitive.com/saml/consume" InResponseTo="{ID of Influitive SAMLRequest, or leave blank for IdP initiated SSO}" />
</saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="{CURRENT UTC TIME}" NotOnOrAfter="{CURRENT UTC TIME + 1 MINUTE}">
<saml:AudienceRestriction>
<saml:Audience>Influitive-AdvocateHub</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="{CURRENT UTC TIME}">
<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="FirstName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">{SOME FIRST NAME}</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="LastName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">{SOME LAST NAME}</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="Email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
<saml:AttributeValue xsi:type="xs:string">{example@gmail.com}</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
如果您对如何生成此SAML响应,如何使用证书进行签名,编码或其他任何问题还有其他疑问,请告诉我! 这是一个巨大的PITA,我很乐意借此机会帮助其他任何人。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.