【问题标题】:How to include relayState parameter in SAML single Logout request using Spring SAML extension如何使用 Spring SAML 扩展在 SAML 单个注销请求中包含 relayState 参数
【发布时间】:2025-12-05 15:25:01
【问题描述】:

我使用 Spring SAML 扩展PingFederate 作为 IDP 服务器。现在,当我从 SP(服务提供商)启动 global logout 时,它只会使 SP 会话无效,而不是 IDP 服务器会话。意味着即使在全局注销后,当我再次尝试登录(使用 SP 启动)时,它也允许直接登录而无需询问用户登录凭据。

我注意到在 SAML 单一注销请求中缺少 relayState 参数,尽管它在其他运行正常的 SP 应用程序中存在(PingFederate 提供的演示 SP 应用程序)。我尝试在 securityContext.xml 文件中添加 relayState 属性(请参阅下面的 sn-p),但 relayState 仍然不是注销请求参数的一部分。

<bean id="samlEntryPoint" class="org.springframework.security.saml.SAMLEntryPoint">
    <property name="defaultProfileOptions">
        <bean class="org.springframework.security.saml.websso.WebSSOProfileOptions">
            <property name="relayState" value="http://192.168.1.73:8080/adeptia"/>
            <property name="includeScoping" value="true"/>
        </bean>
    </property>
</bean>

请让我知道 relayState 参数的用途、可能的值是什么以及如何将其包含在 SAML 注销请求中。

【问题讨论】:

    标签: java spring-saml pingfederate


    【解决方案1】:

    您应该能够通过扩展SingleLogoutProfileImpl - 方法sendLogoutRequest 来传递中继状态。您可以调用context.setRelayState() 来获取值,然后调用 super 来完成其余的逻辑。

    在响应阶段,继电器值将在 processLogoutResponse 中可用,同样在上下文对象中。

    Spring SAML 中的单次注销期间没有明确的中继发送功能。

    【讨论】:

      最近更新 更多