001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.jetty6.connector;
018    
019    import org.mortbay.jetty.security.SslSocketConnector;
020    import org.apache.geronimo.management.geronimo.KeystoreManager;
021    
022    import javax.net.ssl.SSLServerSocketFactory;
023    
024    /**
025     * SSL listener that hooks into the Geronimo keystore infrastructure.
026     *
027     * @version $Rev: 543715 $ $Date: 2007-06-02 04:10:16 -0400 (Sat, 02 Jun 2007) $
028     */
029    public class GeronimoSocketSSLListener extends SslSocketConnector {
030        private KeystoreManager manager;
031        private String keyStore;
032        private String trustStore;
033        private String keyAlias;
034    
035        public GeronimoSocketSSLListener(KeystoreManager manager) {
036            this.manager = manager;
037        }
038    
039        protected SSLServerSocketFactory createFactory() throws Exception {
040            // we need the server factory version.
041            return manager.createSSLServerFactory(null, getProtocol(), getSslKeyManagerFactoryAlgorithm(), keyStore, keyAlias, trustStore, SslSocketConnector.class.getClassLoader());
042        }
043    
044        public String getKeyStore() {
045            return keyStore;
046        }
047    
048        public void setKeyStore(String keyStore) {
049            this.keyStore = keyStore;
050        }
051    
052        public String getTrustStore() {
053            return trustStore;
054        }
055    
056        public void setTrustStore(String trustStore) {
057            this.trustStore = trustStore;
058        }
059    
060        public String getKeyAlias() {
061            return keyAlias;
062        }
063    
064        public void setKeyAlias(String keyAlias) {
065            this.keyAlias = keyAlias;
066        }
067    }