本文主要介绍如何使用cas-overlay-template来部署CAS服务端。
环境
- windows11
- cas-overlay-template6.6
- JDK11
部署
下载对应的cas-overlay-template,下载地址:GitHub - apereo/cas-overlay-template at 6.6
官方文档地址:CAS - Home (apereo.github.io)
cas-overlay-template模式是使用https,为了使用http还需要设置以下几项:
- application.yml
server:
ssl:
enabled: false
cas:
tgc:
secure: false
service-registry:
core:
init-from-json: true
json:
location: classpath:/services
http-web-request:
cors:
enabled: true
- 执行
./gradlew[.bat] getResource -PresourceName=[resource-name]命令获取源文件,从源文件中拷贝services下的HTTPSandIMAPS-10000001.json文件到resources下面。
在HTTPSandIMAPS-10000001.json文件中增加http:
{
"@class": "org.apereo.cas.services.CasRegisteredService",
"serviceId": "^(https|http|imaps)://.*",
"name": "HTTPS and IMAPS",
"id": 10000001,
"description": "This service definition authorizes all application urls that support HTTPS and IMAPS protocols.",
"evaluationOrder": 10000
}
此时需要引入cas-server-support-json-service-registry包,否则上述json文件修改将不会生效,使用cas服务器登录时会提示未认证授权的服务。
在build.gradle中引入:
implementation "org.apereo.cas:cas-server-support-json-service-registry:${project.'cas.version'}"
至此,使用./gradlew[.bat] clean build和./gradlew[.bat] run启动服务,即可使用http访问cas服务器,客户端也可使用http。