Java Code Examples for sun.security.util.SecurityConstants#ALL_PERMISSION

The following examples show how to use sun.security.util.SecurityConstants#ALL_PERMISSION . 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: PolicyFile.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates one of the well-known permissions directly instead of
 * via reflection. Keep list short to not penalize non-JDK-defined
 * permissions.
 */
private static final Permission getKnownInstance(Class<?> claz,
    String name, String actions) {
    if (claz.equals(FilePermission.class)) {
        return new FilePermission(name, actions);
    } else if (claz.equals(SocketPermission.class)) {
        return new SocketPermission(name, actions);
    } else if (claz.equals(RuntimePermission.class)) {
        return new RuntimePermission(name, actions);
    } else if (claz.equals(PropertyPermission.class)) {
        return new PropertyPermission(name, actions);
    } else if (claz.equals(NetPermission.class)) {
        return new NetPermission(name, actions);
    } else if (claz.equals(AllPermission.class)) {
        return SecurityConstants.ALL_PERMISSION;
    } else {
        return null;
    }
}
 
Example 2
Source File: PolicyFile.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates one of the well-known permissions directly instead of
 * via reflection. Keep list short to not penalize non-JDK-defined
 * permissions.
 */
private static final Permission getKnownInstance(Class<?> claz,
    String name, String actions) {
    if (claz.equals(FilePermission.class)) {
        return new FilePermission(name, actions);
    } else if (claz.equals(SocketPermission.class)) {
        return new SocketPermission(name, actions);
    } else if (claz.equals(RuntimePermission.class)) {
        return new RuntimePermission(name, actions);
    } else if (claz.equals(PropertyPermission.class)) {
        return new PropertyPermission(name, actions);
    } else if (claz.equals(NetPermission.class)) {
        return new NetPermission(name, actions);
    } else if (claz.equals(AllPermission.class)) {
        return SecurityConstants.ALL_PERMISSION;
    } else {
        return null;
    }
}
 
Example 3
Source File: PolicyFile.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates one of the well-known permissions directly instead of
 * via reflection. Keep list short to not penalize non-JDK-defined
 * permissions.
 */
private static final Permission getKnownInstance(Class<?> claz,
    String name, String actions) {
    if (claz.equals(FilePermission.class)) {
        return new FilePermission(name, actions);
    } else if (claz.equals(SocketPermission.class)) {
        return new SocketPermission(name, actions);
    } else if (claz.equals(RuntimePermission.class)) {
        return new RuntimePermission(name, actions);
    } else if (claz.equals(PropertyPermission.class)) {
        return new PropertyPermission(name, actions);
    } else if (claz.equals(NetPermission.class)) {
        return new NetPermission(name, actions);
    } else if (claz.equals(AllPermission.class)) {
        return SecurityConstants.ALL_PERMISSION;
    } else {
        return null;
    }
}
 
Example 4
Source File: AllPermission.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an enumeration of all the AllPermission objects in the
 * container.
 *
 * @return an enumeration of all the AllPermission objects.
 */
public Enumeration<Permission> elements() {
    return new Enumeration<Permission>() {
        private boolean hasMore = all_allowed;

        public boolean hasMoreElements() {
            return hasMore;
        }

        public Permission nextElement() {
            hasMore = false;
            return SecurityConstants.ALL_PERMISSION;
        }
    };
}
 
Example 5
Source File: AllPermission.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Returns an enumeration of all the AllPermission objects in the
 * container.
 *
 * @return an enumeration of all the AllPermission objects.
 */
public Enumeration<Permission> elements() {
    return new Enumeration<Permission>() {
        private boolean hasMore = all_allowed;

        public boolean hasMoreElements() {
            return hasMore;
        }

        public Permission nextElement() {
            hasMore = false;
            return SecurityConstants.ALL_PERMISSION;
        }
    };
}
 
Example 6
Source File: AllPermission.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Returns an enumeration of all the AllPermission objects in the
 * container.
 *
 * @return an enumeration of all the AllPermission objects.
 */
