java.security.AllPermission Java Examples
The following examples show how to use
java.security.AllPermission.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XSLTExFuncTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #2
Source File: TokenStore.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static void checkPerm(PolicyFile p, ProtectionDomain pd) throws Exception { boolean foundIt = false; Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); if (!(perm instanceof AllPermission)) { throw new SecurityException("expected AllPermission"); } else { foundIt = true; } } if (!foundIt) { throw new SecurityException("expected AllPermission"); } }
Example #3
Source File: XSLTExFuncTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #4
Source File: XPathExFuncTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #5
Source File: XSLTExFuncTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #6
Source File: Activation.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #7
Source File: TokenStore.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static void checkPerm(PolicyFile p, ProtectionDomain pd) throws Exception { boolean foundIt = false; Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); if (!(perm instanceof AllPermission)) { throw new SecurityException("expected AllPermission"); } else { foundIt = true; } } if (!foundIt) { throw new SecurityException("expected AllPermission"); } }
Example #8
Source File: XPathExFuncTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #9
Source File: Activation.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #10
Source File: XPathExFuncTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #11
Source File: TokenStore.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static void checkPerm(PolicyFile p, ProtectionDomain pd) throws Exception { boolean foundIt = false; Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); if (!(perm instanceof AllPermission)) { throw new SecurityException("expected AllPermission"); } else { foundIt = true; } } if (!foundIt) { throw new SecurityException("expected AllPermission"); } }
Example #12
Source File: XSLTExFuncTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #13
Source File: XPathExFuncTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #14
Source File: Activation.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #15
Source File: TokenStore.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void checkPerm(PolicyFile p, ProtectionDomain pd) throws Exception { boolean foundIt = false; Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); if (!(perm instanceof AllPermission)) { throw new SecurityException("expected AllPermission"); } else { foundIt = true; } } if (!foundIt) { throw new SecurityException("expected AllPermission"); } }
Example #16
Source File: XSLTExFuncTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #17
Source File: XPathExFuncTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #18
Source File: Activation.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #19
Source File: TokenStore.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void checkPerm(PolicyFile p, ProtectionDomain pd) throws Exception { boolean foundIt = false; Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); if (!(perm instanceof AllPermission)) { throw new SecurityException("expected AllPermission"); } else { foundIt = true; } } if (!foundIt) { throw new SecurityException("expected AllPermission"); } }
Example #20
Source File: XSLTExFuncTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #21
Source File: XPathExFuncTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #22
Source File: Activation.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #23
Source File: XSLTExFuncTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); TransformerFactory factory = TransformerFactory.newInstance(); try { transform(factory); } catch (TransformerConfigurationException e) { fail(e.getMessage()); } catch (TransformerException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #24
Source File: XPathExFuncTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Security is enabled, extension function not allowed */ public void testExtFuncNotAllowed() { Policy p = new SimplePolicy(new AllPermission()); Policy.setPolicy(p); System.setSecurityManager(new SecurityManager()); try { evaluate(false); } catch (XPathFactoryConfigurationException e) { fail(e.getMessage()); } catch (XPathExpressionException ex) { //expected since extension function is disallowed System.out.println("testExtFuncNotAllowed: OK"); } finally { System.setSecurityManager(null); } }
Example #25
Source File: Activation.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #26
Source File: TokenStore.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static void checkPerm(PolicyFile p, ProtectionDomain pd) throws Exception { boolean foundIt = false; Enumeration perms = p.getPermissions(pd).elements(); while (perms.hasMoreElements()) { Permission perm = (Permission)perms.nextElement(); if (!(perm instanceof AllPermission)) { throw new SecurityException("expected AllPermission"); } else { foundIt = true; } } if (!foundIt) { throw new SecurityException("expected AllPermission"); } }
Example #27
Source File: Activation.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Prints warning message if installed Policy is the default Policy * implementation and globally granted permissions do not include * AllPermission or any ExecPermissions/ExecOptionPermissions. */ static void checkConfiguration() { Policy policy = AccessController.doPrivileged(new PrivilegedAction<Policy>() { public Policy run() { return Policy.getPolicy(); } }); if (!(policy instanceof PolicyFile)) { return; } PermissionCollection perms = getExecPermissions(); for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) { Permission p = e.nextElement(); if (p instanceof AllPermission || p instanceof ExecPermission || p instanceof ExecOptionPermission) { return; } } System.err.println(getTextResource("rmid.exec.perms.inadequate")); }
Example #28
Source File: CustomSystemClassLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private Class<?> defineFinderClass(String name) throws ClassNotFoundException { final Object obj = getClassLoadingLock(name); synchronized(obj) { if (finderClass != null) return finderClass; URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation(); File file = new File(url.getPath(), name+".class"); if (file.canRead()) { try { byte[] b = Files.readAllBytes(file.toPath()); Permissions perms = new Permissions(); perms.add(new AllPermission()); finderClass = defineClass( name, b, 0, b.length, new ProtectionDomain( this.getClass().getProtectionDomain().getCodeSource(), perms)); System.out.println("Loaded " + name); return finderClass; } catch (Throwable ex) { ex.printStackTrace(); throw new ClassNotFoundException(name, ex); } } else { throw new ClassNotFoundException(name, new IOException(file.toPath() + ": can't read")); } } }
Example #29
Source File: CustomSystemClassLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private Class<?> defineFinderClass(String name) throws ClassNotFoundException { final Object obj = getClassLoadingLock(name); synchronized(obj) { if (finderClass != null) return finderClass; URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation(); File file = new File(url.getPath(), name+".class"); if (file.canRead()) { try { byte[] b = Files.readAllBytes(file.toPath()); Permissions perms = new Permissions(); perms.add(new AllPermission()); finderClass = defineClass( name, b, 0, b.length, new ProtectionDomain( this.getClass().getProtectionDomain().getCodeSource(), perms)); System.out.println("Loaded " + name); return finderClass; } catch (Throwable ex) { ex.printStackTrace(); throw new ClassNotFoundException(name, ex); } } else { throw new ClassNotFoundException(name, new IOException(file.toPath() + ": can't read")); } } }
Example #30
Source File: CustomSystemClassLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private Class<?> defineFinderClass(String name) throws ClassNotFoundException { final Object obj = getClassLoadingLock(name); synchronized(obj) { if (finderClass != null) return finderClass; URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation(); File file = new File(url.getPath(), name+".class"); if (file.canRead()) { try { byte[] b = Files.readAllBytes(file.toPath()); Permissions perms = new Permissions(); perms.add(new AllPermission()); finderClass = defineClass( name, b, 0, b.length, new ProtectionDomain( this.getClass().getProtectionDomain().getCodeSource(), perms)); System.out.println("Loaded " + name); return finderClass; } catch (Throwable ex) { ex.printStackTrace(); throw new ClassNotFoundException(name, ex); } } else { throw new ClassNotFoundException(name, new IOException(file.toPath() + ": can't read")); } } }