|
20 | 20 | import java.net.InetAddress; |
21 | 21 | import java.net.ServerSocket; |
22 | 22 | import java.security.Principal; |
| 23 | +import java.util.Collections; |
| 24 | +import java.util.List; |
23 | 25 | import java.util.Random; |
24 | 26 |
|
25 | 27 | import javax.net.ssl.SSLContext; |
|
52 | 54 | * running with Kerberos support. |
53 | 55 | */ |
54 | 56 | public class Krb5AndCertsSslSocketConnector extends SslSocketConnector { |
55 | | - public static final String[] KRB5_CIPHER_SUITES = |
56 | | - new String [] {"TLS_KRB5_WITH_3DES_EDE_CBC_SHA"}; |
| 57 | + public static final List<String> KRB5_CIPHER_SUITES = |
| 58 | + Collections.unmodifiableList(Collections.singletonList( |
| 59 | + "TLS_KRB5_WITH_3DES_EDE_CBC_SHA")); |
57 | 60 | static { |
58 | | - System.setProperty("https.cipherSuites", KRB5_CIPHER_SUITES[0]); |
| 61 | + System.setProperty("https.cipherSuites", KRB5_CIPHER_SUITES.get(0)); |
59 | 62 | } |
60 | 63 |
|
61 | 64 | private static final Log LOG = LogFactory |
@@ -136,11 +139,12 @@ protected ServerSocket newServerSocket(String host, int port, int backlog) |
136 | 139 | String [] combined; |
137 | 140 | if(useCerts) { // combine the cipher suites |
138 | 141 | String[] certs = ss.getEnabledCipherSuites(); |
139 | | - combined = new String[certs.length + KRB5_CIPHER_SUITES.length]; |
| 142 | + combined = new String[certs.length + KRB5_CIPHER_SUITES.size()]; |
140 | 143 | System.arraycopy(certs, 0, combined, 0, certs.length); |
141 | | - System.arraycopy(KRB5_CIPHER_SUITES, 0, combined, certs.length, KRB5_CIPHER_SUITES.length); |
| 144 | + System.arraycopy(KRB5_CIPHER_SUITES.toArray(new String[0]), 0, combined, |
| 145 | + certs.length, KRB5_CIPHER_SUITES.size()); |
142 | 146 | } else { // Just enable Kerberos auth |
143 | | - combined = KRB5_CIPHER_SUITES; |
| 147 | + combined = KRB5_CIPHER_SUITES.toArray(new String[0]); |
144 | 148 | } |
145 | 149 |
|
146 | 150 | ss.setEnabledCipherSuites(combined); |
|
0 commit comments