single-sign-on - 为跨域应用程序实现 CAS 单点注销

标签 single-sign-on logout cas jasig

我是 CAS 的初学者。我的 CAS 服务器已启动并在端口 8443(安全 HTTP 层)运行。我还制作了两个应用程序 - JAVA 客户端(我自己的 JAVA 客户端)和 PHP 客户端(CAS 官方提供)来测试我的 CAS 服务器。我可以为两个客户端使用单点登录。我还在 CAS 属性文件中启用了单点注销。我当前的 CAS 版本是 4.0.0,我使用的是 Apache Tomcat 版本 8.0.23

我在 JAVA 客户端的 web.xml 中添加了以下注销依赖项

 <filter>
    <filter-name>CAS Single Sign Out Filter</filter-name>
        <filter-class>  org.jasig.cas.client.session.SingleSignOutFilter</filter-class>
</filter>
<filter-mapping>
   <filter-name>CAS Single Sign Out Filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>  org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>
</listener>

但是在执行单点注销时,当我注销 PHP 应用程序时,我无法注销已打开的 JAVA 应用程序。这意味着从 PHP 应用程序注销时不会破坏我现有的 JAVA 应用程序 session 。

经过大量研究后,我发现了 this我成功地实现了注销功能。但我不想使用公共(public) session 数据库。

在官方documentation of CAS文中提到:

CAS sends an HTTP POST message directly to the service ( back channel communication): this is the traditional way of performing notification to the service.

When CAS is configured for SLO, it attempts to send logout messages to every application that requested authentication to CAS during the SSO session.

但我无法理解如何获取 SLO 消息,因为在应用程序注销期间我没有收到任何 POST 请求(使用 Firebug 进行跟踪时)。那么任何人都可以帮我执行单点退出吗?

提前致谢。

最佳答案

CAS documentation 上所示:

When a CAS session ends, it notifies each of the services that the SSO session is no longer valid, and that relying parties need to invalidate their own session.

This can happen in two ways:

  1. CAS sends an HTTP POST message directly to the service (back channel communication): this is the traditional way of performing notification to the service.
  2. CAS redirects (HTTP 302) to the service with a message and a RelayState parameter (front channel communication): This feature is inspired by SAML SLO, and is needed if the client application is composed of several servers and use session affinity. The expected behaviour of the CAS client is to invalidate the application web session and redirect back to the CAS server with the RelayState parameter.

Usage Warning!

Front-channel SLO at this point is still experimental.

(重点是我添加的)

如果您在浏览器上没有看到相应的事件,则您可能正在使用选项 #1,其中 POST 消息在后端发送。

SLO 比 SSO 复杂得多...

关于single-sign-on - 为跨域应用程序实现 CAS 单点注销,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31268571/

相关文章:

java - 如何在运行时禁用 Grails Spring 插件?

php - 如何使用 Microsoft AD 为内部 PHP 应用程序实现单点登录 (SSO)?

java - 使用 Java 中的 SAML 和 Azure AD 作为 IDP 实现单点登录 (SSO)

Azure AD 注销

php - 使用 php 和 mysql 自动注销

java - 通过 CAS 在 Liferay 5.2 和 PHP 之间进行单点登录

spring-mvc - Spring Boot + 安全性 + MVC + LDAP AD + SSO

azure - 多个azure应用程序如何使用相同的jwt token 进行身份验证

php - 如何使用php制作涉及 session cookie的注销页面?

java - 与 .Net 共享 Java HTTP session