Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/net/httpserver/HttpsParameters.java
38922 views
1
/*
2
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
24
*/
25
26
package com.sun.net.httpserver;
27
import java.net.InetSocketAddress;
28
//BEGIN_TIGER_EXCLUDE
29
import javax.net.ssl.SSLParameters;
30
//END_TIGER_EXCLUDE
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
@jdk.Exported
53
public abstract class HttpsParameters {
54
55
private String[] cipherSuites;
56
private String[] protocols;
57
private boolean wantClientAuth;
58
private boolean needClientAuth;
59
60
protected HttpsParameters() {}
61
62
/**
63
* Returns the HttpsConfigurator for this HttpsParameters.
64
*/
65
public abstract HttpsConfigurator getHttpsConfigurator();
66
67
/**
68
* Returns the address of the remote client initiating the
69
* connection.
70
*/
71
public abstract InetSocketAddress getClientAddress();
72
73
//BEGIN_TIGER_EXCLUDE
74
/**
75
* Sets the SSLParameters to use for this HttpsParameters.
76
* The parameters must be supported by the SSLContext contained
77
* by the HttpsConfigurator associated with this HttpsParameters.
78
* If no parameters are set, then the default behavior is to use
79
* the default parameters from the associated SSLContext.
80
* @param params the SSLParameters to set. If <code>null</code>
81
* then the existing parameters (if any) remain unchanged.
82
* @throws IllegalArgumentException if any of the parameters are
83
* invalid or unsupported.
84
*/
85
public abstract void setSSLParameters (SSLParameters params);
86
//END_TIGER_EXCLUDE
87
88
/**
89
* Returns a copy of the array of ciphersuites or null if none
90
* have been set.
91
*
92
* @return a copy of the array of ciphersuites or null if none
93
* have been set.
94
*/
95
public String[] getCipherSuites() {
96
return cipherSuites != null ? cipherSuites.clone() : null;
97
}
98
99
/**
100
* Sets the array of ciphersuites.
101
*
102
* @param cipherSuites the array of ciphersuites (or null)
103
*/
104
public void setCipherSuites(String[] cipherSuites) {
105
this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null;
106
}
107
108
/**
109
* Returns a copy of the array of protocols or null if none
110
* have been set.
111
*
112
* @return a copy of the array of protocols or null if none
113
* have been set.
114
*/
115
public String[] getProtocols() {
116
return protocols != null ? protocols.clone() : null;
117
}
118
119
/**
120
* Sets the array of protocols.
121
*
122
* @param protocols the array of protocols (or null)
123
*/
124
public void setProtocols(String[] protocols) {
125
this.protocols = protocols != null ? protocols.clone() : null;
126
}
127
128
/**
129
* Returns whether client authentication should be requested.
130
*
131
* @return whether client authentication should be requested.
132
*/
133
public boolean getWantClientAuth() {
134
return wantClientAuth;
135
}
136
137
/**
138
* Sets whether client authentication should be requested. Calling
139
* this method clears the <code>needClientAuth</code> flag.
140
*
141
* @param wantClientAuth whether client authentication should be requested
142
*/
143
public void setWantClientAuth(boolean wantClientAuth) {
144
this.wantClientAuth = wantClientAuth;
145
}
146
147
/**
148
* Returns whether client authentication should be required.
149
*
150
* @return whether client authentication should be required.
151
*/
152
public boolean getNeedClientAuth() {
153
return needClientAuth;
154
}
155
156
/**
157
* Sets whether client authentication should be required. Calling
158
* this method clears the <code>wantClientAuth</code> flag.
159
*
160
* @param needClientAuth whether client authentication should be required
161
*/
162
public void setNeedClientAuth(boolean needClientAuth) {
163
this.needClientAuth = needClientAuth;
164
}
165
}
166
167