所以我cas-initializr
在文件夹中使用以下命令初始化了 CAS cas
:
curl https://casinit.herokuapp.com/starter.tgz -d "dependencies=core,bootadmin,metrics,gitsvc,jsonsvc,redis,support-themes-core" | tar -xzvf -
我的主题名称是example
. 下面是文件结构cas/src/main/resources/templates
:
templates
├── META-INF
│ └── spring.factories
├── application.yml
├── example.properties
├── static
│ └── themes
│ └── example
│ ├── css
│ │ └── cas.css
│ ├── images
│ │ ├── favicon.ico
│ │ └── logo.png
│ └── js
│ └── cas.js
└── templates
└── example
└── casLoginView.html
的内容casLoginView.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
的内容example.properties
:
cas.theme.name=Example Theme
cas.theme.description=Example - Central Authentication Service
cas.standard.css.file=/themes/example/css/cas.css
cas.standard.js.file=/themes/example/js/cas.js
cas.logo.file=/themes/example/images/logo.png
cas.favicon.file=/themes/example/images/favicon.ico
cas.drawer-menu.enabled=false
cas.notifications-menu.enabled=false
cas.login-form.enabled=true
我的cas.properties
文件位于/etc/cas/config/
:
cas.server.name=https://localhost:8443
cas.server.prefix=${cas.server.name}/cas
cas.serviceRegistry.json.location=file:/etc/cas/services
# cas.authn.accept.enabled=false
server.ssl.key-store=file:/etc/cas/thekeystore
server.ssl.key-store-password=changeit
cas.theme.defaultThemeName=example
spring.thymeleaf.cache=false
使用 启动服务器后./gradlew bootRun
,我https://localhost:8443/cas/login
在 chrome 浏览器上打开。CSS、图像和 JS 似乎加载良好(我使用 Chrome Devtool 确认),但使用默认模板而不是我的自定义模板。
我已经尝试谷歌搜索了几个小时,但我仍然无法弄清楚如何cas
加载我的 html 模板。
P/s:我尝试将所有resources
内容移至cas/build/resources
,cas/build/resources/main
但它似乎也不起作用。