List of usage examples for java.net NetPermission NetPermission
public NetPermission(String name)
From source file:com.thoughtworks.acceptance.SecurityManagerTest.java
public void testSerializeWithXppDriverAndSun14ReflectionProviderAndActiveSecurityManager() { sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.reflect")); sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.misc")); sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.text.resources")); sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.util.resources")); sm.addPermission(source, new RuntimePermission("accessDeclaredMembers")); sm.addPermission(source, new RuntimePermission("createClassLoader")); sm.addPermission(source, new RuntimePermission("fileSystemProvider")); sm.addPermission(source, new RuntimePermission("loadLibrary.nio")); sm.addPermission(source, new RuntimePermission("modifyThreadGroup")); sm.addPermission(source, new RuntimePermission("reflectionFactoryAccess")); sm.addPermission(source, new PropertyPermission("ibm.dst.compatibility", "read")); sm.addPermission(source, new PropertyPermission("java.home", "read")); sm.addPermission(source, new PropertyPermission("java.nio.file.spi.DefaultFileSystemProvider", "read")); sm.addPermission(source, new PropertyPermission("java.security.debug", "read")); sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read")); sm.addPermission(source, new PropertyPermission("jaxp.debug", "read")); sm.addPermission(source, new PropertyPermission("jdk.util.TimeZone.allowSetDefault", "read")); sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read")); sm.addPermission(source, new PropertyPermission("sun.nio.fs.chdirAllowed", "read")); sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read")); sm.addPermission(source, new PropertyPermission("user.country", "read")); sm.addPermission(source, new PropertyPermission("user.dir", "read")); sm.addPermission(source, new PropertyPermission("user.timezone", "read,write")); sm.addPermission(source, new ReflectPermission("suppressAccessChecks")); sm.addPermission(source, new NetPermission("specifyStreamHandler")); sm.setReadOnly();//from w ww. ja v a 2s. co m System.setSecurityManager(sm); xstream = new XStream(); xstream.allowTypesByWildcard(AbstractAcceptanceTest.class.getPackage().getName() + ".*objects.**"); xstream.allowTypesByWildcard(this.getClass().getName() + "$*"); assertBothWays(); }
From source file:com.thoughtworks.acceptance.SecurityManagerTest.java
public void testSerializeWithXppDriverAndPureJavaReflectionProviderAndActiveSecurityManager() { sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.misc")); sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.text.resources")); sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.util.resources")); sm.addPermission(source, new RuntimePermission("accessDeclaredMembers")); sm.addPermission(source, new RuntimePermission("createClassLoader")); sm.addPermission(source, new RuntimePermission("fileSystemProvider")); sm.addPermission(source, new RuntimePermission("loadLibrary.nio")); sm.addPermission(source, new RuntimePermission("modifyThreadGroup")); sm.addPermission(source, new PropertyPermission("ibm.dst.compatibility", "read")); sm.addPermission(source, new PropertyPermission("java.home", "read")); sm.addPermission(source, new PropertyPermission("java.nio.file.spi.DefaultFileSystemProvider", "read")); sm.addPermission(source, new PropertyPermission("java.security.debug", "read")); sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read")); sm.addPermission(source, new PropertyPermission("jaxp.debug", "read")); sm.addPermission(source, new PropertyPermission("jdk.util.TimeZone.allowSetDefault", "read")); sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read")); sm.addPermission(source, new PropertyPermission("sun.io.serialization.extendedDebugInfo", "read")); sm.addPermission(source, new PropertyPermission("sun.nio.fs.chdirAllowed", "read")); sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read")); sm.addPermission(source, new PropertyPermission("user.country", "read")); sm.addPermission(source, new PropertyPermission("user.dir", "read")); sm.addPermission(source, new PropertyPermission("user.timezone", "read,write")); sm.addPermission(source, new ReflectPermission("suppressAccessChecks")); sm.addPermission(source, new NetPermission("specifyStreamHandler")); sm.setReadOnly();/*from w ww . ja v a 2s.c om*/ System.setSecurityManager(sm); xstream = new XStream(new PureJavaReflectionProvider()); xstream.allowTypesByWildcard(AbstractAcceptanceTest.class.getPackage().getName() + ".*objects.**"); xstream.allowTypesByWildcard(this.getClass().getName() + "$*"); assertBothWays(); }
From source file:com.thoughtworks.acceptance.SecurityManagerTest.java
public void testSerializeWithDomDriverAndPureJavaReflectionProviderAndActiveSecurityManager() { sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.text.resources")); sm.addPermission(source, new RuntimePermission("accessClassInPackage.sun.util.resources")); sm.addPermission(source, new RuntimePermission("accessDeclaredMembers")); sm.addPermission(source, new RuntimePermission("createClassLoader")); sm.addPermission(source, new RuntimePermission("fileSystemProvider")); sm.addPermission(source, new RuntimePermission("loadLibrary.nio")); sm.addPermission(source, new RuntimePermission("modifyThreadGroup")); sm.addPermission(source, new RuntimePermission("reflectionFactoryAccess")); sm.addPermission(source, new PropertyPermission( "com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration", "read")); sm.addPermission(source, new PropertyPermission("elementAttributeLimit", "read")); sm.addPermission(source, new PropertyPermission("entityExpansionLimit", "read")); sm.addPermission(source,// www .j a v a2 s. co m new PropertyPermission("http://java.sun.com/xml/dom/properties/ancestor-check", "read")); sm.addPermission(source, new PropertyPermission("ibm.dst.compatibility", "read")); sm.addPermission(source, new PropertyPermission("java.home", "read")); sm.addPermission(source, new PropertyPermission("java.nio.file.spi.DefaultFileSystemProvider", "read")); sm.addPermission(source, new PropertyPermission("java.security.debug", "read")); sm.addPermission(source, new PropertyPermission("javax.xml.datatype.DatatypeFactory", "read")); sm.addPermission(source, new PropertyPermission("javax.xml.parsers.DocumentBuilderFactory", "read")); sm.addPermission(source, new PropertyPermission("javax.xml.accessExternalDTD", "read")); sm.addPermission(source, new PropertyPermission("javax.xml.accessExternalSchema", "read")); sm.addPermission(source, new PropertyPermission("jaxp.debug", "read")); sm.addPermission(source, new PropertyPermission("jdk.util.TimeZone.allowSetDefault", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.elementAttributeLimit", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.entityExpansionLimit", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.maxElementDepth", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.maxGeneralEntitySizeLimit", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.maxParameterEntitySizeLimit", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.maxOccurLimit", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.maxXMLNameLimit", "read")); sm.addPermission(source, new PropertyPermission("jdk.xml.totalEntitySizeLimit", "read")); sm.addPermission(source, new PropertyPermission("maxOccurLimit", "read")); sm.addPermission(source, new PropertyPermission("sun.boot.class.path", "read")); sm.addPermission(source, new PropertyPermission("sun.nio.fs.chdirAllowed", "read")); sm.addPermission(source, new PropertyPermission("sun.timezone.ids.oldmapping", "read")); sm.addPermission(source, new PropertyPermission("user.country", "read")); sm.addPermission(source, new PropertyPermission("user.dir", "read")); sm.addPermission(source, new PropertyPermission("user.timezone", "read,write")); sm.addPermission(source, new NetPermission("specifyStreamHandler")); sm.addPermission(source, new ReflectPermission("suppressAccessChecks")); sm.setReadOnly(); System.setSecurityManager(sm); xstream = new XStream(new PureJavaReflectionProvider(), new DomDriver()); xstream.allowTypesByWildcard(AbstractAcceptanceTest.class.getPackage().getName() + ".*objects.**"); xstream.allowTypesByWildcard(this.getClass().getName() + "$*"); assertBothWays(); }