首先 我把主要参考的文章贴出来:

https://blog.csdn.net/weixin_39819191/article/details/80361301

https://blog.csdn.net/u010588262/article/category/7548325

 虽然有以上项目 而且还有zip包 但是还是让我吃尽了苦头  忙了不到一个礼拜的样子

这个是以上两个文章的zip   如没有积分/C币 ,可以联系我 !

https://download.csdn.net/download/wuhaotian1996/10746653

 

以下是我修改版  直接可用  并解决了打成war包:

码云: 

https://gitee.com/NBwuhaotian/cas_server.git

码云有可能很慢因为项目500M 打完包270多m 

百度云有zip包:

链接:https://pan.baidu.com/s/1OWtKPd54sdRjITrTiw95mA
提取码:rezd

github

客户端 

https://github.com/1194449282/shiro-cas-pac4j.git

 

本文非常适合新手 小白等  有些操作没有细究  有歧义或者错误地方请指出!

cas 分为服务端和客户端   

首先是服务端

解压缩cas-overlay-template-5.3   cmd命令到压缩后的文件夹下  

mvn clean package

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 1生成keystore   

keytool -genkeypair -alias "tomcat" -keyalg "RSA" -keystore "D:\keystore\tomcat.keystore"

 

 名称与姓氏 : passport.sso.com    其他的随便输入  密码123456

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

2 生成crt

keytool -export -file D:\keystore\cas.crt -keystore D:\keystore\tomcat.keystore -alias tomcat

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 第1 2 步完成后 会出现

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 

第三步 重要   一定要放在jre下 我之前直接放在lib下,认证cas后 一直callback错误

 

keytool -import -file D:\keystore\cas.crt -alias tomcat -keystore D:\developSoft\Softs\JDK\jdk1.8.0_77\jre\lib\security\cacerts -storepass 123456

 cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 然后我说说明一下 生成这三个文件的作用

keystore 配置tomcat 中server.xml用到

crt  证书 给浏览器 防止浏览器拦截(个人认为意义不大) 一般浏览器点高级 放开就可以了

cacerts 这个不需要其他配置 只需要运行时 用这个jdk即可

下一步配置本地tomcat  server.xml

删除:

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

添加: keystoreFile为自己的 keystore目录

<Connector
protocol="org.apache.coyote.http11.Http11NioProtocol" port="8443" maxThreads="200" scheme="https" secure="true" SSLEnabled="true" keystoreFile="D:\keystore\tomcat.keystore" keystorePass="123456" clientAuth="false" sslProtocol="TLS"/>

还有一个地方 忘记什么时候配置的了  复制即可:

    <Connector  port="8090"    protocol="HTTP/1.1"

connectionTimeout="20000"

SSLEnabled="true"     maxThreads="150"

scheme="https"    secure="true"    clientAuth="false"    sslProtocol="TLS"

keystoreFile="D:\\keystore\\tomcat.keystore"      keystorePass="123456" />

下一步配置tomcat

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 运行之前需要把overlays的lib 添加到本地   不然包路径报红色

右键lib

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 客户端是不需要做任何改动的

host本地 

	127.0.0.1       passport.sso.com
	127.0.0.1       www.casclient1.com
	127.0.0.1       www.hugeo.com

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 输入 http://www.casclient1.com:8082/xxxx  

 都会跳转至cas登陆页面

 cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 登陆之后会到客户端     登出需要passport.sso.com:9898/cas/logout

cas+shiro+springboot+pac4j 自定义登陆界面以及验证码等

 

分类:

技术点:

相关文章: