cas单点登录 - casserver搭建

这里采用cas脚手架来进行overlay工程部署

脚手架

1.脚手架下载项目 > https://casinitializr.herokuapp.com/

æ索项ç®

输入tomcat匹配运行项目,同时可以自定义项目pom配置

设置项ç®ä¿¡æ¯

2.导入eclipse

3.build项目,在构建的过程中会下载cas-server的war作为运行项,一般70M~90M左右

4.下载完成之后,即可运行。简单的cas-server搭建成功。

修改配置:

1.classpath下新建src/main/resources资源文件夹

目录结构如下

éç½®æ件ç»æ

将/cas-server/target/cas/WEB-INF/classes中的配置文件复制到resources中,如上图

-- services:配置cas-client拦截规则

{
	"@class": "org.apereo.cas.services.RegexRegisteredService",
	"serviceId": "^(https|http|imaps)://config.center.com:18080/cas-management/manage.html",
	"name": "casmanagement",
	"id": "10000003",
	"description": "casmanagement regex auth verity.",
	"evaluationOrder": 12,
	"theme": "defaultThemeDefined",
	"attributeReleasePolicy": {
		"@class": "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
	}
}

-- static:cas-server页面引用静态文件(css/js等)

-- templates:cas-server页面存放目录(server使用Thymeleaf模板引用参数)

-- application.properties/bootstrap.properties:cas-server配置

-- defaultThemeDefined.properties:自定义的client页面引用配置信息

find.jquery.file=/themes/defaultThemeDefined/js/jquery-2.1.1.min.js
pageTitle=登录
standard.custom.css.file=/css/cas.css
admin.custom.css.file=/css/admin.css
cas.javascript.file=/js/cas.js

-- login-webflow.xml:cas-server单点登录流程,参照spring-webflow

-- messages_zh_CN.properties:页面引用的文字信息配置,引用效果如:th:utext="#{screen.welcome.label.password}"

2.修改application.properties自定义配置信息(当前项目已引用springcloud配置中心,application配置详见cas-manage-group/cas-config/config/cas-dev.properties)

配置参照:https://apereo.github.io/cas/5.1.x/installation/Configuration-Properties.html

-- 为方便操作,使用非安全的http,不使用证书验证。

server.ssl.enabled=false

-- 注释server.ssl.key-*=xxx

-- 默认的静态密码

cas.authn.accept.users=casuser::Mellon (自定义验证后续注释掉

-- 允许退出后重定向页面

cas.logout.followServiceRedirects=true

-- 开启远程rest自定义验证(自行选择配置)

cas.authn.rest.uri=http://config.center.com:8881/soslogin

-- 启用数据库验证(注释掉静态密码验证)

cas.authn.jdbc.query[0].*=xxxx

-- ticket状态控制(无操作的超时时间、session有效的最大时间、服务票据的过期时间等)

cas.ticket.tgt.*=xxxx

码云 - vodka / cas

猜你喜欢

转载自blog.csdn.net/u014540082/article/details/89917508