keycloak - 在 Keycloak 中配置身份联合时,无法进行身份提供者 oauth 回调
问题描述
Keycloak 托管在 Docker 容器内。目标是在 keyclaok(K1) 和另一个合作的 Keycloak (K2) 之间进行身份联合。K2 托管在 SSL 连接后面。
根据文档,我配置了信任库。但是,我仍然收到以下错误,
Exception: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
我为此目的更新了standalone.xml
[1] - https://www.keycloak.org/docs/latest/server_installation/index.html#_truststore
解决方案
从 4.5.0 开始,Keycloak Docker 镜像默认使用standalone-ha.xml 而不是standalone.xml。这就是 Keycloak 无法识别新的信任库的原因。以下是使用基于 docker 的部署在 Keycloak 中配置信任库的步骤。
步骤1 :
将以下步骤添加到standalone-ha.xml 文件。
<spi name="truststore">
<provider name="file" enabled="true">
<properties>
<property name="file" value="/opt/jboss/truststore.jks"/>
<property name="password" value="password"/>
<property name="hostname-verification-policy" value="WILDCARD"/>
<property name="disabled" value="false"/>
</properties>
</provider>
</spi>
第2步:
将文件复制到 docker 容器
docker cp standalone-ha.xml continer_id:/opt/jboss/keycloak/standalone/configuration/standalone-ha.xml
第 3 步:
复制容器内的证书。证书可以从浏览器本身导出(公共证书)。
docker cp cert.crt 9fbd81264f65:/opt/jboss/cert.crt
第4步:
ssh 进入容器
docker exec -it container_id bash
第 5 步:
keytool -import -alias efactory-nimble.salzburgresearch.at -keystore truststore.jks -file cert.crt
第 6 步:
码头工人重新启动container_id
[1] - https://lists.jboss.org/pipermail/keycloak-user/2018-October/016066.html
推荐阅读
- javascript - 如何从地图中获取id
- mysql - 像 npm 这样的服务的架构是什么?
- excel - vba excel,如何在用户窗体上重命名文本框
- xml - XSLT 中的字符串到日期转换返回未找到函数
- c# - C# Excel 互操作 xl.XlDirection 枚举
- opennms - openNMS - 更改现有目标路径
- python-3.x - 关于使用 SoftmaxCentered Bijector 的问题
- cuda - CUDA 执行配置语法...如何让编译器识别它?
- c# - C# 通过注册表获取 Windows 驱动器硬件标题
- javascript - 反应错误 index.js:1452 警告:数组或迭代器中的每个孩子都应该有一个唯一的“键”道具