01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.geronimo.jetty6.connector;
21:
22: import java.security.KeyStoreException;
23: import java.security.NoSuchAlgorithmException;
24: import java.security.UnrecoverableKeyException;
25: import java.security.NoSuchProviderException;
26: import java.security.KeyManagementException;
27: import java.security.cert.CertificateException;
28: import java.io.IOException;
29:
30: import javax.net.ssl.SSLServerSocketFactory;
31: import javax.net.ssl.SSLContext;
32:
33: import org.mortbay.jetty.security.SslSocketConnector;
34: import org.mortbay.jetty.security.SslSelectChannelConnector;
35: import org.apache.geronimo.management.geronimo.KeystoreManager;
36:
37: /**
38: * SSL listener that hooks into the Geronimo keystore infrastructure.
39: *
40: * @version $Rev: 543715 $ $Date: 2007-06-02 01:10:16 -0700 (Sat, 02 Jun 2007) $
41: */
42: public class GeronimoSelectChannelSSLListener extends
43: SslSelectChannelConnector {
44: private KeystoreManager manager;
45: private String keyStore;
46: private String trustStore;
47: private String keyAlias;
48:
49: public GeronimoSelectChannelSSLListener(KeystoreManager manager) {
50: this .manager = manager;
51: }
52:
53: protected SSLContext createSSLContext() throws Exception {
54: return manager.createSSLContext(null, getProtocol(),
55: getSslKeyManagerFactoryAlgorithm(), keyStore, keyAlias,
56: trustStore, SslSocketConnector.class.getClassLoader());
57: }
58:
59: public String getKeyStore() {
60: return keyStore;
61: }
62:
63: public void setKeyStore(String keyStore) {
64: this .keyStore = keyStore;
65: }
66:
67: public String getTrustStore() {
68: return trustStore;
69: }
70:
71: public void setTrustStore(String trustStore) {
72: this .trustStore = trustStore;
73: }
74:
75: public String getKeyAlias() {
76: return keyAlias;
77: }
78:
79: public void setKeyAlias(String keyAlias) {
80: this.keyAlias = keyAlias;
81: }
82: }
|