View Javadoc
1   /**
2    * Logback: the reliable, generic, fast and flexible logging framework.
3    * Copyright (C) 1999-2015, QOS.ch. All rights reserved.
4    *
5    * This program and the accompanying materials are dual-licensed under
6    * either the terms of the Eclipse Public License v1.0 as published by
7    * the Eclipse Foundation
8    *
9    *   or (per the licensee's choosing)
10   *
11   * under the terms of the GNU Lesser General Public License version 2.1
12   * as published by the Free Software Foundation.
13   */
14  package ch.qos.logback.core.net.ssl;
15  
16  /**
17   * An object that has configurable SSL parameters.
18   * <p>
19   * This interface allows us o decouple the
20   * {@link ch.qos.logback.core.net.ssl.SSLParametersConfiguration
21   * SSLParametersConfiguration} from {@link javax.net.ssl.SSLSocket SSLSocket}
22   * and {@link javax.net.ssl.SSLServerSocket SSLServerSocket} to facilitate unit
23   * testing.
24   *
25   * @author Carl Harris
26   * @author Bruno Harbulot
27   */
28  public interface SSLConfigurable {
29  
30      /**
31       * Gets the set of protocols that the SSL component enables by default.
32       * 
33       * @return protocols (generally a subset of the set returned by
34       *         {@link #getSupportedProtocols()}); the return value may be an empty
35       *         array but must never be {@code null}.
36       */
37      String[] getDefaultProtocols();
38  
39      /**
40       * Gets the set of protocols that the SSL component supports.
41       * 
42       * @return protocols supported protocols; the return value may be an empty array
43       *         but must never be {@code null}.
44       */
45      String[] getSupportedProtocols();
46  
47      /**
48       * Sets the enabled protocols on the SSL component.
49       * 
50       * @param protocols the protocols to enable
51       */
52      void setEnabledProtocols(String[] protocols);
53  
54      /**
55       * Gets the set of cipher suites that the SSL component enables by default.
56       * 
57       * @return cipher suites (generally a subset of the set returned by
58       *         {@link #getSupportedCipherSuites()}); the return value may be an
59       *         empty array but must never be {@code null}
60       */
61      String[] getDefaultCipherSuites();
62  
63      /**
64       * Gets the set of cipher suites that the SSL component supports.
65       * 
66       * @return supported cipher suites; the return value may be an empty array but
67       *         must never be {@code null}
68       */
69      String[] getSupportedCipherSuites();
70  
71      /**
72       * Sets the enabled cipher suites on the SSL component.
73       * 
74       * @param cipherSuites the cipher suites to enable
75       */
76      void setEnabledCipherSuites(String[] cipherSuites);
77  
78      /**
79       * Sets a flag indicating whether the SSL component should require client
80       * authentication.
81       * 
82       * @param state the flag state to set
83       */
84      void setNeedClientAuth(boolean state);
85  
86      /**
87       * Sets a flag indicating whether the SSL component should request client
88       * authentication.
89       * 
90       * @param state the flag state to set
91       */
92      void setWantClientAuth(boolean state);
93  
94      void setHostnameVerification(boolean verifyHostname);
95  
96  }