View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.net.ftp;
19  
20  import java.security.GeneralSecurityException;
21  
22  import javax.net.ssl.SSLContext;
23  import javax.net.ssl.SSLSocketFactory;
24  
25  import org.apache.ftpserver.ssl.ClientAuth;
26  import org.apache.ftpserver.ssl.SslConfiguration;
27  
28  /**
29   * See:
30   * <a href="https://issues.apache.org/jira/browse/FTPSERVER-491">
31   *   https://issues.apache.org/jira/browse/FTPSERVER-491</a>
32   */
33  public class NoProtocolSslConfigurationProxy implements SslConfiguration {
34  
35      private final SslConfiguration sslConfiguration;
36  
37      public NoProtocolSslConfigurationProxy(final SslConfiguration sslConfiguration) {
38          this.sslConfiguration = sslConfiguration;
39      }
40  
41      @Override
42      public ClientAuth getClientAuth() {
43          return this.sslConfiguration.getClientAuth();
44      }
45  
46      @Override
47      public String[] getEnabledCipherSuites() {
48          return this.sslConfiguration.getEnabledCipherSuites();
49      }
50  
51      @Override
52      public String[] getEnabledProtocols() {
53          return null;
54      }
55  
56      @Override
57      public SSLSocketFactory getSocketFactory() throws GeneralSecurityException {
58          return this.sslConfiguration.getSocketFactory();
59      }
60  
61      @Override
62      public SSLContext getSSLContext() throws GeneralSecurityException {
63          return this.sslConfiguration.getSSLContext();
64      }
65  
66      @Override
67      public SSLContext getSSLContext(final String protocol) throws GeneralSecurityException {
68          return this.sslConfiguration.getSSLContext(protocol);
69      }
70  
71  }