< prev index next >

src/java.base/share/classes/sun/security/util/SecurityConstants.java

Print this page
rev 49922 : 8202419: Avoid creating Permission constants early
Reviewed-by: TBD


   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 sun.security.util;
  27 

  28 import java.net.SocketPermission;
  29 import java.net.NetPermission;
  30 import java.security.AccessController;
  31 import java.security.PrivilegedAction;
  32 import java.security.Permission;
  33 import java.security.BasicPermission;
  34 import java.security.SecurityPermission;
  35 import java.security.AllPermission;
  36 import sun.security.action.GetPropertyAction;
  37 
  38 /**
  39  * Permission constants and string constants used to create permissions
  40  * used throughout the JDK.
  41  */
  42 public final class SecurityConstants {
  43     // Cannot create one of these
  44     private SecurityConstants () {
  45     }
  46 
  47     // Commonly used string constants for permission actions used by
  48     // SecurityManager. Declare here for shortcut when checking permissions
  49     // in FilePermission, SocketPermission, and PropertyPermission.
  50 
  51     public static final String FILE_DELETE_ACTION = "delete";
  52     public static final String FILE_EXECUTE_ACTION = "execute";
  53     public static final String FILE_READ_ACTION = "read";


 114     // java.lang.SecurityManager, sun.applet.AppletSecurity
 115     public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION =
 116         new RuntimePermission("modifyThreadGroup");
 117 
 118     // java.lang.Class
 119     public static final RuntimePermission GET_PD_PERMISSION =
 120         new RuntimePermission("getProtectionDomain");
 121 
 122     // java.lang.Class, java.lang.ClassLoader, java.lang.Thread
 123     public static final RuntimePermission GET_CLASSLOADER_PERMISSION =
 124         new RuntimePermission("getClassLoader");
 125 
 126     // java.lang.Thread
 127     public static final RuntimePermission STOP_THREAD_PERMISSION =
 128        new RuntimePermission("stopThread");
 129 
 130     // java.lang.Thread
 131     public static final RuntimePermission GET_STACK_TRACE_PERMISSION =
 132        new RuntimePermission("getStackTrace");
 133 




 134     // java.security.AccessControlContext
 135     public static final SecurityPermission CREATE_ACC_PERMISSION =
 136        new SecurityPermission("createAccessControlContext");
 137 
 138     // java.security.AccessControlContext
 139     public static final SecurityPermission GET_COMBINER_PERMISSION =
 140        new SecurityPermission("getDomainCombiner");
 141 
 142     // java.security.Policy, java.security.ProtectionDomain
 143     public static final SecurityPermission GET_POLICY_PERMISSION =
 144         new SecurityPermission ("getPolicy");
 145 
 146     // java.lang.SecurityManager
 147     public static final SocketPermission LOCAL_LISTEN_PERMISSION =
 148         new SocketPermission("localhost:0", SOCKET_LISTEN_ACTION);
 149 
 150     public static final String PROVIDER_VER =
 151         GetPropertyAction.privilegedGetProperty("java.specification.version");















 152 }


   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 sun.security.util;
  27 
  28 import java.lang.reflect.ReflectPermission;
  29 import java.net.SocketPermission;
  30 import java.net.NetPermission;


  31 import java.security.Permission;

  32 import java.security.SecurityPermission;
  33 import java.security.AllPermission;
  34 import sun.security.action.GetPropertyAction;
  35 
  36 /**
  37  * Permission constants and string constants used to create permissions
  38  * used throughout the JDK.
  39  */
  40 public final class SecurityConstants {
  41     // Cannot create one of these
  42     private SecurityConstants () {
  43     }
  44 
  45     // Commonly used string constants for permission actions used by
  46     // SecurityManager. Declare here for shortcut when checking permissions
  47     // in FilePermission, SocketPermission, and PropertyPermission.
  48 
  49     public static final String FILE_DELETE_ACTION = "delete";
  50     public static final String FILE_EXECUTE_ACTION = "execute";
  51     public static final String FILE_READ_ACTION = "read";


 112     // java.lang.SecurityManager, sun.applet.AppletSecurity
 113     public static final RuntimePermission MODIFY_THREADGROUP_PERMISSION =
 114         new RuntimePermission("modifyThreadGroup");
 115 
 116     // java.lang.Class
 117     public static final RuntimePermission GET_PD_PERMISSION =
 118         new RuntimePermission("getProtectionDomain");
 119 
 120     // java.lang.Class, java.lang.ClassLoader, java.lang.Thread
 121     public static final RuntimePermission GET_CLASSLOADER_PERMISSION =
 122         new RuntimePermission("getClassLoader");
 123 
 124     // java.lang.Thread
 125     public static final RuntimePermission STOP_THREAD_PERMISSION =
 126        new RuntimePermission("stopThread");
 127 
 128     // java.lang.Thread
 129     public static final RuntimePermission GET_STACK_TRACE_PERMISSION =
 130        new RuntimePermission("getStackTrace");
 131 
 132     // java.lang.Thread
 133     public static final RuntimePermission SUBCLASS_IMPLEMENTATION_PERMISSION =
 134             new RuntimePermission("enableContextClassLoaderOverride");
 135 
 136     // java.security.AccessControlContext
 137     public static final SecurityPermission CREATE_ACC_PERMISSION =
 138        new SecurityPermission("createAccessControlContext");
 139 
 140     // java.security.AccessControlContext
 141     public static final SecurityPermission GET_COMBINER_PERMISSION =
 142        new SecurityPermission("getDomainCombiner");
 143 
 144     // java.security.Policy, java.security.ProtectionDomain
 145     public static final SecurityPermission GET_POLICY_PERMISSION =
 146         new SecurityPermission ("getPolicy");
 147 
 148     // java.lang.SecurityManager
 149     public static final SocketPermission LOCAL_LISTEN_PERMISSION =
 150         new SocketPermission("localhost:0", SOCKET_LISTEN_ACTION);
 151 
 152     public static final String PROVIDER_VER =
 153         GetPropertyAction.privilegedGetProperty("java.specification.version");
 154 
 155     /**
 156      * java.lang.reflect.AccessibleObject
 157      *
 158      * The Permission object that is used to check whether a client
 159      * has sufficient privilege to defeat Java language access
 160      * control checks.
 161      */
 162     public static final ReflectPermission ACCESS_PERMISSION =
 163             new ReflectPermission("suppressAccessChecks");
 164 
 165     // sun.reflect.ReflectionFactory
 166     public static final RuntimePermission REFLECTION_FACTORY_ACCESS_PERMISSION
 167             = new RuntimePermission("reflectionFactoryAccess");
 168 
 169 }
< prev index next >