public Enumeration<Permission> elements() {
    return new Enumeration<>() {
        private boolean hasMore = all_allowed;

        public boolean hasMoreElements() {
            return hasMore;
        }

        public Permission nextElement() {
            hasMore = false;
            return SecurityConstants.ALL_PERMISSION;
        }
    };
}
 
Example 7
Source File: AllPermission.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an enumeration of all the AllPermission objects in the
 * container.
 *
 * @return an enumeration of all the AllPermission objects.
 */
public Enumeration<Permission> elements() {
    return new Enumeration<Permission>() {
        private boolean hasMore = all_allowed;

        public boolean hasMoreElements() {
            return hasMore;
        }

        public Permission nextElement() {
            hasMore = false;
            return SecurityConstants.ALL_PERMISSION;
        }
    };
}
 
Example 8
Source File: AllPermission.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns an enumeration of all the AllPermission objects in the
 * container.
 *
 * @return an enumeration of all the AllPermission objects.
 */
public Enumeration<Permission> elements() {
    return new Enumeration<Permission>() {
        private boolean hasMore = all_allowed;

        public boolean hasMoreElements() {
            return hasMore;
        }

        public Permission nextElement() {
            hasMore = false;
            return SecurityConstants.ALL_PERMISSION;
        }
    };
}
 
Example 9
Source File: SecurityManager.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns <code>false</code> if the calling
 * thread is not trusted to bring up the top-level window indicated
 * by the <code>window</code> argument. In this case, the caller can
 * still decide to show the window, but the window should include
 * some sort of visual warning. If the method returns
 * <code>true</code>, then the window can be shown without any
 * special restrictions.
 * <p>
 * See class <code>Window</code> for more information on trusted and
 * untrusted windows.
 * <p>
 * This method calls
 * <code>checkPermission</code> with the
 * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
 * and returns <code>true</code> if a SecurityException is not thrown,
 * otherwise it returns <code>false</code>.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkTopLevelWindow</code>
 * at the point the overridden method would normally return
 * <code>false</code>, and the value of
 * <code>super.checkTopLevelWindow</code> should
 * be returned.
 *
 * @param      window   the new window that is being created.
 * @return     <code>true</code> if the calling thread is trusted to put up
 *             top-level windows; <code>false</code> otherwise.
 * @exception  NullPointerException if the <code>window</code> argument is
 *             <code>null</code>.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        java.awt.Window
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public boolean checkTopLevelWindow(Object window) {
    if (window == null) {
        throw new NullPointerException("window can't be null");
    }
    Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    try {
        checkPermission(perm);
        return true;
    } catch (SecurityException se) {
        // just return false
    }
    return false;
}
 
Example 10
Source File: SecurityManager.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns <code>false</code> if the calling
 * thread is not trusted to bring up the top-level window indicated
 * by the <code>window</code> argument. In this case, the caller can
 * still decide to show the window, but the window should include
 * some sort of visual warning. If the method returns
 * <code>true</code>, then the window can be shown without any
 * special restrictions.
 * <p>
 * See class <code>Window</code> for more information on trusted and
 * untrusted windows.
 * <p>
 * This method calls
 * <code>checkPermission</code> with the
 * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
 * and returns <code>true</code> if a SecurityException is not thrown,
 * otherwise it returns <code>false</code>.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkTopLevelWindow</code>
 * at the point the overridden method would normally return
 * <code>false</code>, and the value of
 * <code>super.checkTopLevelWindow</code> should
 * be returned.
 *
 * @param      window   the new window that is being created.
 * @return     <code>true</code> if the calling thread is trusted to put up
 *             top-level windows; <code>false</code> otherwise.
 * @exception  NullPointerException if the <code>window</code> argument is
 *             <code>null</code>.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        java.awt.Window
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public boolean checkTopLevelWindow(Object window) {
    if (window == null) {
        throw new NullPointerException("window can't be null");
    }
    Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    try {
        checkPermission(perm);
        return true;
    } catch (SecurityException se) {
        // just return false
    }
    return false;
}
 
