49765
|
1 |
/*
|
|
2 |
* Copyright (c) 2018, 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 jdk.internal.net.http.common;
|
|
27 |
|
|
28 |
import java.security.Principal;
|
|
29 |
import java.util.List;
|
|
30 |
import javax.net.ssl.SSLSession;
|
|
31 |
import javax.net.ssl.SSLSessionContext;
|
|
32 |
import javax.net.ssl.SSLPeerUnverifiedException;
|
|
33 |
import javax.net.ssl.SNIServerName;
|
|
34 |
|
|
35 |
/**
|
|
36 |
* All mutating methods throw UnsupportedOperationException
|
|
37 |
*/
|
|
38 |
public class ImmutableSSLSession implements SSLSession {
|
|
39 |
private final SSLSession delegate;
|
|
40 |
|
|
41 |
ImmutableSSLSession(SSLSession session) {
|
|
42 |
this.delegate = session;
|
|
43 |
}
|
|
44 |
|
|
45 |
public byte[] getId() {
|
|
46 |
return delegate.getId();
|
|
47 |
}
|
|
48 |
|
|
49 |
public SSLSessionContext getSessionContext() {
|
|
50 |
return delegate.getSessionContext();
|
|
51 |
}
|
|
52 |
|
|
53 |
public long getCreationTime() {
|
|
54 |
return delegate.getCreationTime();
|
|
55 |
}
|
|
56 |
|
|
57 |
public long getLastAccessedTime() {
|
|
58 |
return delegate.getLastAccessedTime();
|
|
59 |
}
|
|
60 |
|
|
61 |
public void invalidate() {
|
|
62 |
throw new UnsupportedOperationException("session is not mutable");
|
|
63 |
}
|
|
64 |
|
|
65 |
public boolean isValid() {
|
|
66 |
return delegate.isValid();
|
|
67 |
}
|
|
68 |
|
|
69 |
public void putValue(String name, Object value) {
|
|
70 |
throw new UnsupportedOperationException("session is not mutable");
|
|
71 |
}
|
|
72 |
|
|
73 |
public Object getValue(String name) {
|
|
74 |
return delegate.getValue(name);
|
|
75 |
}
|
|
76 |
|
|
77 |
public void removeValue(String name) {
|
|
78 |
throw new UnsupportedOperationException("session is not mutable");
|
|
79 |
}
|
|
80 |
|
|
81 |
public String [] getValueNames() {
|
|
82 |
return delegate.getValueNames();
|
|
83 |
}
|
|
84 |
|
|
85 |
public java.security.cert.Certificate [] getPeerCertificates()
|
|
86 |
throws SSLPeerUnverifiedException {
|
|
87 |
return delegate.getPeerCertificates();
|
|
88 |
}
|
|
89 |
|
|
90 |
public java.security.cert.Certificate [] getLocalCertificates() {
|
|
91 |
return delegate.getLocalCertificates();
|
|
92 |
}
|
|
93 |
|
|
94 |
@Deprecated
|
|
95 |
public javax.security.cert.X509Certificate [] getPeerCertificateChain()
|
|
96 |
throws SSLPeerUnverifiedException {
|
|
97 |
return delegate.getPeerCertificateChain();
|
|
98 |
}
|
|
99 |
|
|
100 |
public Principal getPeerPrincipal()
|
|
101 |
throws SSLPeerUnverifiedException {
|
|
102 |
return delegate.getPeerPrincipal();
|
|
103 |
}
|
|
104 |
|
|
105 |
public Principal getLocalPrincipal() {
|
|
106 |
return delegate.getLocalPrincipal();
|
|
107 |
}
|
|
108 |
|
|
109 |
public String getCipherSuite() {
|
|
110 |
return delegate.getCipherSuite();
|
|
111 |
}
|
|
112 |
|
|
113 |
public String getProtocol() {
|
|
114 |
return delegate.getProtocol();
|
|
115 |
}
|
|
116 |
|
|
117 |
public String getPeerHost() {
|
|
118 |
return delegate.getPeerHost();
|
|
119 |
}
|
|
120 |
|
|
121 |
public int getPeerPort() {
|
|
122 |
return delegate.getPeerPort();
|
|
123 |
}
|
|
124 |
|
|
125 |
public int getPacketBufferSize() {
|
|
126 |
return delegate.getPacketBufferSize();
|
|
127 |
}
|
|
128 |
|
|
129 |
public int getApplicationBufferSize() {
|
|
130 |
return delegate.getApplicationBufferSize();
|
|
131 |
}
|
|
132 |
}
|