Spring Boot - 具有自签名证书的客户端服务器REST API
问题描述:
我为客户端和服务器制作了两个应用程序,分别是RestTemplate
RestController
。Spring Boot - 具有自签名证书的客户端服务器REST API
需要使用自签名证书对API进行加密,服务器端的'RestController'只能回答签名请求。
Spring Boot RestTemplate
/RestController
可能吗?
- 怎么办呢
- 在客户端
- 在服务器端
答
春季启动文档提供了有关如何配置服务器的信息: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html#howto-configure-ssl
对于配置客户端RestTemplate请参阅此处(4.使用SSL的Spring Rest模板) http://www.baeldung.com/httpclient-ssl
是的,这是可能的,你可以在网上找到使用ssl在春季启动休息。如果您想使用像RestTemplate这样的客户端,则需要将证书添加到您的JRE:lib/security/cacerts。你可以在网上找到如何做到这一点。 –