我在使用SPDY和Jetty時遇到客戶端認證問題。如何使用ALPN在Jetty SPDY上使用客戶端證書?
當我和NPN工作和啓動碼頭SPDY服務器它的工作原理:
SSLconnector = new HTTPSPDYServerConnector(server, sslContextFactory);
作爲baseRequest.getHttpChannel()
它使用org.eclipse.jetty.spdy.server.http.HttpChannelOverSPDY
,我可以讀到這樣SSL_SESSION_ID
SSL性能和客戶端證書的代碼,如:
// ... HttpServletRequest request
java.security.cert.X509Certificate client_certs[] = (java.security.cert.X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
但是NPN不是Java8中的選項(請參閱我的問題How to run Jetty with SPDY using ALPN?)。在Java8我必須使用ALPN協議,如:
sslContextFactory.setWantClientAuth(w3srv_config.want_client_auth);
// ...
HttpConfiguration httpConfig = new HttpConfiguration();
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, "alpn");
ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory("spdy/3", "http/1.1");
alpn.setDefaultProtocol("http/1.1");
HTTPSPDYServerConnectionFactory spdy = new HTTPSPDYServerConnectionFactory(SPDY.V3, httpConfig);
HttpConnectionFactory http = new HttpConnectionFactory(httpConfig);
SSLconnector = new ServerConnector(server, new ConnectionFactory[]{ssl, alpn, spdy, http});
//...
有了這個代碼,我null
當我想要得到相關javax.servlet.request.*
任何SSL。它的baseRequest.getHttpChannel()
是org.eclipse.jetty.server.HttpConnection$HttpChannelOverHttp
。
我必須改變以使用客戶端證書嗎?
我做了一些非標準的東西,如排除一些協議,但我沒有配置NPN或ALPN。我只是更換啓動jar並更改我的問題中的啓動代碼。無論如何使用'httpConfig.addCustomizer()'幫助,現在我看到SSL屬性,謝謝! – 2014-09-22 12:20:50