Cas-Management介绍
cas-management也简称为service-management可以理解为服务管理。
cas为我们提供了对service的管理平台,通过UI界面进行操作管理
官方也提供了具体的配置文档
项目地址:cas-management
本例使用的版本是 5.3.x
项目运行
1、下载 cas-management-overlay,阅读README.md
2、启动cas服务,【CAS】CAS介绍与安装(一) - H__D - 博客园
3、打包 managenment项目,命令:build.cmd package
4、新建目录 src\main\resources
5、\target\cas-management\WEB-INF\classes\application.properties文件 ,拷贝的 resources目录中

修改application.properties文件
##
# CAS Thymeleaf Views
#
spring.thymeleaf.cache=false
spring.thymeleaf.mode=HTML
spring.thymeleaf.order=1
##
# Embedded CAS Tomcat Container
#
server.context-path=/cas-management
#server.port=8444
server.ssl.key-store=file:/etc/cas/thekeystore
server.ssl.key-store-password=changeit
server.ssl.key-password=changeit
##
# Log4J Configuration
#
server.context-parameters.isLog4jAutoInitializationDisabled=true
# logging.config=file:/etc/cas/log4j2.xml
##
# CAS Server
cas.server.name=https://localhost:8443
cas.server.prefix=${cas.server.name}/cas
##
# CAS Authentication Attributes
#
cas.authn.attributeRepository.stub.attributes.uid=uid
cas.authn.attributeRepository.stub.attributes.givenName=givenName
cas.authn.attributeRepository.stub.attributes.eppn=eppn
mgmt.serverName=https://localhost:${server.port}
##
# CAS Web Application Config
#
server.session.timeout=1800
server.session.cookie.http-only=true
server.session.tracking-modes=COOKIE
##
# CAS Cloud Bus Configuration
# Please leave spring.cloud.bus.enabled set to false
#
spring.cloud.bus.enabled=false
#Indicates that systemPropertiesOverride can be used.
# Set to false to prevent users from changing the default accidentally. Default true.
spring.cloud.config.allow-override=true
# External properties should override system properties.
spring.cloud.config.override-system-properties=false
# When allowOverride is true, external properties should take lowest priority, and not override any
# existing property sources (including local config files).
spring.cloud.config.override-none=false
##
# Actuator Endpoint Security Defaults
#
endpoints.sensitive=true
endpoints.enabled=false
endpoints.actuator.enabled=false
6、在\target\cas-management\WEB-INF\classes目录中,找到user-details.properties,复制到resources目录中
7、运行项目,命令:build.cmd run
8、访问 ,地址:https://localhost:8080/cas-management

错误解决
问题1:证书未导入JDK
报错:
2025-04-03 00:20:47,851 ERROR [org.apereo.cas.util.HttpUtils] - <sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target>
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alert.createSSLException(Unknown Source) ~[?:1.8.0_341]
at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:1.8.0_341]
at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:1.8.0_341]
at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:1.8.0_341]

导入证书:
命令:keytool -import -alias cas -file "E:\etc\cas\cas.cer" -keystore "C:\Program Files\Java\jre1.8.0_341\lib\security\cacerts" -storepass changeit
问题2:用户未授权
问题描述:

解决:
在\target\cas-management\WEB-INF\classes目录中,找到user-details.properties,复制到resources目录中

编辑内容,将对应用户添加进去

参考:CAS单点登录(五)——Service配置及管理_casservice-CSDN博客

浙公网安备 33010602011771号