mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8266459: Implement JEP 411: Deprecate the Security Manager for Removal
Co-authored-by: Sean Mullan <mullan@openjdk.org> Co-authored-by: Lance Andersen <lancea@openjdk.org> Co-authored-by: Weijun Wang <weijun@openjdk.org> Reviewed-by: erikj, darcy, chegar, naoto, joehw, alanb, mchung, kcr, prr, lancea
This commit is contained in:
parent
19450b9951
commit
6765f90250
826 changed files with 2734 additions and 757 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -66,6 +66,7 @@ final class AlpnExtension {
|
|||
static final Charset alpnCharset;
|
||||
|
||||
static {
|
||||
@SuppressWarnings("removal")
|
||||
String alpnCharsetString = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) ()
|
||||
-> Security.getProperty("jdk.tls.alpnCharset"));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -229,6 +229,7 @@ final class PredefinedDHParameterSpecs {
|
|||
static final Map<Integer, DHParameterSpec> ffdheParams;
|
||||
|
||||
static {
|
||||
@SuppressWarnings("removal")
|
||||
String property = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
public String run() {
|
||||
|
|
|
@ -415,6 +415,7 @@ enum SSLCipher {
|
|||
|
||||
static {
|
||||
final long max = 4611686018427387904L; // 2^62
|
||||
@SuppressWarnings("removal")
|
||||
String prop = AccessController.doPrivileged(
|
||||
new PrivilegedAction<String>() {
|
||||
@Override
|
||||
|
|
|
@ -79,6 +79,7 @@ final class SSLConfiguration implements Cloneable {
|
|||
BiFunction<SSLSocket, List<String>, String> socketAPSelector;
|
||||
BiFunction<SSLEngine, List<String>, String> engineAPSelector;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
HashMap<HandshakeCompletedListener, AccessControlContext>
|
||||
handshakeListeners;
|
||||
|
||||
|
@ -266,6 +267,7 @@ final class SSLConfiguration implements Cloneable {
|
|||
}
|
||||
|
||||
// SSLSocket only
|
||||
@SuppressWarnings("removal")
|
||||
void addHandshakeCompletedListener(
|
||||
HandshakeCompletedListener listener) {
|
||||
|
||||
|
@ -408,7 +410,7 @@ final class SSLConfiguration implements Cloneable {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "CloneDeclaresCloneNotSupported"})
|
||||
@SuppressWarnings({"removal","unchecked", "CloneDeclaresCloneNotSupported"})
|
||||
public Object clone() {
|
||||
// Note that only references to the configurations are copied.
|
||||
try {
|
||||
|
|
|
@ -966,6 +966,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
|
|||
return tmf.getTrustManagers();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static KeyManager[] getKeyManagers() throws Exception {
|
||||
|
||||
final Map<String,String> props = new HashMap<>();
|
||||
|
|
|
@ -1195,6 +1195,7 @@ final class SSLEngineImpl extends SSLEngine implements SSLTransport {
|
|||
this.engine = engineInstance;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public void run() {
|
||||
engine.engineLock.lock();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -903,6 +903,7 @@ final class SSLSessionImpl extends ExtendedSSLSession {
|
|||
* are currently valid in this process. For client sessions,
|
||||
* this returns null.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public SSLSessionContext getSessionContext() {
|
||||
/*
|
||||
|
@ -1532,6 +1533,7 @@ class SecureKey {
|
|||
private final Object securityCtx;
|
||||
|
||||
static Object getCurrentSecurityContext() {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
Object context = null;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -60,6 +60,7 @@ class ServerHandshakeContext extends HandshakeContext {
|
|||
ServerHandshakeContext(SSLContextImpl sslContext,
|
||||
TransportContext conContext) throws IOException {
|
||||
super(sslContext, conContext);
|
||||
@SuppressWarnings("removal")
|
||||
long respTimeOut = AccessController.doPrivileged(
|
||||
new GetLongAction("jdk.tls.stapling.responseTimeout",
|
||||
DEFAULT_STATUS_RESP_DELAY));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -75,11 +75,13 @@ final class StatusResponseManager {
|
|||
* Create a StatusResponseManager with default parameters.
|
||||
*/
|
||||
StatusResponseManager() {
|
||||
@SuppressWarnings("removal")
|
||||
int cap = AccessController.doPrivileged(
|
||||
new GetIntegerAction("jdk.tls.stapling.cacheSize",
|
||||
DEFAULT_CACHE_SIZE));
|
||||
cacheCapacity = cap > 0 ? cap : 0;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
int life = AccessController.doPrivileged(
|
||||
new GetIntegerAction("jdk.tls.stapling.cacheLifetime",
|
||||
DEFAULT_CACHE_LIFETIME));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -65,6 +65,7 @@ public class SunJSSE extends java.security.Provider {
|
|||
registerAlgorithms();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private void registerAlgorithms() {
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
doRegister();
|
||||
|
|
|
@ -48,6 +48,7 @@ final class TransportContext implements ConnectionContext {
|
|||
|
||||
// registered plaintext consumers
|
||||
final Map<Byte, SSLConsumer> consumers;
|
||||
@SuppressWarnings("removal")
|
||||
final AccessControlContext acc;
|
||||
|
||||
final SSLContextImpl sslContext;
|
||||
|
@ -133,6 +134,7 @@ final class TransportContext implements ConnectionContext {
|
|||
inputRecord, outputRecord, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private TransportContext(SSLContextImpl sslContext, SSLTransport transport,
|
||||
SSLConfiguration sslConfig, InputRecord inputRecord,
|
||||
OutputRecord outputRecord, boolean isUnsureMode) {
|
||||
|
@ -660,17 +662,20 @@ final class TransportContext implements ConnectionContext {
|
|||
// A separate thread is allocated to deliver handshake completion
|
||||
// events.
|
||||
private static class NotifyHandshake implements Runnable {
|
||||
@SuppressWarnings("removal")
|
||||
private final Set<Map.Entry<HandshakeCompletedListener,
|
||||
AccessControlContext>> targets; // who gets notified
|
||||
private final HandshakeCompletedEvent event; // the notification
|
||||
|
||||
NotifyHandshake(
|
||||
@SuppressWarnings("removal")
|
||||
Map<HandshakeCompletedListener,AccessControlContext> listeners,
|
||||
HandshakeCompletedEvent event) {
|
||||
this.targets = new HashSet<>(listeners.entrySet()); // clone
|
||||
this.event = event;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public void run() {
|
||||
// Don't need to synchronize, as it only runs in one thread.
|
||||
|
|
|
@ -108,6 +108,7 @@ abstract class TrustManagerFactoryImpl extends TrustManagerFactorySpi {
|
|||
/*
|
||||
* Try to get an InputStream based on the file we pass in.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static FileInputStream getFileInputStream(final File file)
|
||||
throws Exception {
|
||||
return AccessController.doPrivileged(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -122,7 +122,7 @@ final class TrustStoreManager {
|
|||
* Create an instance of TrustStoreDescriptor for the default
|
||||
* trusted KeyStore.
|
||||
*/
|
||||
@SuppressWarnings("Convert2Lambda")
|
||||
@SuppressWarnings({"removal","Convert2Lambda"})
|
||||
static TrustStoreDescriptor createInstance() {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedAction<TrustStoreDescriptor>() {
|
||||
|
@ -385,7 +385,7 @@ final class TrustStoreManager {
|
|||
}
|
||||
|
||||
if (!"NONE".equals(descriptor.storeName)) {
|
||||
try (FileInputStream fis = AccessController.doPrivileged(
|
||||
try (@SuppressWarnings("removal") FileInputStream fis = AccessController.doPrivileged(
|
||||
new OpenFileInputStreamAction(descriptor.storeFile))) {
|
||||
ks.load(fis, password);
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue