服务配置可以从json中引入,需要先在pom中添加依赖
<!--获取json格式的服务注册配置信息,service是以Json格式时添加此依赖-->
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-json-service-registry</artifactId>
<version>${cas.version}</version>
</dependency>
在application.properties中新增配置
# 如果不使用https就添加下面配置,默认为true
cas.tgc.secure=false
# 从json文件加载服务
cas.serviceRegistry.initFromJson=true
# 服务默认加载位置
cas.serviceRegistry.json.location=classpath:/services
在resources目录下新增services目录,并创建json文件
配置文件名称有规则要求,建立src/main/resources/services/[themeName-id.json]
{
"@class" : "org.apereo.cas.services.RegexRegisteredService",
"serviceId" : "^(https|imaps|http)://.*",
"name" : "customTheme",
"theme" : "customTheme",
"id" : 1001
}
启动后提示信息如下就成功加载配置了
这里加载了三个配置是因为cas-overlay中自带了两个配置,加上我们的配置,刚好三个配置
服务配置完成外部服务就可以接入cas了