我们的 Undertow 扩展确实支持它,但不幸的是,没有记录。
您可以定义如下内容:
quarkus.http.ssl.certificate.file=...
quarkus.http.ssl.certificate.key-file=...
...
Run Code Online (Sandbox Code Playgroud)
在您的 application.properties 中。
配置入口点是ServerSslConfig(见https://github.com/quarkusio/quarkus/blob/master/core/runtime/src/main/java/io/quarkus/runtime/configuration/ssl/ServerSslConfig.java#L41)。然后添加带有点的嵌套属性并将驼峰式大小写转换为破折号。
如果您想构建本机可执行文件,很有可能您也必须添加quarkus.ssl.native=true。
如果您有反馈或想为此贡献指南,请随时加入我们的 Zulip 或在 GitHub 上打开问题/PR。
谢谢先生。Guillaume Smet,我找到了解决方案。这是“使用Quarkus和SSL指南,在5分钟内从零到问候”。这是由quarkus undertow插件完成的。另外,您将需要文本编辑器,jdk 1.8+和maven安装。
第一,创建项目。
mkdir restls
cd restls
mvn io.quarkus:quarkus-maven-plugin:create -DprojectGroupId=org.acme -DprojectArtifactId=restls -DclassName="org.acme.HelloResource" -Dpath="/hello" -Dextensions="undertow"
Run Code Online (Sandbox Code Playgroud)
src/main/resources/application.properties使用任何编辑器打开您的应用程序配置文件,并添加以下行:
quarkus.http.port=80
quarkus.http.ssl-port=443
quarkus.http.ssl.certificate.key-store-file=keystore.jks
Run Code Online (Sandbox Code Playgroud)
创建包含自签名证书的密钥库(回答所有问题并指定密码为“ password”):
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 365 -keysize 2048
Run Code Online (Sandbox Code Playgroud)
生成项目:
mvnw clean package quarkus:build
Run Code Online (Sandbox Code Playgroud)
现在尝试一下:
java -jar target/restls-1.0-SNAPSHOT-runner.jar
Run Code Online (Sandbox Code Playgroud)
导航到https:// localhost / hello,并允许您的浏览器信任证书。就这样。
您可以像这样在调用时间中覆盖选项:
java -Dquarkus.http.ssl.certificate.key-store-file=/path-to-keystore/keystore-name.jks -jar target/restls-1.0-SNAPSHOT-runner.jar
Run Code Online (Sandbox Code Playgroud)
最后,这是相关的选项列表:
quarkus.http.ssl.certificate.file -- The file path to a server certificate or certificate chain in PEM format.
quarkus.http.ssl.certificate.key-file -- The file path to the corresponding certificate private key file in PEM format.
quarkus.http.ssl.certificate.key-store-file -- An optional key store which holds the certificate information instead of specifying separate files.
quarkus.http.ssl.certificate.key-store-file-type -- An optional parameter to specify type of the key store file. If not given, the type is automatically detected based on the file name.
Run Code Online (Sandbox Code Playgroud)
您可以指定PEM格式的证书+密钥文件或密钥库。
| 归档时间: |
|
| 查看次数: |
783 次 |
| 最近记录: |