1、获取对应java版本的cas服务端代码
GitHub - apereo/cas-overlay-template: Apereo CAS WAR Overlay template
对应的java版本为(截止2023/4/27)
根据电脑环境拉取对应分支的代码
2、编译打包
window:点击build.sh,或者执行命令 mvn clean package -Dmaven.test.skip=true
获取war包
3、部署
将war包放入tomcat目录下的webapps中,使用https需要自备证书,如何获取证书百度即可。
4、配置
文件:tomcat\webapps\cas\WEB-INF\classes\services\HTTPSandIMAPS-10000001.json
serviceId 添加http支持 "serviceId" : "^(https|http|imaps)://.*",
文件:tomcat\webapps\cas\WEB-INF\classes\application.properties
cas.tgc.secure=false
cas.serviceRegistry.initFromJson=true
##
# CAS Authentication Credentials
#
cas.server.name=https://%domain%:%tomcatport%
cas.server.prefix=${cas.server.name}/cas
cas.authn.accept.users=
cas.authn.rest.uri=http://%domain%:%loginServerPort%/%loginApi%
cas.authn.rest.passwordEncoder.type=NONE
cas.authn.rest.passwordEncoder.characterEncoding=UTF-8
cas.authn.rest.passwordEncoder.encodingAlgorithm=MD5
在编译之前需要添加依赖以支持rest接口验证用户
<!--开启cas server的rest支持-->标签:单点,cas,webapps,rest,server,authn,passwordEncoder From: https://www.cnblogs.com/silverMaster/p/17361106.html
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-rest</artifactId>
<version>${cas.version}</version>
</dependency>
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-rest-authentication</artifactId>
<version>${cas.version}</version>
</dependency>