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) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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,8 +75,14 @@ import sun.security.util.SecurityConstants;
|
|||
*
|
||||
* @author Roland Schemers
|
||||
* @since 1.2
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public final class AccessControlContext {
|
||||
|
||||
private ProtectionDomain[] context;
|
||||
|
@ -89,6 +95,7 @@ public final class AccessControlContext {
|
|||
// native codes. Don't touch it.
|
||||
private AccessControlContext privilegedContext;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private DomainCombiner combiner = null;
|
||||
|
||||
// limited privilege scope
|
||||
|
@ -103,6 +110,7 @@ public final class AccessControlContext {
|
|||
private static boolean debugInit = false;
|
||||
private static Debug debug = null;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static Debug getDebug()
|
||||
{
|
||||
if (debugInit)
|
||||
|
@ -171,7 +179,7 @@ public final class AccessControlContext {
|
|||
* @since 1.3
|
||||
*/
|
||||
public AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner) {
|
||||
@SuppressWarnings("removal") DomainCombiner combiner) {
|
||||
|
||||
this(acc, combiner, false);
|
||||
}
|
||||
|
@ -182,9 +190,10 @@ public final class AccessControlContext {
|
|||
* permission
|
||||
*/
|
||||
AccessControlContext(AccessControlContext acc,
|
||||
DomainCombiner combiner,
|
||||
@SuppressWarnings("removal") DomainCombiner combiner,
|
||||
boolean preauthorized) {
|
||||
if (!preauthorized) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(SecurityConstants.CREATE_ACC_PERMISSION);
|
||||
|
@ -211,7 +220,7 @@ public final class AccessControlContext {
|
|||
* This "argument wrapper" context will be passed as the actual context
|
||||
* parameter on an internal doPrivileged() call used in the implementation.
|
||||
*/
|
||||
AccessControlContext(ProtectionDomain caller, DomainCombiner combiner,
|
||||
AccessControlContext(ProtectionDomain caller, @SuppressWarnings("removal") DomainCombiner combiner,
|
||||
AccessControlContext parent, AccessControlContext context,
|
||||
Permission[] perms)
|
||||
{
|
||||
|
@ -323,6 +332,7 @@ public final class AccessControlContext {
|
|||
/**
|
||||
* get the assigned combiner from the privileged or inherited context
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner getAssignedCombiner() {
|
||||
AccessControlContext acc;
|
||||
if (isPrivileged) {
|
||||
|
@ -349,6 +359,7 @@ public final class AccessControlContext {
|
|||
* {@link SecurityPermission}
|
||||
* @since 1.3
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public DomainCombiner getDomainCombiner() {
|
||||
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
|
@ -361,6 +372,7 @@ public final class AccessControlContext {
|
|||
/**
|
||||
* package private for AccessController
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner getCombiner() {
|
||||
return combiner;
|
||||
}
|
||||
|
@ -388,6 +400,7 @@ public final class AccessControlContext {
|
|||
* context encapsulated by this object.
|
||||
* @throws NullPointerException if the permission to check for is null.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public void checkPermission(Permission perm)
|
||||
throws AccessControlException
|
||||
{
|
||||
|
@ -548,6 +561,7 @@ public final class AccessControlContext {
|
|||
* The limited privilege scope can indirectly flow from the inherited
|
||||
* parent thread or an assigned context previously captured by getContext().
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext optimize() {
|
||||
// the assigned (privileged or inherited) context
|
||||
AccessControlContext acc;
|
||||
|
|
|
@ -39,8 +39,14 @@ package java.security;
|
|||
* @author Li Gong
|
||||
* @author Roland Schemers
|
||||
* @since 1.2
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public class AccessControlException extends SecurityException {
|
||||
|
||||
@java.io.Serial
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -271,8 +271,14 @@ import jdk.internal.vm.annotation.ReservedStackAccess;
|
|||
* @author Li Gong
|
||||
* @author Roland Schemers
|
||||
* @since 1.2
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public final class AccessController {
|
||||
|
||||
/**
|
||||
|
@ -339,10 +345,12 @@ public final class AccessController {
|
|||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action) {
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext acc = getStackAccessControlContext();
|
||||
if (acc == null) {
|
||||
return AccessController.doPrivileged(action);
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = acc.getAssignedCombiner();
|
||||
return AccessController.doPrivileged(action,
|
||||
preserveCombiner(dc, Reflection.getCallerClass()));
|
||||
|
@ -384,7 +392,7 @@ public final class AccessController {
|
|||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivileged(PrivilegedAction<T> action,
|
||||
AccessControlContext context)
|
||||
@SuppressWarnings("removal") AccessControlContext context)
|
||||
{
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
context = checkContext(context, caller);
|
||||
|
@ -438,13 +446,16 @@ public final class AccessController {
|
|||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivileged(PrivilegedAction<T> action,
|
||||
AccessControlContext context, Permission... perms) {
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
if (perms == null) {
|
||||
throw new NullPointerException("null permissions parameter");
|
||||
}
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = (context == null) ? null : context.getCombiner();
|
||||
return AccessController.doPrivileged(action, createWrapper(dc,
|
||||
caller, parent, context, perms));
|
||||
|
@ -501,9 +512,12 @@ public final class AccessController {
|
|||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action,
|
||||
AccessControlContext context, Permission... perms) {
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms) {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = parent.getCombiner();
|
||||
if (dc == null && context != null) {
|
||||
dc = context.getCombiner();
|
||||
|
@ -548,6 +562,7 @@ public final class AccessController {
|
|||
doPrivileged(PrivilegedExceptionAction<T> action)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext context = null;
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
try {
|
||||
|
@ -591,10 +606,12 @@ public final class AccessController {
|
|||
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext acc = getStackAccessControlContext();
|
||||
if (acc == null) {
|
||||
return AccessController.doPrivileged(action);
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = acc.getAssignedCombiner();
|
||||
return AccessController.doPrivileged(action,
|
||||
preserveCombiner(dc, Reflection.getCallerClass()));
|
||||
|
@ -603,6 +620,7 @@ public final class AccessController {
|
|||
/**
|
||||
* preserve the combiner across the doPrivileged call
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext preserveCombiner(DomainCombiner combiner,
|
||||
Class<?> caller)
|
||||
{
|
||||
|
@ -612,6 +630,7 @@ public final class AccessController {
|
|||
/**
|
||||
* Create a wrapper to contain the limited privilege scope data.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext
|
||||
createWrapper(DomainCombiner combiner, Class<?> caller,
|
||||
AccessControlContext parent, AccessControlContext context,
|
||||
|
@ -633,10 +652,12 @@ public final class AccessController {
|
|||
private static class AccHolder {
|
||||
// An AccessControlContext with no granted permissions.
|
||||
// Only initialized on demand when getInnocuousAcc() is called.
|
||||
@SuppressWarnings("removal")
|
||||
static final AccessControlContext innocuousAcc =
|
||||
new AccessControlContext(new ProtectionDomain[] {
|
||||
new ProtectionDomain(null, null) });
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext getInnocuousAcc() {
|
||||
return AccHolder.innocuousAcc;
|
||||
}
|
||||
|
@ -682,7 +703,7 @@ public final class AccessController {
|
|||
@CallerSensitive
|
||||
public static <T> T
|
||||
doPrivileged(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context)
|
||||
@SuppressWarnings("removal") AccessControlContext context)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
|
@ -696,6 +717,7 @@ public final class AccessController {
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext checkContext(AccessControlContext context,
|
||||
Class<?> caller)
|
||||
{
|
||||
|
@ -726,6 +748,7 @@ public final class AccessController {
|
|||
* recognized by the VM.
|
||||
*/
|
||||
private static boolean isPrivileged() {
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext ctx = getStackAccessControlContext();
|
||||
return ctx == null || ctx.isPrivileged();
|
||||
}
|
||||
|
@ -741,7 +764,7 @@ public final class AccessController {
|
|||
@ForceInline
|
||||
private static <T> T
|
||||
executePrivileged(PrivilegedAction<T> action,
|
||||
AccessControlContext context,
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Class<?> caller)
|
||||
{
|
||||
// Ensure context has a physical value in the frame
|
||||
|
@ -771,7 +794,7 @@ public final class AccessController {
|
|||
@ForceInline
|
||||
private static <T> T
|
||||
executePrivileged(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context,
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Class<?> caller)
|
||||
throws Exception
|
||||
{
|
||||
|
@ -853,14 +876,17 @@ public final class AccessController {
|
|||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context, Permission... perms)
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
if (perms == null) {
|
||||
throw new NullPointerException("null permissions parameter");
|
||||
}
|
||||
Class<?> caller = Reflection.getCallerClass();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = (context == null) ? null : context.getCombiner();
|
||||
return AccessController.doPrivileged(action, createWrapper(dc, caller, parent, context, perms));
|
||||
}
|
||||
|
@ -918,11 +944,13 @@ public final class AccessController {
|
|||
*/
|
||||
@CallerSensitive
|
||||
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action,
|
||||
AccessControlContext context,
|
||||
@SuppressWarnings("removal") AccessControlContext context,
|
||||
Permission... perms)
|
||||
throws PrivilegedActionException
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
AccessControlContext parent = getContext();
|
||||
@SuppressWarnings("removal")
|
||||
DomainCombiner dc = parent.getCombiner();
|
||||
if (dc == null && context != null) {
|
||||
dc = context.getCombiner();
|
||||
|
@ -945,6 +973,7 @@ public final class AccessController {
|
|||
* null if there was only privileged system code.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static native AccessControlContext getStackAccessControlContext();
|
||||
|
||||
|
||||
|
@ -954,6 +983,7 @@ public final class AccessController {
|
|||
* AccessControlContext can use it.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
static native AccessControlContext getInheritedAccessControlContext();
|
||||
|
||||
/**
|
||||
|
@ -967,6 +997,7 @@ public final class AccessController {
|
|||
* @return the AccessControlContext based on the current context.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static AccessControlContext getContext()
|
||||
{
|
||||
AccessControlContext acc = getStackAccessControlContext();
|
||||
|
@ -997,6 +1028,7 @@ public final class AccessController {
|
|||
* security policy currently in effect.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public static void checkPermission(Permission perm)
|
||||
throws AccessControlException
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
|
@ -77,7 +77,13 @@ package java.security;
|
|||
* @see AccessController
|
||||
* @see AccessControlContext
|
||||
* @since 1.3
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public interface DomainCombiner {
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -987,6 +987,7 @@ public class KeyStore {
|
|||
* if no such property exists.
|
||||
* @see java.security.Security security properties
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static final String getDefaultType() {
|
||||
String kstype;
|
||||
kstype = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
|
@ -1956,6 +1957,7 @@ public class KeyStore {
|
|||
* of either PasswordProtection or CallbackHandlerProtection; or
|
||||
* if file does not exist or does not refer to a normal file
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Builder newInstance(String type, Provider provider,
|
||||
File file, ProtectionParameter protection) {
|
||||
if ((type == null) || (file == null) || (protection == null)) {
|
||||
|
@ -2027,6 +2029,7 @@ public class KeyStore {
|
|||
private final File file;
|
||||
private ProtectionParameter protection;
|
||||
private ProtectionParameter keyProtection;
|
||||
@SuppressWarnings("removal")
|
||||
private final AccessControlContext context;
|
||||
|
||||
private KeyStore keyStore;
|
||||
|
@ -2035,7 +2038,7 @@ public class KeyStore {
|
|||
|
||||
FileBuilder(String type, Provider provider, File file,
|
||||
ProtectionParameter protection,
|
||||
AccessControlContext context) {
|
||||
@SuppressWarnings("removal") AccessControlContext context) {
|
||||
this.type = type;
|
||||
this.provider = provider;
|
||||
this.file = file;
|
||||
|
@ -2043,6 +2046,7 @@ public class KeyStore {
|
|||
this.context = context;
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public synchronized KeyStore getKeyStore() throws KeyStoreException
|
||||
{
|
||||
if (keyStore != null) {
|
||||
|
@ -2174,6 +2178,7 @@ public class KeyStore {
|
|||
if ((type == null) || (protection == null)) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
@SuppressWarnings("removal")
|
||||
final AccessControlContext context = AccessController.getContext();
|
||||
return new Builder() {
|
||||
private volatile boolean getCalled;
|
||||
|
@ -2218,6 +2223,7 @@ public class KeyStore {
|
|||
}
|
||||
};
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public synchronized KeyStore getKeyStore()
|
||||
throws KeyStoreException {
|
||||
if (oldException != null) {
|
||||
|
|
|
@ -103,6 +103,7 @@ public abstract class Permission implements Guard, java.io.Serializable {
|
|||
*
|
||||
*/
|
||||
public void checkGuard(Object object) throws SecurityException {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkPermission(this);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -83,8 +83,14 @@ import sun.security.util.SecurityConstants;
|
|||
* @see java.security.ProtectionDomain
|
||||
* @see java.security.Permission
|
||||
* @see java.security.Security security properties
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public abstract class Policy {
|
||||
|
||||
/**
|
||||
|
@ -133,6 +139,7 @@ public abstract class Policy {
|
|||
}
|
||||
|
||||
private static void checkPermission(String type) {
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) {
|
||||
sm.checkPermission(new SecurityPermission("createPolicy." + type));
|
||||
|
@ -159,6 +166,7 @@ public abstract class Policy {
|
|||
*/
|
||||
public static Policy getPolicy()
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkPermission(SecurityConstants.GET_POLICY_PERMISSION);
|
||||
|
@ -194,6 +202,7 @@ public abstract class Policy {
|
|||
* an intrinsic lock on the Policy.class.
|
||||
*/
|
||||
private static Policy loadPolicyProvider() {
|
||||
@SuppressWarnings("removal")
|
||||
String policyProvider =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
|
@ -222,6 +231,7 @@ public abstract class Policy {
|
|||
Policy polFile = new sun.security.provider.PolicyFile();
|
||||
policyInfo = new PolicyInfo(polFile, false);
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
Policy pol = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Policy run() {
|
||||
|
@ -271,6 +281,7 @@ public abstract class Policy {
|
|||
*/
|
||||
public static void setPolicy(Policy p)
|
||||
{
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null) sm.checkPermission(
|
||||
new SecurityPermission("setPolicy"));
|
||||
|
@ -310,6 +321,7 @@ public abstract class Policy {
|
|||
* implementations will continue to function.
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
ProtectionDomain policyDomain =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public ProtectionDomain run() {
|
||||
|
@ -394,6 +406,7 @@ public abstract class Policy {
|
|||
* @see Provider
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Policy getInstance(String type, Policy.Parameters params)
|
||||
throws NoSuchAlgorithmException {
|
||||
Objects.requireNonNull(type, "null type name");
|
||||
|
@ -455,6 +468,7 @@ public abstract class Policy {
|
|||
* @see Provider
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Policy getInstance(String type,
|
||||
Policy.Parameters params,
|
||||
String provider)
|
||||
|
@ -518,6 +532,7 @@ public abstract class Policy {
|
|||
* @see Provider
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static Policy getInstance(String type,
|
||||
Policy.Parameters params,
|
||||
Provider provider)
|
||||
|
@ -769,12 +784,13 @@ public abstract class Policy {
|
|||
*/
|
||||
private static class PolicyDelegate extends Policy {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private PolicySpi spi;
|
||||
private Provider p;
|
||||
private String type;
|
||||
private Policy.Parameters params;
|
||||
|
||||
private PolicyDelegate(PolicySpi spi, Provider p,
|
||||
private PolicyDelegate(@SuppressWarnings("removal") PolicySpi spi, Provider p,
|
||||
String type, Policy.Parameters params) {
|
||||
this.spi = spi;
|
||||
this.p = p;
|
||||
|
@ -810,7 +826,13 @@ public abstract class Policy {
|
|||
* This represents a marker interface for Policy parameters.
|
||||
*
|
||||
* @since 1.6
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is
|
||||
* deprecated and subject to removal in a future release.
|
||||
* Consequently, this class is also deprecated and subject to removal.
|
||||
* There is no replacement for the Security Manager or this class.
|
||||
*/
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public static interface Parameters { }
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
|
@ -40,8 +40,14 @@ package java.security;
|
|||
*
|
||||
*
|
||||
* @since 1.6
|
||||
* @deprecated This class is only useful in conjunction with
|
||||
* {@linkplain SecurityManager the Security Manager}, which is deprecated
|
||||
* and subject to removal in a future release. Consequently, this class
|
||||
* is also deprecated and subject to removal. There is no replacement for
|
||||
* the Security Manager or this class.
|
||||
*/
|
||||
|
||||
@Deprecated(since="17", forRemoval=true)
|
||||
public abstract class PolicySpi {
|
||||
|
||||
/**
|
||||
|
@ -92,6 +98,7 @@ public abstract class PolicySpi {
|
|||
* If this operation is not supported,
|
||||
* Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected PermissionCollection engineGetPermissions
|
||||
(CodeSource codesource) {
|
||||
return Policy.UNSUPPORTED_EMPTY_COLLECTION;
|
||||
|
@ -116,6 +123,7 @@ public abstract class PolicySpi {
|
|||
* If this operation is not supported,
|
||||
* Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
protected PermissionCollection engineGetPermissions
|
||||
(ProtectionDomain domain) {
|
||||
return Policy.UNSUPPORTED_EMPTY_COLLECTION;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
|
@ -73,6 +73,7 @@ public class ProtectionDomain {
|
|||
private JavaSecurityAccessImpl() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
|
@ -88,6 +89,7 @@ public class ProtectionDomain {
|
|||
);
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public <T> T doIntersectionPrivilege(
|
||||
PrivilegedAction<T> action,
|
||||
|
@ -97,10 +99,11 @@ public class ProtectionDomain {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProtectionDomain[] getProtectDomains(AccessControlContext context) {
|
||||
public ProtectionDomain[] getProtectDomains(@SuppressWarnings("removal") AccessControlContext context) {
|
||||
return context.getContext();
|
||||
}
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
private static AccessControlContext getCombinedACC(
|
||||
AccessControlContext context, AccessControlContext stack) {
|
||||
AccessControlContext acc =
|
||||
|
@ -309,6 +312,7 @@ public class ProtectionDomain {
|
|||
*
|
||||
* @return true if {@code perm} is implied by this ProtectionDomain.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public boolean implies(Permission perm) {
|
||||
|
||||
if (hasAllPerm) {
|
||||
|
@ -363,6 +367,7 @@ public class ProtectionDomain {
|
|||
boolean p2Calculated = false;
|
||||
|
||||
if (!staticPermissions) {
|
||||
@SuppressWarnings("removal")
|
||||
Policy policy = Policy.getPolicyNoCheck();
|
||||
if (policy instanceof PolicyFile) {
|
||||
// The PolicyFile implementation supports compatibility
|
||||
|
@ -416,6 +421,7 @@ public class ProtectionDomain {
|
|||
|
||||
// Check if policy is set; we don't want to load
|
||||
// the policy prematurely here
|
||||
@SuppressWarnings("removal")
|
||||
PermissionCollection pc = Policy.isSet() && seeAllp() ?
|
||||
mergePermissions():
|
||||
getPermissions();
|
||||
|
@ -449,6 +455,7 @@ public class ProtectionDomain {
|
|||
* debug is null,
|
||||
* caller has Policy.getPolicy permission
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
private static boolean seeAllp() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
|
||||
|
@ -478,6 +485,7 @@ public class ProtectionDomain {
|
|||
if (staticPermissions)
|
||||
return permissions;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
PermissionCollection perms =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<>() {
|
||||
|
|
|
@ -810,6 +810,7 @@ public abstract class Provider extends Properties {
|
|||
|
||||
private void check(String directive) {
|
||||
checkInitialized();
|
||||
@SuppressWarnings("removal")
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
if (security != null) {
|
||||
security.checkSecurityAccess(directive);
|
||||
|
|
|
@ -933,6 +933,7 @@ public class SecureRandom extends java.util.Random {
|
|||
public static SecureRandom getInstanceStrong()
|
||||
throws NoSuchAlgorithmException {
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
String property = AccessController.doPrivileged(
|
||||
new PrivilegedAction<>() {
|
||||
@Override
|
||||
|
|
|
@ -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
|
||||
|
@ -51,6 +51,7 @@ import sun.security.jca.*;
|
|||
* @since 1.1
|
||||
*/
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
public final class Security {
|
||||
|
||||
/* Are we debugging? -- for developers */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 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
|
||||
|
@ -32,6 +32,7 @@ package java.security;
|
|||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public class URIParameter implements
|
||||
Policy.Parameters, javax.security.auth.login.Configuration.Parameters {
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
|
@ -317,6 +317,7 @@ public class CertPathBuilder {
|
|||
* {@literal "PKIX"} if no such property exists.
|
||||
*/
|
||||
public static final String getDefaultType() {
|
||||
@SuppressWarnings("removal")
|
||||
String cpbtype =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
|
@ -329,6 +329,7 @@ public class CertPathValidator {
|
|||
* {@literal "PKIX"} if no such property exists.
|
||||
*/
|
||||
public static final String getDefaultType() {
|
||||
@SuppressWarnings("removal")
|
||||
String cpvtype =
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public String run() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 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
|
||||
|
@ -426,6 +426,7 @@ public class CertStore {
|
|||
* {@code certstore.type} security property, or the string
|
||||
* {@literal "LDAP"} if no such property exists.
|
||||
*/
|
||||
@SuppressWarnings("removal")
|
||||
public static final String getDefaultType() {
|
||||
String cstype;
|
||||
cstype = AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue