gpt4 book ai didi

azure - SAML 响应 - 需要验证什么才能确保响应可信?

转载 作者:行者123 更新时间:2023-12-03 01:51:00 25 4
gpt4 key购买 nike

如果这些看起来像是重复的,我深表歉意,但我一直在搜索这些帖子,但找不到我想要的确切内容。

我的 Web 应用程序正在向 Azure 发送身份验证请求以进行单点登录。收到响应后,需要验证哪些字段和属性以确保断言可信,为什么?

来自 Microsoft 文档的响应示例 -

<samlp:Response ID="_a4958bfd-e107-4e67-b06d-0d85ade2e76a" Version="2.0" IssueInstant="2013-03-18T07:38:15.144Z" Destination="https://contoso.com/identity/inboundsso.aspx" InResponseTo="id758d0ef385634593a77bdf7e632984b6" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion"> https://login.microsoftonline.com/82869000-6ad1-48f0-8171-272ed18796e9/</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
...
</ds:Signature>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</samlp:Status>
<Assertion ID="_bf9c623d-cc20-407a-9a59-c2d0aee84d12" IssueInstant="2013-03-18T07:38:15.144Z" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
<Issuer>https://login.microsoftonline.com/82869000-6ad1-48f0-8171-272ed18796e9/</Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
...
</ds:Signature>
<Subject>
<NameID>Uz2Pqz1X7pxe4XLWxV9KJQ+n59d573SepSAkuYKSde8=</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<SubjectConfirmationData InResponseTo="id758d0ef385634593a77bdf7e632984b6" NotOnOrAfter="2013-03-18T07:43:15.144Z" Recipient="https://contoso.com/identity/inboundsso.aspx" />
</SubjectConfirmation>
</Subject>
<Conditions NotBefore="2013-03-18T07:38:15.128Z" NotOnOrAfter="2013-03-18T08:48:15.128Z">
<AudienceRestriction>
<Audience>https://www.contoso.com</Audience>
</AudienceRestriction>
</Conditions>
<AttributeStatement>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name">
<AttributeValue><a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bacedfc9cecfc9dfc8fad9d5d4ced5c9d594d9d5d7" rel="noreferrer noopener nofollow">[email protected]</a></AttributeValue>
</Attribute>
<Attribute Name="http://schemas.microsoft.com/identity/claims/objectidentifier">
<AttributeValue>3F2504E0-4F89-11D3-9A0C-0305E82C3301</AttributeValue>
</Attribute>
...
</AttributeStatement>
<AuthnStatement AuthnInstant="2013-03-18T07:33:56.000Z" SessionIndex="_bf9c623d-cc20-407a-9a59-c2d0aee84d12">
<AuthnContext>
<AuthnContextClassRef> urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</Assertion>
</samlp:Response>

到目前为止我所知道的。

  • 您必须验证签名以确保消息未被修改。
  • 您必须验证证书公钥是否来自受信任的来源,否则任何有效签名的证书都将进行身份验证。

还有什么?

最佳答案

  • 签名 - 记得check the references .
  • 验证证书是否来自正确的同级(正如您自己所注意到的那样)
  • 断言的条件。

我建议您不要为此编写自己的代码,而是使用现有的 SAML2 SP 库。把所有这些都做好需要大量的工作(我已经做到了,而且我不确定如果我知道这需要多少工作的话我会做)。

关于azure - SAML 响应 - 需要验证什么才能确保响应可信?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37199472/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com