Path: blob/master/src/java.rmi/share/classes/java/rmi/RMISecurityManager.java
41152 views
/*1* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.rmi;2627import java.security.*;2829/**30* {@code RMISecurityManager} implements a policy identical to the policy31* implemented by {@link SecurityManager}. RMI applications32* should use the {@code SecurityManager} class or another appropriate33* {@code SecurityManager} implementation instead of this class. RMI's class34* loader will download classes from remote locations only if a security35* manager has been set.36*37* @implNote38* <p>Applets typically run in a container that already has a security39* manager, so there is generally no need for applets to set a security40* manager. If you have a standalone application, you might need to set a41* {@code SecurityManager} in order to enable class downloading. This can be42* done by adding the following to your code. (It needs to be executed before43* RMI can download code from remote hosts, so it most likely needs to appear44* in the {@code main} method of your application.)45*46* <pre>{@code47* if (System.getSecurityManager() == null) {48* System.setSecurityManager(new SecurityManager());49* }50* }</pre>51*52* @author Roger Riggs53* @author Peter Jones54* @since 1.155* @deprecated This class is only useful in conjunction with56* {@linkplain SecurityManager the Security Manager}, which is deprecated57* and subject to removal in a future release. Consequently, this class58* is also deprecated and subject to removal. There is no replacement for59* the Security Manager or this class.60*/61@SuppressWarnings("removal")62@Deprecated(since="1.8", forRemoval = true)63public class RMISecurityManager extends SecurityManager {6465/**66* Constructs a new {@code RMISecurityManager}.67* @since 1.168*/69public RMISecurityManager() {70}71}727374