spring-boot - 如何在我的 Spring Boot 应用程序中使用 wso2 身份服务器休息服务
问题描述
我正在尝试
"https://localhost:9443/api/identity/recovery/v0.9/recover-password?type=email¬ify=false"
使用休息模板来使用 wso2 中的休息服务之一。但我越来越低于例外
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://localhost:9443/api/identity/recovery/v0.9/recover-password": sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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 org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:744) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:670) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:579) at com.diligent.cdd.master.services.impl.UserServiceImpl.getWSO2ResetPWDKey(UserServiceImpl.java:49) at com.diligent.cdd.master.services.impl.UserServiceImpl.resetUserPwd(UserServiceImpl.java:43) at com.diligent.cdd.master.controllers.UserController.resetUserPassword(UserController.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
我尝试通过以下方式在我的应用程序中启用 ssl 属性,
server.ssl.key-store-type=JKS
server.ssl.key-store=classpath:wso2carbon.jks
server.ssl.key-store-password=wso2carbon
server.ssl.key-alias=wso2carbon
解决方案
发生这种情况是因为 WSO2 身份服务器在 SSL 握手期间需要应用程序的证书,并且信任库中缺少应用程序的证书。所以你要做的是,
- 将应用程序的 SSL 公共证书导入 Identity Server 的 client-truststore.jks。它位于 /repository/resources/security/ 文件夹中。
- 您可以使用以下命令导入客户端信任库。
keytool -importcert -alias -file -keystore ${IS_HOME}/repository/resources/security/client-truststore.jks -storepass wso2carbon -noprompt
- 重新启动服务器。
你可以参考这个博客。希望这能解决您的问题
推荐阅读
- python - 删除由多个 tkinter 小部件组成的对象
- xml - 根据子节点值删除xml中的节点
- python - 具有线性 y 轴和 log x 轴的最佳拟合线半对数刻度
- javascript - 修复导航栏子菜单离开屏幕的问题
- javascript - 在 Jest 中使某些测试保持沉默
- java - Python 网络字节数与 java 略有不同
- javascript - 如何在反应中比较if语句中的所有数组元素
- bash - 删除目录中的文件并忽略如果为空-BASH
- php - Laravel 文件存储 URL 在本地工作,但在真实服务器上是 404
- javascript - 单击时捕获隐藏在 Leaflet 弹出窗口中的 ID 需要单击两次才能更新 [Javascript]