Example 11
Source File: SecurityManager.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/**
 * Returns <code>false</code> if the calling
 * thread is not trusted to bring up the top-level window indicated
 * by the <code>window</code> argument. In this case, the caller can
 * still decide to show the window, but the window should include
 * some sort of visual warning. If the method returns
 * <code>true</code>, then the window can be shown without any
 * special restrictions.
 * <p>
 * See class <code>Window</code> for more information on trusted and
 * untrusted windows.
 * <p>
 * This method calls
 * <code>checkPermission</code> with the
 * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
 * and returns <code>true</code> if a SecurityException is not thrown,
 * otherwise it returns <code>false</code>.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkTopLevelWindow</code>
 * at the point the overridden method would normally return
 * <code>false</code>, and the value of
 * <code>super.checkTopLevelWindow</code> should
 * be returned.
 *
 * @param      window   the new window that is being created.
 * @return     <code>true</code> if the calling thread is trusted to put up
 *             top-level windows; <code>false</code> otherwise.
 * @exception  NullPointerException if the <code>window</code> argument is
 *             <code>null</code>.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        java.awt.Window
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public boolean checkTopLevelWindow(Object window) {
    if (window == null) {
        throw new NullPointerException("window can't be null");
    }
    Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    try {
        checkPermission(perm);
        return true;
    } catch (SecurityException se) {
        // just return false
    }
    return false;
}
 
Example 12
Source File: SecurityManager.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Returns <code>false</code> if the calling
 * thread is not trusted to bring up the top-level window indicated
 * by the <code>window</code> argument. In this case, the caller can
 * still decide to show the window, but the window should include
 * some sort of visual warning. If the method returns
 * <code>true</code>, then the window can be shown without any
 * special restrictions.
 * <p>
 * See class <code>Window</code> for more information on trusted and
 * untrusted windows.
 * <p>
 * This method calls
 * <code>checkPermission</code> with the
 * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
 * and returns <code>true</code> if a SecurityException is not thrown,
 * otherwise it returns <code>false</code>.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkTopLevelWindow</code>
 * at the point the overridden method would normally return
 * <code>false</code>, and the value of
 * <code>super.checkTopLevelWindow</code> should
 * be returned.
 *
 * @param      window   the new window that is being created.
 * @return     <code>true</code> if the calling thread is trusted to put up
 *             top-level windows; <code>false</code> otherwise.
 * @exception  NullPointerException if the <code>window</code> argument is
 *             <code>null</code>.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        java.awt.Window
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public boolean checkTopLevelWindow(Object window) {
    if (window == null) {
        throw new NullPointerException("window can't be null");
    }
    Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    try {
        checkPermission(perm);
        return true;
    } catch (SecurityException se) {
        // just return false
    }
    return false;
}
 
Example 13
Source File: SecurityManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns <code>false</code> if the calling
 * thread is not trusted to bring up the top-level window indicated
 * by the <code>window</code> argument. In this case, the caller can
 * still decide to show the window, but the window should include
 * some sort of visual warning. If the method returns
 * <code>true</code>, then the window can be shown without any
 * special restrictions.
 * <p>
 * See class <code>Window</code> for more information on trusted and
 * untrusted windows.
 * <p>
 * This method calls
 * <code>checkPermission</code> with the
 * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
 * and returns <code>true</code> if a SecurityException is not thrown,
 * otherwise it returns <code>false</code>.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkTopLevelWindow</code>
 * at the point the overridden method would normally return
 * <code>false</code>, and the value of
 * <code>super.checkTopLevelWindow</code> should
 * be returned.
 *
 * @param      window   the new window that is being created.
 * @return     <code>true</code> if the calling thread is trusted to put up
 *             top-level windows; <code>false</code> otherwise.
 * @exception  NullPointerException if the <code>window</code> argument is
 *             <code>null</code>.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        java.awt.Window
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public boolean checkTopLevelWindow(Object window) {
    if (window == null) {
        throw new NullPointerException("window can't be null");
    }
    Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    try {
        checkPermission(perm);
        return true;
    } catch (SecurityException se) {
        // just return false
    }
    return false;
}
 
Example 14
Source File: SecurityManager.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns <code>false</code> if the calling
 * thread is not trusted to bring up the top-level window indicated
 * by the <code>window</code> argument. In this case, the caller can
 * still decide to show the window, but the window should include
 * some sort of visual warning. If the method returns
 * <code>true</code>, then the window can be shown without any
 * special restrictions.
 * <p>
 * See class <code>Window</code> for more information on trusted and
 * untrusted windows.
 * <p>
 * This method calls
 * <code>checkPermission</code> with the
 * <code>AWTPermission("showWindowWithoutWarningBanner")</code> permission,
 * and returns <code>true</code> if a SecurityException is not thrown,
 * otherwise it returns <code>false</code>.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkTopLevelWindow</code>
 * at the point the overridden method would normally return
 * <code>false</code>, and the value of
 * <code>super.checkTopLevelWindow</code> should
 * be returned.
 *
 * @param      window   the new window that is being created.
 * @return     <code>true</code> if the calling thread is trusted to put up
 *             top-level windows; <code>false</code> otherwise.
 * @exception  NullPointerException if the <code>window</code> argument is
 *             <code>null</code>.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        java.awt.Window
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public boolean checkTopLevelWindow(Object window) {
    if (window == null) {
        throw new NullPointerException("window can't be null");
    }
    Permission perm = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    try {
        checkPermission(perm);
        return true;
    } catch (SecurityException se) {
        // just return false
    }
    return false;
}
 
Example 15
Source File: SecurityManager.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Throws a <code>SecurityException</code> if the
 * calling thread is not allowed to access the AWT event queue.
 * <p>
 * This method calls <code>checkPermission</code> with the
 * <code>AWTPermission("accessEventQueue")</code> permission.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 *
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkAwtEventQueueAccess</code>
 * at the point the overridden method would normally throw an
 * exception.
 *
 * @since   JDK1.1
 * @exception  SecurityException  if the calling thread does not have
 *             permission to access the AWT event queue.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public void checkAwtEventQueueAccess() {
    Permission perm = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    checkPermission(perm);
}
 
Example 16
Source File: SecurityManager.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Throws a <code>SecurityException</code> if the
 * calling thread is not allowed to access the system clipboard.
 * <p>
 * This method calls <code>checkPermission</code> with the
 * <code>AWTPermission("accessClipboard")</code>
 * permission.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkSystemClipboardAccess</code>
 * at the point the overridden method would normally throw an
 * exception.
 *
 * @since   JDK1.1
 * @exception  SecurityException  if the calling thread does not have
 *             permission to access the system clipboard.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public void checkSystemClipboardAccess() {
    Permission perm = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    checkPermission(perm);
}
 
Example 17
Source File: SecurityManager.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Throws a <code>SecurityException</code> if the
 * calling thread is not allowed to access the AWT event queue.
 * <p>
 * This method calls <code>checkPermission</code> with the
 * <code>AWTPermission("accessEventQueue")</code> permission.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 *
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkAwtEventQueueAccess</code>
 * at the point the overridden method would normally throw an
 * exception.
 *
 * @since   JDK1.1
 * @exception  SecurityException  if the calling thread does not have
 *             permission to access the AWT event queue.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public void checkAwtEventQueueAccess() {
    Permission perm = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    checkPermission(perm);
}
 
Example 18
Source File: SecurityManager.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Throws a <code>SecurityException</code> if the
 * calling thread is not allowed to access the system clipboard.
 * <p>
 * This method calls <code>checkPermission</code> with the
 * <code>AWTPermission("accessClipboard")</code>
 * permission.
 * In the case of subset Profiles of Java SE that do not include the
 * {@code java.awt} package, {@code checkPermission} is instead called
 * to check the permission {@code java.security.AllPermission}.
 * <p>
 * If you override this method, then you should make a call to
 * <code>super.checkSystemClipboardAccess</code>
 * at the point the overridden method would normally throw an
 * exception.
 *
 * @since   JDK1.1
 * @exception  SecurityException  if the calling thread does not have
 *             permission to access the system clipboard.
 * @deprecated The dependency on {@code AWTPermission} creates an
 *             impediment to future modularization of the Java platform.
 *             Users of this method should instead invoke
 *             {@link #checkPermission} directly.
 *             This method will be changed in a future release to check
 *             the permission {@code java.security.AllPermission}.
 * @see        #checkPermission(java.security.Permission) checkPermission
 */
