CAS理论之类的我就不再多说了,随便找一找也够看一下午的了,我只说整个搭建过程。
1.https://github.com/Jasig/cas/releases中下载最新版4.0.3得到cas-4.0.3.zip
2.解压得到如下图:
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中
3.这里有两种方法,一种是直接用maven打包cas-server-webapp,再将打包后的cas.war包放tomcat运行,另一种直接将cas-server-webapp拷入一个空白项目中,两种我都试过都可以,我采用直接用maven结构,如下图:
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中

springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中

4.设置好maven仓库,下好包,pom.xml会有个错误,这个错误不用管,不会有影响,注释了就好,如图:
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中

5.项目应该就不会报错了,如果还有包错误,检查下你的maven环境,或者换个中央仓库。如果没有错误了,就clear后,再install。不出意外,会报一个找不个文件的错误,如图:
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中
缺少licensing文件夹,下载文件,放到如下图的地址:
下载地址:http://download.csdn.net/download/i__rookie/9966102 如果没有积分,可以联系:QQ:308402945
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中
6.配置tomcat,启动cas就可以正常访问,如图:
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中
7.启动后访问http://localhost:8085/cas
关于登录密码,CAS-4.0之前的默认验证规则是:只要用户名和密码相同就认证通过
4.0之后有所改变:其默认用户名密码为casuser/Mellon,它配置在\WEB-INF\deployerConfigContext.xml
效果如图:
springMVC+CAs+shiro整合一 环境搭建下载CAS及导入idea中
上面有个警告:Non-secure Connection

You are currently accessing CAS over a non-secure connection. Single Sign On WILL NOT WORK. In order to have single sign on work, you MUST log in over HTTPS.
这是由于没有使用https,所报的。你可以选择不使用https。
这段提示是硬编码在\WEB-INF\view\jsp\default\ui\casLoginView.jsp中的
我们可以注释掉它,也可以让CAS支持HTTP协议,即令其不开启HTTPS验证,这时需要修改三个文件
1、\WEB-INF\deployerConfigContext.xml
添加p:requireSecure=”false”

2、\WEB-INF\spring-configuration\ticketGrantingTicketCookieGenerator.xml
p:cookieSecure=”true”改为p:cookieSecure=”false”

3、\WEB-INF\spring-configuration\warnCookieGenerator.xml
p:cookieSecure=”true”改为p:cookieSecure=”false”
当然你也可以开启https协议,这个在下章再讲。
由于平时很少写博客,写的很差,请多见谅。
这里推荐下我的开源项目:
hxyFrame是一个OA办公系统,采用流行的框架springMvc+spring+mybatis+shiro+ehcache开发,还集成了权限管理(菜单权限、数据权限),完善的代码生成器,solr全文搜索引擎,activiti工作流程引擎,cas单点登陆等功能,后期还会考虑改造成Dubbo微服务化,做到模块的相对独立,使用更加灵活,努力做到快速开发OA办公系统。 感兴趣可以Watch、Start持续关注项目最新状态,加入QQ群:210315502
oschina仓库:https://git.oschina.net/huangxianyuan/hxyFrame.git
github仓库:https://github.com/huangxianyuan/hxyFrame.git

相关文章:

  • 2021-05-20
  • 2021-10-24
  • 2022-01-05
  • 2021-09-08
  • 2022-12-23
  • 2021-11-22
  • 2021-09-01
猜你喜欢
  • 2021-07-30
  • 2022-12-23
  • 2021-11-21
  • 2022-02-24
  • 2023-03-30
  • 2023-03-30
相关资源
相似解决方案