单点登出基本上没有啥配置

直接在原来logout的时候,重定向到Cas-Server的logout方法

    @RequestSecurity
@RequestMapping(value = "loginout", method = { RequestMethod.GET,
RequestMethod.POST })
public String loginout(HttpSession session)
{
session.invalidate();
return "redirect:https://demo.testcas.com/cas-server/logout";
}

但是这样的话,logout后,最终会停留在这个页面上

一般这不是我们想要的。

我想要的是,一旦用户登出,重新回到登录页面。

那么重新修改原有项目的logout方法,如下:

    @RequestSecurity
@RequestMapping(value = "loginout", method = { RequestMethod.GET,
RequestMethod.POST })
public String loginout(HttpSession session)
{
session.invalidate();
return "redirect:https://demo.testcas.com/cas-server/logout?service=https://demo.testcas.com/cas-server/login";
}

加上了一个Service后缀,并且指定了一个URL,意思是成功logout后,想要回到哪个页面。

然后,在Cas-Server项目的cas-servlet.xml中,找到

    <bean id="logoutController" class="org.jasig.cas.web.LogoutController"
p:centralAuthenticationService-ref="centralAuthenticationService"
p:logoutView="casLogoutView"
p:followServiceRedirects="true"
p:warnCookieGenerator-ref="warnCookieGenerator"
p:ticketGrantingTicketCookieGenerator-ref="ticketGrantingTicketCookieGenerator" />

加上这么一个属性: p:followServiceRedirects="true"

意思是:成功Logout后,如果包含Service参数,则重定向到Service指定的网址。


单点登录CAS使用记系列:

最新文章

  1. js封装类
  2. django缓存
  3. MVC的JsonResult用法
  4. iOS 简单总结:description方法\NSLog函数
  5. Web Api学习一
  6. LeetCode 697. Degree of an Array (数组的度)
  7. DAVINCI DM6446 开发攻略——V4L2视频驱动和应用分析
  8. NoteBook学习(一)-------- Zeppelin VS Jupyter
  9. 犹记当年写出bug睡不着,回想今天只求睡好渡余生……
  10. Windows Server 2003下DHCP服务器的安装与简单配置图文教程
  11. 软件工程项目之摄影App(总结)
  12. C++ code:位操作实例(bit operation example)
  13. Eclipse常见设置与操作
  14. 跟我学Spring Cloud(Finchley版)-20-Spring Cloud Config-Git仓库配置详解 原
  15. 【POJ】3070 Fibonacci
  16. Robberies---hdu2955(概率dp,01背包)
  17. DCU项目总结
  18. Tomcat服务器配置和使用(三)
  19. WebSphere监控软件 TPV(Tivoli Performance Viewer)的缺点
  20. 在CentOS 7上利用systemctl添加自定义系统服务 /usr/lib/systemd/

热门文章

  1. spring mvc标准项目结构
  2. Solr4.8.0源码分析(5)之查询流程分析总述
  3. could only be replicated to 0 nodes, instead of 1
  4. SCALA常规练习A
  5. 可重入与线程安全(Reentrancy and Thread-Safety)
  6. Java获取程序或项目路径的常用方法
  7. Do&#39;s and Don&#39;ts for Android development
  8. Nodejs in Visual Studio Code 01.简单介绍Nodejs
  9. 双slave的server_uuid同样问题
  10. 设计模式(二)工厂模式Factory (创建型)