@Deprecated
public void checkSystemClipboardAccess() {
    Permission perm = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
    if (perm == null) {
        perm = SecurityConstants.ALL_PERMISSION;
    }
    checkPermission(perm);
}
 
Example 19
Source File: URLConnection.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a permission object representing the permission
 * necessary to make the connection represented by this
 * object. This method returns null if no permission is
 * required to make the connection. By default, this method
 * returns {@code java.security.AllPermission}. Subclasses
 * should override this method and return the permission
 * that best represents the permission required to make a
 * a connection to the URL. For example, a {@code URLConnection}
 * representing a {@code file:} URL would return a
 * {@code java.io.FilePermission} object.
 *
 * <p>The permission returned may dependent upon the state of the
 * connection. For example, the permission before connecting may be
 * different from that after connecting. For example, an HTTP
 * sever, say foo.com, may redirect the connection to a different
 * host, say bar.com. Before connecting the permission returned by
 * the connection will represent the permission needed to connect
 * to foo.com, while the permission returned after connecting will
 * be to bar.com.
 *
 * <p>Permissions are generally used for two purposes: to protect
 * caches of objects obtained through URLConnections, and to check
 * the right of a recipient to learn about a particular URL. In
 * the first case, the permission should be obtained
 * <em>after</em> the object has been obtained. For example, in an
 * HTTP connection, this will represent the permission to connect
 * to the host from which the data was ultimately fetched. In the
 * second case, the permission should be obtained and tested
 * <em>before</em> connecting.
 *
 * @return the permission object representing the permission
 * necessary to make the connection represented by this
 * URLConnection.
 *
 * @exception IOException if the computation of the permission
 * requires network or file I/O and an exception occurs while
 * computing it.
 */
