Java Spring Boot中基于URL的SSL证书验证
我的要求是使用springboot使用SSL保护api。我探讨了两种选择Java Spring Boot中基于URL的SSL证书验证,java,spring-boot,ssl,ssl-certificate,Java,Spring Boot,Ssl,Ssl Certificate,我的要求是使用springboot使用SSL保护api。我探讨了两种选择 **1. Enable SSL certificate verification for all APIs using application.properties SSL confiuration. 2. Enable SSL for HTTPS port using application.properties** Is there any way to configure URL
**1. Enable SSL certificate verification for all APIs using application.properties SSL confiuration.
2. Enable SSL for HTTPS port using application.properties**
Is there any way to configure URL(Servlet Path) based SSL certificate verification in Spring boot? .
Like some urls should be consumed by SSL certificate only.
任何帮助都将不胜感激
像某些URL一样,应该仅由SSL证书使用
对于这一个,不要认为这是可能的。HTTPS固定到特定端口,并且它只是一个端口。如果您将spring引导部署为Jar并启用SSL,那么到该端口的所有连接都将是HTTPS。在这种情况下,您需要将应用程序拆分为两个应用程序,一个用于HTTP,另一个用于HTTPS
即使您将WAR部署到外部提供的tomcat上,您也可能无法避免这种情况,因为SSL仅限于端口级别。如果您计划部署为WAR,则可以参考了解更多信息
更新:
除非您像@Sebastian建议的那样确定,否则您可以在配置两个端口时进行部署,一个是HTTP(80),另一个是HTTPS(443)。然后,您可以使用
http://
和https://
来实现您的目标,尽管这听起来不像您想要的是否有任何方法可以配置基于URL(Servlet路径)的SSL证书验证
这可以通过Spring Securtiy完成。这可能会有帮助:谢谢@Sebastian,这真的很有帮助。我将实现它,感谢Sam,目标是基于url将幂等请求设置为不安全,将其他请求设置为安全