首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在SpringBoot启动期间引用认证文件

如何在SpringBoot启动期间引用认证文件
EN

Stack Overflow用户
提问于 2016-11-08 03:12:50
回答 1查看 995关注 0票数 1

我有一个Mavenized项目(web应用程序),我使用SpringBoot打包并运行它。我将其打包为war,然后使用spring-boot:run maven goal启动它。应用程序调用少数需要证书的第三方供应商RESTful API。我有来自供应商的cacert文件;对于我的本地主机,我将证书文件保存在我的文件系统中,并在SpringBoot启动期间使用javax.net.ssl.trustStore命令行参数引用它,例如:javax.net.ssl.trustStore=<path to cacert file on my file system>我现在决定将证书文件保存在我的类路径中(因此保存在src/main/resources下的某个文件夹中)。我希望SpringBoot在启动时加载此资源,并使用javax.net.ssl.trustStore系统属性引用它。有没有人可以帮助我怎么做?

EN

回答 1

Stack Overflow用户

发布于 2016-11-08 11:38:51

下面是ssl属性列表(将这些属性添加到application.properties文件中):

代码语言:javascript
复制
server.ssl.ciphers= # Supported SSL ciphers.
server.ssl.client-auth= # Whether client authentication is wanted ("want") or needed ("need"). Requires a trust store.
server.ssl.enabled= # Enable SSL support.
server.ssl.enabled-protocols= # Enabled SSL protocols.
server.ssl.key-alias= # Alias that identifies the key in the key store.
server.ssl.key-password= # Password used to access the key in the key store.
server.ssl.key-store= # Path to the key store that holds the SSL certificate (typically a jks file).
server.ssl.key-store-password= # Password used to access the key store.
server.ssl.key-store-provider= # Provider for the key store.
server.ssl.key-store-type= # Type of the key store.
server.ssl.protocol=TLS # SSL protocol to use.
server.ssl.trust-store= # Trust store that holds SSL certificates.
server.ssl.trust-store-password= # Password used to access the trust store.
server.ssl.trust-store-provider= # Provider for the trust store.
server.ssl.trust-store-type= # Type of the trust store.

希望对您有所帮助,参考资料:http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40472805

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档