public Permission getPermission() throws IOException {
    return SecurityConstants.ALL_PERMISSION;
}
 
Example 20
Source File: URLConnection.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a permission object representing the permission
 * necessary to make the connection represented by this
 * object. This method returns null if no permission is
 * required to make the connection. By default, this method
 * returns {@code java.security.AllPermission}. Subclasses
 * should override this method and return the permission
 * that best represents the permission required to make a
 * a connection to the URL. For example, a {@code URLConnection}
 * representing a {@code file:} URL would return a
 * {@code java.io.FilePermission} object.
 *
 * <p>The permission returned may dependent upon the state of the
 * connection. For example, the permission before connecting may be
 * different from that after connecting. For example, an HTTP
 * sever, say foo.com, may redirect the connection to a different
 * host, say bar.com. Before connecting the permission returned by
 * the connection will represent the permission needed to connect
 * to foo.com, while the permission returned after connecting will
 * be to bar.com.
 *
 * <p>Permissions are generally used for two purposes: to protect
 * caches of objects obtained through URLConnections, and to check
 * the right of a recipient to learn about a particular URL. In
 * the first case, the permission should be obtained
 * <em>after</em> the object has been obtained. For example, in an
 * HTTP connection, this will represent the permission to connect
 * to the host from which the data was ultimately fetched. In the
 * second case, the permission should be obtained and tested
 * <em>before</em> connecting.
 *
 * @return the permission object representing the permission
 * necessary to make the connection represented by this
 * URLConnection.
 *
 * @exception IOException if the computation of the permission
 * requires network or file I/O and an exception occurs while
 * computing it.
 */
public Permission getPermission() throws IOException {
    return SecurityConstants.ALL_PERMISSION;
}