【问题标题】:Problems with invalid SessionIndex in Sign Out with SAML2 LogoutRequest使用 SAML2 LogoutRequest 注销时出现无效 SessionIndex 的问题
【发布时间】:2018-02-08 00:22:35
【问题描述】:

我是一名开发人员,尝试使用 SAML 2 将我的 IdP 与 Office 365 集成。

我在登录用户的第一步中取得了成功。但是,我对使用 IdP-Initiated 流程的 Sign Out (LogoutRequest) 有很多疑问,这些疑问与 Sign Out 的端点有关。为了开发登录,我遵循了此元数据文件中存在的端点和配置:

https://nexus.microsoftonline-p.com/federationmetadata/saml20/federationmetadata.xml

Ti 发送 LogoutRequest,元数据给出与登录相同的 url:

<SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://login.microsoftonline.com/login.srf"/>

我按如下方式创建 LogoutRequest:

<saml2p:LogoutRequest Destination="https://login.microsoftonline.com/login.srf"
                      ID="_263311dc-ce0a-21c3-90d3-2e1312cde124"
                      IssueInstant="2015-01-13T13:51:57.978Z"
                      Version="2.0"
                      xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol">

    <saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">https://my-enterprise-configuration-value</saml2:Issuer>
    <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
                  SPNameQualifier="https://my-enterprise-configuration-value"
                  xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">my-configuration-name-id-in-o365</saml2:NameID>
    <samlp:SessionIndex>_session-index-generate-in-saml-response</samlp:SessionIndex>
</saml2p:LogoutRequest>

所以我使用 Signature 属性生成了相同的 LogoutRequest,但我得到了相同的错误(SessionIndex 不存在...)。

我最大的疑惑与 Destination、NameID Format 和 SPNameQualifier 有关。

Destination 的正确值是多少?我在其他地方看到我应该用https://login.microsoftonline.com/common/saml2 插入目的地,我也看到了https://login.microsoftonline.com/&lt;tenant-azure-id&gt;/saml2

那么,即使我的目标应用程序是上面注释掉的应用程序之一,我是否仍然需要将我的 POST 请求发送到https://login.microsoftonline.com/login.srf?还是应该将 POST 发送到与 Destination 相同的本地位置?

NameID 格式与上传的 SAMLResponse(我发送到 Office 365)相同。

SPNameQualifier 已经在使用 Issuer (ImmutableID) 中设置的相同值。

我在帖子中发送的数据示例:

SAMLRequest=nVLdSsMwFH6Vkvt0TWs3F9bCYAiFKerEC29GSE9roE1qTirz2bzwkXwF025DHajgTchJvvP9nGSBom3ijq9NbXp3C089oAtWflFaOGV0Rh6d65BPJo2plQ5bJa1BUzmjG6UhlKY93KCtSFCsMrKNp0nCWCmphEjQmMmEzqMyoTGwhMWyBBafeShiD4VGJ7TLSByxlEaMsuSOJTxlPJ2F89n5AwnuweJoJA4jEuzaRiPfu85IbzU3AhVyLVpA7iTfLC/X3EN5Z40z0jQkX4xwPgrarwy/EwhEsMMMSP7++nYcg9+2LxS0A9tZhUCl0ZWqezuOiz6LpofF5KviUf/KKxSr4MLYVrifpVnIxhNV0mqEcmiFapZlaQGRBJvrgeimF42qFNjPB/rTFvlXdk/7nWtAU+9OaWqSaXoMu4+XB2Pajm+8WY8udAm7fIv7yvf4ktagwZPBQDGgqU/WGY2HwZ00BweFk1+afwA=
SigAlg=http://www.w3.org/2000/09/xmldsig#rsa-sha1
RelayState=data_sended_for_microsoft_in_login_value
Signature=UrlEncoded(Base64Encoded(SAMLRequest))&UrlEncoded(Base64Encoded(SigAlg))

我也在尝试在管理工具中的应用程序中查找配置注销的位置,但没有找到。

【问题讨论】:

    标签: java azure office365 saml saml-2.0


    【解决方案1】:
    1. Destination 属性的正确值始终是您将 SAML 请求发送到的 URL(或者,更确切地说,指示用户的浏览器将请求发送(在本例中为 POST)到)。
    2. 使用 POST 绑定时,不应使用单独的 SigAlgSignature 属性,应将签名作为 XML 签名包含在 SAML2 XML 消息本身中。这两个属性仅在 HTTP-Redirect 绑定中使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-08-31
      • 2015-01-04
      • 2018-06-17
      • 2021-02-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多