在 /Saml2/Acs 点接收 SAML 注销响应



在我的应用程序中,单点注销工作正常,但在 Idp 上处理注销请求后,我在/Saml2/Acs 点得到响应。我不确定这个 URL 来自哪里,所以有什么特别的方法可以在 SP 端配置这个端点,因为我无法控制 Idp。

要提供其他详细信息,以下是登录/注销请求响应

<!-- Loging Request -->
<saml2p:AuthnRequest
AssertionConsumerServiceURL="https://service.provider.com/server/Saml2/Acs"
Destination="https://identity.provider.com/nidp/saml2/sso" ID="id969024c5919e47148622d87bd40724ad"
IssueInstant="2019-04-08T10:51:03Z" Version="2.0"
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol">
<saml2:Issuer>https://service.provider.com</saml2:Issuer>
<saml2p:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"/>
</saml2p:AuthnRequest>
<!-- Loging Request -->
<!-- ##### -->
<!-- Login Response -->
<samlp:Response Destination="https://service.provider.com/server/Saml2/Acs"
ID="idNammIIHbKBac2pGfdbHqHFTwy9w" InResponseTo="id969024c5919e47148622d87bd40724ad"
IssueInstant="2019-04-08T10:51:49Z" 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://identity.provider.com/nidp/saml2/metadata</saml:Issuer>
<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>
<saml:Assertion ID="idqn4Szd8L-wAJQojG9-4j-JAaXzo" IssueInstant="2019-04-08T10:51:49Z" Version="2.0">
<saml:Issuer>https://identity.provider.com/nidp/saml2/metadata</saml:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"
xmlns="http://www.w3.org/2000/09/xmldsig#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#idqn4Szd8L-wAJQojG9-4j-JAaXzo">
<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"/>
<DigestValue xmlns="http://www.w3.org/2000/09/xmldsig#">/KjwtCOlMQllJ8/rw22iowBNeEM=</DigestValue>
</ds:Reference>
</ds:SignedInfo>
<SignatureValue xmlns="http://www.w3.org/2000/09/xmldsig#">
SIGNARTURE-REMOVED
</SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
CERTIFICATE-REMOVED
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
NameQualifier="https://identity.provider.com/nidp/saml2/metadata"
SPNameQualifier="https://service.provider.com">00001234</saml:NameID>
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"><saml:SubjectConfirmationData InResponseTo="id969024c5919e47148622d87bd40724ad"
NotOnOrAfter="2019-04-08T10:56:49Z"
Recipient="https://service.provider.com/server/Saml2/Acs"/></saml:SubjectConfirmation>
</saml:Subject>
<saml:Conditions NotBefore="2019-04-08T10:46:49Z" NotOnOrAfter="2019-04-08T10:56:49Z">
<saml:AudienceRestriction>
<saml:Audience>https://service.provider.com</saml:Audience>
</saml:AudienceRestriction>
</saml:Conditions>
<saml:AuthnStatement AuthnInstant="2019-04-08T10:45:27Z"
SessionIndex="idqn4Szd8L-wAJQojG9-4j-JAaXzo">
<saml:AuthnContext>
<saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef>
</saml:AuthnContext>
</saml:AuthnStatement>
<saml:AttributeStatement>
<saml:Attribute Name="achternaam"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeValue xsi:type="xs:string">LastName</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="rollen" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeValue xsi:type="xs:string">role</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="mail" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeValue xsi:type="xs:string">f.lastname@company.come</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="tussenvoegsel"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeValue xsi:type="xs:string">middle</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="voornaam" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeValue xsi:type="xs:string">FirstName</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="uniqueid" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<saml:AttributeValue xsi:type="xs:string">00001234</saml:AttributeValue>
</saml:Attribute>
</saml:AttributeStatement>
</saml:Assertion>
</samlp:Response>
<!-- Login Response -->
<!-- ##### -->
<!-- Logout Request -->
<saml2p:LogoutRequest Destination="https://identity.provider.com/nidp/saml2/slo"
ID="idd2e66a13b3ed43b29a9fd06724723ea2" IssueInstant="2019-04-08T10:52:54Z" Version="2.0"
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol">
<saml2:Issuer>https://service.provider.com</saml2:Issuer>
<saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
NameQualifier="https://identity.provider.com/nidp/saml2/metadata"
SPNameQualifier="https://service.provider.com">00001234</saml2:NameID>
<saml2p:SessionIndex>idqn4Szd8L-wAJQojG9-4j-JAaXzo</saml2p:SessionIndex>
</saml2p:LogoutRequest>
<!-- Logout Request -->
<!-- ##### -->
<!-- Logout Response -->
<samlp:LogoutResponse Destination="https://service.provider.com/server/Saml2/Acs"
ID="idIANzyBI5tg2fB2dWOxcSrDA4bko" InResponseTo="idd2e66a13b3ed43b29a9fd06724723ea2"
IssueInstant="2019-04-08T10:52:55Z" 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://identity.provider.com/nidp/saml2/metadata</saml:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"
xmlns="http://www.w3.org/2000/09/xmldsig#"/><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#idIANzyBI5tg2fB2dWOxcSrDA4bko">
<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"/>
<DigestValue xmlns="http://www.w3.org/2000/09/xmldsig#">dcdadDJVjgx1hzfs/OK0eBHVbEc=</DigestValue>
</ds:Reference>
</ds:SignedInfo>
<SignatureValue xmlns="http://www.w3.org/2000/09/xmldsig#">
SIGNARTURE-REMOVED
</SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate>
CERTIFICATE-REMOVED
</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>
<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>
</samlp:LogoutResponse>
<!-- Logout Response -->

应在服务提供商上配置"单次注销服务",并将位置设置为您希望 SP 在从身份提供程序注销后重定向用户的位置。

若要检查是否正确配置,可以打印出 SP 的元数据。 正如您在下面的元数据中看到的,我的 SP 已配置了单点注销服务(这是从 IdP 发送注销请求和响应的位置)。

<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:3000/auth/saml-logout-callback"/>

SingleLogoutService 的位置为"http://localhost:3000/auth/saml-logout-callback",这意味着 SP 在收到注销响应时会将用户发送到/auth/saml-logout-callback。 当然,应将 SP 配置为将用户发送到开发中与生产环境不同的终结点。

设置它对我来说非常简单,因为我正在使用护照 SAML 库来配置 SP 选项。 因此,如果使用库与 SAML 通信,则可能有一些不错的选项来配置 SP 单点注销位置。 在 passport 中,您可以在声明 SAML 策略时将注销 URL 指定为参数。

我在这里写了更多关于注销的一般工作流程:https://spin.atomicobject.com/2019/04/06/saml-2-0-flow/

最新更新