有没有使用quarkus.io构建和配置受TLS保护的restful服务的示例/教程?
不幸的是,我在quarkus documentation上也找不到,这里也找不到。
发布于 2019-04-09 19:38:31
它确实由我们的Undertow扩展支持,但不幸的是,没有文档记录。
您可以定义如下内容:
quarkus.http.ssl.certificate.file=...
quarkus.http.ssl.certificate.key-file=...
...在你的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上打开问题/公关。
发布于 2019-04-12 16:25:49
谢谢先生。纪劳姆·斯梅特我找到解决方案了。这里是“使用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"使用任何编辑器打开您的应用程序配置文件src/main/resources/application.properties并添加行:
quarkus.http.port=80
quarkus.http.ssl-port=443
quarkus.http.ssl.certificate.key-store-file=keystore.jks创建包含自签名证书的密钥库(回答所有问题并指定密码名称" password "):
keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 365 -keysize 2048文件keystore.jks必须位于src/main/resources/文件夹中。
构建项目:
mvnw clean package quarkus:build现在试一试:
java -jar target/restls-1.0-SNAPSHOT-runner.jar导航到 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最后,下面是相关选项列表:
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.您可以指定PEM格式的证书+密钥文件或密钥库。
https://stackoverflow.com/questions/55588382
复制相似问题