英文:
How do I set up a theme inside embedded spring boot keycloak?
问题
目前在使用集成在Spring Boot中的Keycloak。
我在资源文件夹下创建了主题以创建自定义主题。
在keycloak-server.json中如下注册:
"theme": {
"staticMaxAge": "${keycloak.theme.staticMaxAge:2592000}",
"cacheTemplates": "${keycloak.theme.cacheTemplates:true}",
"cacheThemes": "${keycloak.theme.cacheThemes:true}",
"folder": {
"dir": "src/main/resources/themes"
}
}
尽管在本地环境中可以正常工作,但在运行jar文件时却不起作用。
原因似乎是无法正确找到路径。是否有任何解决方案?
英文:
currently using keycloak embedded in spring boot.
I created themes under resources to create a custom theme.
It was registered in keycloak-server.json as follows.
"theme": {
"staticMaxAge": "${keycloak.theme.staticMaxAge:2592000}",
"cacheTemplates": "${keycloak.theme.cacheTemplates:true}",
"cacheThemes": "${keycloak.theme.cacheThemes:true}",
"folder": {
"dir": "src/main/resources/themes"
}
}
Although this works fine in the local environment. It doesn't work when run with jar file.
The cause seems to be not finding the path properly. Is there any solution to this?
答案1
得分: 1
我曾经遇到完全相同的问题。我将我的应用部署到了AWS ElasticBeanstalk,但我无法设置Keycloak来正确定位主题文件夹。
我尝试了我能想到的各种变化:
- 在 /tmp 文件夹下
- /BOOT-INF
- 以及简单的 /themes
我还探索了EBS EC2实例,试图找到正确的文件夹(我找到了这个文件夹,但它也不起作用),但迄今为止没有成功。
最终,我将主题文件夹单独上传到主目录中,并手动修改了 keycloak-server.json 文件如下:
"folder": { "dir": "/home/ec2-user/themes" }
不过,我无法使这个值从 application.property 文件中动态获取。
英文:
I have had the exact same issue. I deployed my app to AWS ElasticBeanstalk, but I was unable to setup Keycloak to locate the themes folder correctly.
I tried every variation I could think of:
- under the /tmp folder
- /BOOT-INF
- and simply /themes
I also explored the EBS EC2 instance to find the right folder (I've found the folder, but it didn't work as well), so far no luck.
I ended up uploading the themes folder separately to the home folder, manually changing the keycloak-server.json file as follows:
"folder": { "dir": "/home/ec2-user/themes" }
I couldn't manage though to have this value taken dynamically from the application.property file.
答案2
得分: 0
创建keycloak-themes.json
文件并放置在src/main/resources/META-INF
目录下,然后添加以下内容:
{
"themes": [{
"name" : "custom",
"types": [ "login", "account", "welcome" ]
}]
}
使用Maven进行编译,然后运行JAR文件。使用以下命令运行:java -jar <jar名称>
。
欲了解更多信息,请参考此链接:https://wjw465150.gitbooks.io/keycloak-documentation/content/server_development/topics/themes.html
英文:
Create keycloak-themes.json
file inside src/main/resources/META-INF
and add below content.
{
"themes": [{
"name" : "custom",
"types": [ "login", "account", "welcome" ]
}]
}
compile using maven and run the jar. java -jar <jar name>
.
For more information refer this
https://wjw465150.gitbooks.io/keycloak-documentation/content/server_development/topics/themes.html
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论