简体   繁体   English

Spring Boot-具有自签名证书的客户端服务器REST API

[英]Spring Boot - client server REST API with self-signed certificate

I made two apps for client and server with RestTemplate RestController . 我使用RestTemplate RestController为客户端和服务器制作了两个应用程序。

Needed to encrypt API with self-signed certificate, 'RestController' on server side should answer only to signed requests. 需要使用自签名证书对API进行加密,服务器端的“ RestController”应仅回答已签名的请求。

Is it possible with Spring Boot RestTemplate / RestController ? Spring Boot RestTemplate / RestController是否可以?

  • how to do it 怎么做
  • on client side 在客户端
  • on server side 在服务器端

The Spring Boot doc provides informations on how to configure the server: https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html#howto-configure-ssl Spring Boot文档提供了有关如何配置服务器的信息: https : //docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html#howto-configure-ssl

For configuring the client RestTemplate see here (4. The Spring RestTemplate with SSL) http://www.baeldung.com/httpclient-ssl 有关配置客户端RestTemplate的信息,请参见此处(4.使用SSL的Spring RestTemplate) http://www.baeldung.com/httpclient-ssl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM