尝试将 SAML 服务提供商应用程序与 AD FS 集成。 SSO 工作正常。对于 SLO,注销失败并显示“请求者”状态代码。 ADFS 服务的事件查看器中没有针对此特定错误的日志记录/跟踪信息。这个问题之前已经被问过几次了,大多数都指向了一个无效的 NameId
发送到 LogoutRequest
。但是,LogoutRequest NameId
似乎没问题。
还尝试存储会话索引并发送为 SessionIndex
,但错误是相同的。
以下是相关信息
AssertionResponse Subject
<Subject>
<NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">alice@mail2.corp2.contoso.net</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><SubjectConfirmationData InResponseTo="_43372d41-c455-4322-970a-db4c1acf73bc"
NotOnOrAfter="2021-03-03T09:41:58.596Z" Recipient="https://myapp.corp2.dev.net:8050/saml2/adfs/acs"/></SubjectConfirmation>
</Subject>
LogoutRequest
<samlp:LogoutRequest Destination="https://adfs.corp2.contoso.net/adfs/ls/"
ID="_5bcedc5e-8847-41c6-95b3-29740f0463ec" IssueInstant="2021-03-03T09:37:03Z" Version="2.0"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<saml:Issuer>https://myapp.corp2.dev.net:8050/saml2/adfs/metadata</saml:Issuer>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">alice@mail2.corp2.contoso.net</saml:NameID>
</samlp:LogoutRequest>
LogoutResponse
<samlp:LogoutResponse ID="_85f5200f-179a-40f8-a139-97c482cf2900"
Version="2.0" IssueInstant="2021-03-03T09:37:03.314Z"
Destination="https://myapp.corp2.dev.net:8050/saml2/adfs/logout"
Consent="urn:oasis:names:tc:SAML:2.0:consent:unspecified"
InResponseTo="_5bcedc5e-8847-41c6-95b3-29740f0463ec"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<Issuer xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
http://adfs.corp2.contoso.net/adfs/services/trust
</Issuer>
<samlp:Status>
<samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Requester" />
</samlp:Status>
</samlp:LogoutResponse>
答案 0 :(得分:1)
您的 NameID
仍然缺少 ADFS 在注销请求中要求的其他属性。
特别想念
SPNameQualifier
NameQualifier
SPProvidedID
SessionIndex
必须从在身份验证时到达您的 SP 的断言中检索所有内容,然后将其复制到注销请求中(请参阅 LogoutRequest
模型以了解将它们放在哪里)。
从技术上讲,您可以将它们存储为您在 SP 创建的名称声明的附加声明或属性。
编辑 1,仔细检查这些。虽然我手头只有 ADFS2(这应该不是问题,因为也有 SAML2 支持)。
SPProvidedID
一开始就没有出现在断言中,所以它也没有出现在注销请求中。还有其他属性。签名也在那里,请注意,根据规范,必须对注销请求进行签名。确保签名的哈希算法与您在 ADFS 中设置的算法相匹配。
ADFS 接受的注销请求示例:
<samlp:LogoutRequest xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
ID="_g9b2ba1ab-78c0-409e-a009-3fe4941072e2"
Version="2.0" IssueInstant="2021-03-04T08:48:24.198609Z"
Destination="https://adfs.odev1.local/adfs/ls/" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<saml:Issuer>https://localhost:44307/Account/Logon</saml:Issuer>
<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="#_g9b2ba1ab-78c0-409e-a009-3fe4941072e2">
<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>VuQ...=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>XFO/...==</SignatureValue>
</Signature>
<saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:persistent"
SPNameQualifier="https://localhost:44307/Account/Logon"
NameQualifier="https://adfs.odev1.local/adfs/ls">DEV1\wiktor</saml:NameID>
<samlp:SessionIndex>_cb98e9ca-b3b9-46cb-a30a-5a6980d8703e</samlp:SessionIndex>
</samlp:LogoutRequest>