【问题标题】:How to allow only https requests in spring boot如何在spring boot中只允许https请求
【发布时间】:2017-08-07 18:23:00
【问题描述】:

我们可以在 Spring Boot 中限制我们的 REST API 以允许唯一的 https 请求,而无需任何证书

【问题讨论】:

标签: spring-boot spring-security


【解决方案1】:

您可以参考此链接了解 Spring Boot 应用程序的基本 https 限制:https://drissamri.be/blog/java/enable-https-in-spring-boot/

关于应用程序类路径之外的证书,请查看server.ssl.key-store 属性:

server.port: 8443
security.require-ssl=true
server.ssl.key-store:/etc/your/path/keystore.p12
server.ssl.key-store-password: <your-password>
server.ssl.keyStoreType: PKCS12
server.ssl.keyAlias: tomcat

【讨论】:

  • 感谢您的信息......对不起,也许我的问题不太清楚,我们可以在不涉及任何证书的情况下这样做
  • 很遗憾,我认为这是不可能的,您需要生成自签名证书或从证书颁发机构获取。
猜你喜欢
  • 1970-01-01
  • 2018-10-09
  • 1970-01-01
  • 2020-06-10
  • 2017-01-04
  • 2016-04-06
  • 1970-01-01
  • 1970-01-01
  • 2022-12-21
相关资源
最近更新 更多