author | clanger |
Fri, 23 Dec 2016 07:54:05 +0100 | |
changeset 42944 | 641db7ce5057 |
parent 34894 | 3248b89d1921 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
20742
diff
changeset
|
2 |
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package com.sun.net.httpserver; |
|
6906
d57020b6118f
6992545: FindBugs scan - Malicious code vulnerability Warnings in com.sun.net.httpserver.HttpsParameters.*
chegar
parents:
5506
diff
changeset
|
27 |
import java.net.InetSocketAddress; |
7271 | 28 |
//BEGIN_TIGER_EXCLUDE |
2 | 29 |
import javax.net.ssl.SSLParameters; |
7271 | 30 |
//END_TIGER_EXCLUDE |
2 | 31 |
|
32 |
/** |
|
33 |
* Represents the set of parameters for each https |
|
34 |
* connection negotiated with clients. One of these |
|
35 |
* is created and passed to |
|
36 |
* {@link HttpsConfigurator#configure(HttpsParameters)} |
|
37 |
* for every incoming https connection, |
|
38 |
* in order to determine the parameters to use. |
|
39 |
* <p> |
|
40 |
* The underlying SSL parameters may be established either |
|
41 |
* via the set/get methods of this class, or else via |
|
42 |
* a {@link javax.net.ssl.SSLParameters} object. SSLParameters |
|
43 |
* is the preferred method, because in the future, |
|
44 |
* additional configuration capabilities may be added to that class, and |
|
45 |
* it is easier to determine the set of supported parameters and their |
|
46 |
* default values with SSLParameters. Also, if an SSLParameters object is |
|
47 |
* provided via |
|
48 |
* {@link #setSSLParameters(SSLParameters)} then those parameter settings |
|
49 |
* are used, and any settings made in this object are ignored. |
|
50 |
* @since 1.6 |
|
51 |
*/ |
|
52 |
public abstract class HttpsParameters { |
|
53 |
||
54 |
private String[] cipherSuites; |
|
55 |
private String[] protocols; |
|
56 |
private boolean wantClientAuth; |
|
57 |
private boolean needClientAuth; |
|
58 |
||
59 |
protected HttpsParameters() {} |
|
60 |
||
61 |
/** |
|
62 |
* Returns the HttpsConfigurator for this HttpsParameters. |
|
63 |
*/ |
|
64 |
public abstract HttpsConfigurator getHttpsConfigurator(); |
|
65 |
||
66 |
/** |
|
67 |
* Returns the address of the remote client initiating the |
|
68 |
* connection. |
|
69 |
*/ |
|
70 |
public abstract InetSocketAddress getClientAddress(); |
|
71 |
||
7271 | 72 |
//BEGIN_TIGER_EXCLUDE |
2 | 73 |
/** |
74 |
* Sets the SSLParameters to use for this HttpsParameters. |
|
75 |
* The parameters must be supported by the SSLContext contained |
|
76 |
* by the HttpsConfigurator associated with this HttpsParameters. |
|
77 |
* If no parameters are set, then the default behavior is to use |
|
78 |
* the default parameters from the associated SSLContext. |
|
79 |
* @param params the SSLParameters to set. If <code>null</code> |
|
80 |
* then the existing parameters (if any) remain unchanged. |
|
81 |
* @throws IllegalArgumentException if any of the parameters are |
|
82 |
* invalid or unsupported. |
|
83 |
*/ |
|
84 |
public abstract void setSSLParameters (SSLParameters params); |
|
7271 | 85 |
//END_TIGER_EXCLUDE |
2 | 86 |
|
87 |
/** |
|
88 |
* Returns a copy of the array of ciphersuites or null if none |
|
89 |
* have been set. |
|
90 |
* |
|
91 |
* @return a copy of the array of ciphersuites or null if none |
|
92 |
* have been set. |
|
93 |
*/ |
|
94 |
public String[] getCipherSuites() { |
|
6906
d57020b6118f
6992545: FindBugs scan - Malicious code vulnerability Warnings in com.sun.net.httpserver.HttpsParameters.*
chegar
parents:
5506
diff
changeset
|
95 |
return cipherSuites != null ? cipherSuites.clone() : null; |
2 | 96 |
} |
97 |
||
98 |
/** |
|
99 |
* Sets the array of ciphersuites. |
|
100 |
* |
|
101 |
* @param cipherSuites the array of ciphersuites (or null) |
|
102 |
*/ |
|
103 |
public void setCipherSuites(String[] cipherSuites) { |
|
6906
d57020b6118f
6992545: FindBugs scan - Malicious code vulnerability Warnings in com.sun.net.httpserver.HttpsParameters.*
chegar
parents:
5506
diff
changeset
|
104 |
this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null; |
2 | 105 |
} |
106 |
||
107 |
/** |
|
108 |
* Returns a copy of the array of protocols or null if none |
|
109 |
* have been set. |
|
110 |
* |
|
111 |
* @return a copy of the array of protocols or null if none |
|
112 |
* have been set. |
|
113 |
*/ |
|
114 |
public String[] getProtocols() { |
|
6906
d57020b6118f
6992545: FindBugs scan - Malicious code vulnerability Warnings in com.sun.net.httpserver.HttpsParameters.*
chegar
parents:
5506
diff
changeset
|
115 |
return protocols != null ? protocols.clone() : null; |
2 | 116 |
} |
117 |
||
118 |
/** |
|
119 |
* Sets the array of protocols. |
|
120 |
* |
|
121 |
* @param protocols the array of protocols (or null) |
|
122 |
*/ |
|
123 |
public void setProtocols(String[] protocols) { |
|
6906
d57020b6118f
6992545: FindBugs scan - Malicious code vulnerability Warnings in com.sun.net.httpserver.HttpsParameters.*
chegar
parents:
5506
diff
changeset
|
124 |
this.protocols = protocols != null ? protocols.clone() : null; |
2 | 125 |
} |
126 |
||
127 |
/** |
|
128 |
* Returns whether client authentication should be requested. |
|
129 |
* |
|
130 |
* @return whether client authentication should be requested. |
|
131 |
*/ |
|
132 |
public boolean getWantClientAuth() { |
|
133 |
return wantClientAuth; |
|
134 |
} |
|
135 |
||
136 |
/** |
|
137 |
* Sets whether client authentication should be requested. Calling |
|
138 |
* this method clears the <code>needClientAuth</code> flag. |
|
139 |
* |
|
140 |
* @param wantClientAuth whether client authentication should be requested |
|
141 |
*/ |
|
142 |
public void setWantClientAuth(boolean wantClientAuth) { |
|
143 |
this.wantClientAuth = wantClientAuth; |
|
144 |
} |
|
145 |
||
146 |
/** |
|
147 |
* Returns whether client authentication should be required. |
|
148 |
* |
|
149 |
* @return whether client authentication should be required. |
|
150 |
*/ |
|
151 |
public boolean getNeedClientAuth() { |
|
152 |
return needClientAuth; |
|
153 |
} |
|
154 |
||
155 |
/** |
|
156 |
* Sets whether client authentication should be required. Calling |
|
157 |
* this method clears the <code>wantClientAuth</code> flag. |
|
158 |
* |
|
159 |
* @param needClientAuth whether client authentication should be required |
|
160 |
*/ |
|
161 |
public void setNeedClientAuth(boolean needClientAuth) { |
|
162 |
this.needClientAuth = needClientAuth; |
|
163 |
} |
|
164 |
} |