java.io.SerializablePermission Java Examples

The following examples show how to use java.io.SerializablePermission. 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: InputStream.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #2
Source File: StubFactoryDynamicBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission(
                "enableSubclassImplementation"));
    }
    return null;
}
 
Example #3
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void isCustomSerializationPermitted() {
    SecurityManager sm = System.getSecurityManager();
    if (!allowCustomValueHandler) {
        if ( sm != null) {
            // check that a serialization permission has been
            // set to allow the loading of the Util delegate
            // which provides access to custom ValueHandler
            sm.checkPermission(new SerializablePermission(
                    "enableCustomValueHandler"));
        }
    }
}
 
Example #4
Source File: ObjectInputFilter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the process-wide filter if it has not already been configured or set.
 *
 * @param filter the serialization filter to set as the process-wide filter; not null
 * @throws SecurityException if there is security manager and the
 *       {@code SerializablePermission("serialFilter")} is not granted
 * @throws IllegalStateException if the filter has already been set {@code non-null}
 */
public static void setSerialFilter(ObjectInputFilter filter) {
    Objects.requireNonNull(filter, "filter");
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission("serialFilter"));
    }
    synchronized (serialFilterLock) {
        if (serialFilter != null) {
            throw new IllegalStateException("Serial filter can only be set once");
        }
        serialFilter = filter;
    }
}
 
Example #5
Source File: InputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #6
Source File: OutputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #7
Source File: StubFactoryDynamicBase.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission(
                "enableSubclassImplementation"));
    }
    return null;
}
 
Example #8
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void isCustomSerializationPermitted() {
        SecurityManager sm = System.getSecurityManager();
        if ( sm != null) {
            // check that a serialization permission has been
            // set to allow the loading of the Util delegate
            // which provides access to custom ValueHandler
            sm.checkPermission(new SerializablePermission(
                    "enableCustomValueHandler"));
}
    }
 
Example #9
Source File: SideEffectSecurityManager.java    From marshalsec with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see java.lang.SecurityManager#checkPermission(java.security.Permission)
 */
@Override
public void checkPermission ( Permission perm ) {
    if ( perm instanceof RuntimePermission ) {
        if ( checkRuntimePermission((RuntimePermission) perm) ) {
            return;
        }
    }
    else if ( perm instanceof ReflectPermission ) {
        return;
    }
    else if ( perm instanceof LoggingPermission ) {
        return;
    }
    else if ( perm instanceof SecurityPermission ) {
        return;
    }
    else if ( perm instanceof PropertyPermission ) {
        return;
    }
    else if ( perm instanceof NetPermission && perm.getName().equals("specifyStreamHandler") ) {
        return;
    }
    else if ( perm instanceof FilePermission && perm.getActions().equals("read") ) {
        return;
    }
    else if ( perm instanceof SerializablePermission ) {
        return;
    }

    super.checkPermission(perm);
}
 
Example #10
Source File: ObjectInputFilter.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the process-wide filter if it has not already been configured or set.
 *
 * @param filter the serialization filter to set as the process-wide filter; not null
 * @throws SecurityException if there is security manager and the
 *       {@code SerializablePermission("serialFilter")} is not granted
 * @throws IllegalStateException if the filter has already been set {@code non-null}
 */
public static void setSerialFilter(ObjectInputFilter filter) {
    Objects.requireNonNull(filter, "filter");
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission("serialFilter"));
    }
    synchronized (serialFilterLock) {
        if (serialFilter != null) {
            throw new IllegalStateException("Serial filter can only be set once");
        }
        serialFilter = filter;
    }
}
 
Example #11
Source File: InputStream.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #12
Source File: OutputStream.java    From Java8CN with Apache License 2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #13
Source File: OutputStream.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #14
Source File: OutputStream.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #15
Source File: StubFactoryDynamicBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission(
                "enableSubclassImplementation"));
    }
    return null;
}
 
Example #16
Source File: InputStream.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #17
Source File: OutputStream.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #18
Source File: StubFactoryDynamicBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission(
                "enableSubclassImplementation"));
    }
    return null;
}
 
Example #19
Source File: InputStream.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #20
Source File: OutputStream.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #21
Source File: StubFactoryDynamicBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission(
                "enableSubclassImplementation"));
    }
    return null;
}
 
Example #22
Source File: ObjectInputFilter.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the process-wide filter if it has not already been configured or set.
 *
 * @param filter the serialization filter to set as the process-wide filter; not null
 * @throws SecurityException if there is security manager and the
 *       {@code SerializablePermission("serialFilter")} is not granted
 * @throws IllegalStateException if the filter has already been set {@code non-null}
 */
public static void setSerialFilter(ObjectInputFilter filter) {
    Objects.requireNonNull(filter, "filter");
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission("serialFilter"));
    }
    synchronized (serialFilterLock) {
        if (serialFilter != null) {
            throw new IllegalStateException("Serial filter can only be set once");
        }
        serialFilter = filter;
    }
}
 
Example #23
Source File: SecuritySubjectPermissionsTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
    if (System.getSecurityManager() == null) {
        Policy.setPolicy(new Policy() {
            @Override public PermissionCollection getPermissions(CodeSource cs) {
                Permissions res = new Permissions();

                res.add(new RuntimePermission("*"));
                res.add(new MBeanServerPermission("*"));
                res.add(new MBeanPermission("*", "*"));
                res.add(new MBeanTrustPermission("*"));
                res.add(new ReflectPermission("*"));
                res.add(new SSLPermission("*"));
                res.add(new ManagementPermission("monitor"));
                res.add(new ManagementPermission("control"));
                res.add(new SerializablePermission("*"));
                res.add(new SecurityPermission("*"));
                res.add(new SocketPermission("*", "connect,accept,listen,resolve"));
                res.add(new FilePermission("<<ALL FILES>>", "read,write,delete,execute,readlink"));
                res.add(new PropertyPermission("*", "read,write"));

                res.add(new TestPermission("common"));

                return res;
            }
        });

        System.setSecurityManager(new SecurityManager());

        setupSM = true;
    }
}
 
Example #24
Source File: InputStream.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #25
Source File: InputStream.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #26
Source File: StubFactoryDynamicBase.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission(
                "enableSubclassImplementation"));
    }
    return null;
}
 
Example #27
Source File: Util.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private static void isCustomSerializationPermitted() {
    SecurityManager sm = System.getSecurityManager();
    if (!allowCustomValueHandler) {
        if ( sm != null) {
            // check that a serialization permission has been
            // set to allow the loading of the Util delegate
            // which provides access to custom ValueHandler
            sm.checkPermission(new SerializablePermission(
                    "enableCustomValueHandler"));
        }
    }
}
 
Example #28
Source File: ObjectInputFilter.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the process-wide filter if it has not already been configured or set.
 *
 * @param filter the serialization filter to set as the process-wide filter; not null
 * @throws SecurityException if there is security manager and the
 *       {@code SerializablePermission("serialFilter")} is not granted
 * @throws IllegalStateException if the filter has already been set {@code non-null}
 */
public static void setSerialFilter(ObjectInputFilter filter) {
    Objects.requireNonNull(filter, "filter");
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SerializablePermission("serialFilter"));
    }
    synchronized (serialFilterLock) {
        if (serialFilter != null) {
            throw new IllegalStateException("Serial filter can only be set once");
        }
        serialFilter = filter;
    }
}
 
Example #29
Source File: InputStream.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}
 
Example #30
Source File: OutputStream.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static Void checkPermission() {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        if (!allowSubclass)
            sm.checkPermission(new
                SerializablePermission("enableSubclassImplementation"));
    }
    return null;
}