我需要在jetty服务器上使用证书进行客户端身份验证。
我在Tomcat上使用:
完成了这项工作<Connector
protocol="org.apache.coyote.http11.Http11Protocol"
port="8443" maxThreads="200"
minSpareThreads="5"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100"
scheme="https" secure="true" SSLEnabled="true"
keystoreFile="D:\certificates\certs\server.jks" keystoreType="JKS" keystorePass="password"
truststoreFile="D:\certificates\certs\trust_store.jks" truststoreType="JKS" truststorePass="password"
clientAuth="true"
sslProtocol="TLS"/>
但我想在karaf上做,所以我了解到我可以通过在jetty.xml上添加以下内容来实现:
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
<Arg>
<New class="org.eclipse.jetty.http.ssl.SslContextFactory">
<Set name="KeyStore">./etc/keystores/server.jks</Set>
<Set name="KeyStorePassword">password</Set>
<Set name="KeyManagerPassword">password</Set>
<Set name="TrustStore">./etc/keystores/trust_store.jks</Set>
<Set name="TrustStorePassword">password</Set>
</New>
</Arg>
<Set name="port">8443</Set>
<Set name="maxIdleTime">30000</Set>
</New>
</Arg>
并关注org.ops4j.pax.web.xml:
org.osgi.service.http.port=8181
org.osgi.service.http.port.secure=8443
org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=./etc/keystores/keystore.jks
org.ops4j.pax.web.ssl.password=password
org.ops4j.pax.web.ssl.keypassword=password
#org.ops4j.pax.web.ssl.clientauthwanted=false
org.ops4j.pax.web.ssl.clientauthneeded=true
但它不适用于karaf,它不会要求客户证书。它仅适用于使用服务器证书身份验证的https。
我缺少什么?
答案 0 :(得分:2)
需要进行2项更改:
org.ops4j.pax.web.config.file=./etc/jetty.xml
添加到org.ops4j.pax.web.cfg