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   * Tests FTPSERVER-491.
30   *
31   * See <a href="https://issues.apache.org/jira/browse/FTPSERVER-491">
32   *   https://issues.apache.org/jira/browse/FTPSERVER-491</a>
33   */
34  public class NoProtocolSslConfigurationProxy implements SslConfiguration {
35  
36      private final SslConfiguration sslConfiguration;
37  
38      public NoProtocolSslConfigurationProxy(final SslConfiguration sslConfiguration) {
39          this.sslConfiguration = sslConfiguration;
40      }
41  
42      @Override
43      public ClientAuth getClientAuth() {
44          return this.sslConfiguration.getClientAuth();
45      }
46  
47      @Override
48      public String[] getEnabledCipherSuites() {
49          return this.sslConfiguration.getEnabledCipherSuites();
50      }
51  
52      @Override
53      public String[] getEnabledProtocols() {
54          return null;
55      }
56  
57      @Override
58      public SSLSocketFactory getSocketFactory() throws GeneralSecurityException {
59          return this.sslConfiguration.getSocketFactory();
60      }
61  
62      @Override
63      public SSLContext getSSLContext() throws GeneralSecurityException {
64          return this.sslConfiguration.getSSLContext();
65      }
66  
67      @Override
68      public SSLContext getSSLContext(final String protocol) throws GeneralSecurityException {
69          return this.sslConfiguration.getSSLContext(protocol);
70      }
71  
72  }