我需要为我的项目实现本地 ssl 以实现 OAuth。我通读了 xsbt-web-plugin 页面(此处)。我按照此处的建议创建了密钥库。
keytool -genkey -alias localhost -keyalg RSA -keystore localhost.jks -keysize 2048
我让它使用我在这里找到的码头配置文件为 https 服务。这是它的样子:
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg>
<New class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="keyStore">localhost.jks</Set>
<Set name="keyStorePassword">password</Set>
<Set name="keyManagerPassword">password</Set>
<Set name="trustStore">localhost.jks</Set>
<Set name="trustStorePassword">password</Set>
</New>
</Arg>
<Set name="port">8443</Set>
<Set name="maxIdleTime">30000</Set>
</New>
</Arg>
</Call>
</Configure>
我的 SBT 配置如下所示:
customConfiguration in container.Configuration := true
ssl in container.Configuration := Some("127.0.0.1", 8443, "localhost.jks", "password", "password")
configurationFiles in container.Configuration := Seq(file("path\\to\\jetty.xml"))
控制台上也有此警告:
2017-03-13 16:06:56.819:WARN:oeji.nio:javax.net.ssl.SSLException: Inbound closed before receiving peer's close_notify: possible truncation attack?
码头:8.1.7/电梯:2.6.2
请指教。谢谢你。