cas5.2.6(3)自定义登录页面

本文介绍了如何在CAS 5.2.6环境下自定义登录页面并设置多个主题。主要步骤包括:将services目录复制到resource下,创建并编辑JSON配置文件以支持不同主题,修改HTTPSandIMAPS-10000001.json,启用JSON配置文件,创建主题属性文件,调整静态资源和HTML文件路径,设置默认主题,并通过测试验证配置效果。
摘要由CSDN通过智能技术生成

环境: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
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值