[英]How to get locale selected in keycloak login page, not user default locale?
I am working on a springboot application with the keycloak springboot adaptor.我正在使用 keycloak springboot 适配器开发一个 springboot 应用程序。 In the AccessToken, I can find the locale defined in the user keycloak.
在 AccessToken 中,我可以找到用户 keycloak 中定义的语言环境。 But i want to get the locale selected on the login page.
但我想在登录页面上选择语言环境。
How can get this info?怎样才能得到这些信息?
thanks in advance提前致谢
In my application (@ Server A ) the /backoffice
urls secured by Keycloak.在我的应用程序(@Server A )中,由 Keycloak 保护的
/backoffice
url。 If a user will open the backoffice he is redirected to Keycloak login (@ Server B ).如果用户打开后台,他会被重定向到 Keycloak 登录(@Server B )。
If I pass ui_locales=de
or ui_locales=en
in my application on Server A then it's respected during the redirect and Keycloak will display the login page in the proper language on Server B .如果我在服务器 A上的应用程序中传递
ui_locales=de
或ui_locales=en
,则在重定向期间会尊重它,并且 Keycloak 将在服务器 B上以正确的语言显示登录页面。
Beforehand, de and en message properties files a present in your Keycloak themes and internationalization must enabled in your Keycloak realm configuration.事先,必须在 Keycloak realm 配置中启用 Keycloak 主题中的 de 和 en 消息属性文件和国际化。
localhost:5050/backoffice?ui_locales=de
result in german Keycloak login page and localhost:5050/backoffice?ui_locales=en
results in english Keycloak login page. localhost:5050/backoffice?ui_locales=de
德语 Keycloak 登录页面, localhost:5050/backoffice?ui_locales=en
生成英文 Keycloak 登录页面。
greetz问候
My sources and thanks to:我的消息来源并感谢:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.