环境:jdk1.8,tomcat8
1、把tomcat下(WEB-INF/classes/services)的services复制到resource下
如果项目中没有这个文件夹,请点击maven边上的刷新按钮
2、在services下新增mytheme-10000002.json、mytheme2-10000003.json文件
mytheme-10000002.json
{
"@class": "org.apereo.cas.services.RegexRegisteredService",
"serviceId": "^(https|imaps|http)://test.*",
"name": "mytheme",
"theme": "mytheme",
"id": 10000002,
"description": "自定义主题",
"evaluationOrder": 1000
}
mytheme2-10000003.json
{
"@class": "org.apereo.cas.services.RegexRegisteredService",
"serviceId": "^(https|imaps|http)://test2.*",
"name": "mytheme2",
"theme": "mytheme2",
"id": 10000003,
"description": "自定义主题2",
"evaluationOrder": 1001
}
id、evaluationOrder、theme这三个属性别和其他json文件里的重名
3、修改HTTPSandIMAPS-10000001.json,使其支持http
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^(https|imaps|http)://.*",
"name" : "HTTPS and IMAPS",
"id" : 10000001,
"description" : "This service definition authorizes all application urls that support HTTPS and IMAPS protocols.",
"evaluationOrder" : 10000
}
前面三个json文件中都新增了http
4、在application.properties里新增cas.serviceRegistry.initFromJson=true,让json配置文件生效
5、新增mytheme.properties、mytheme2.properties文件
mytheme.properties
cas.css=/themes/mytheme/css/cas.css
cas.pageTitle=\u6d4b\u8bd5\u4e00\u4e0b