java.util.logging.LoggingPermission#java.security.SecurityPermission源码实例Demo

下面列出了java.util.logging.LoggingPermission#java.security.SecurityPermission 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: extension-kafka   文件: JSR166TestCase.java
/** Returns a policy containing all the permissions we ever need. */
public static Policy permissivePolicy() {
  return new AdjustablePolicy
  // Permissions j.u.c. needs directly
  (
      new RuntimePermission("modifyThread"),
      new RuntimePermission("getClassLoader"),
      new RuntimePermission("setContextClassLoader"),
      // Permissions needed to change permissions!
      new SecurityPermission("getPolicy"),
      new SecurityPermission("setPolicy"),
      new RuntimePermission("setSecurityManager"),
      // Permissions needed by the junit test harness
      new RuntimePermission("accessDeclaredMembers"),
      new PropertyPermission("*", "read"),
      new java.io.FilePermission("<<ALL FILES>>", "read"));
}
 
源代码2 项目: openjdk-jdk9   文件: PermissionTest.java
public void setBasicPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("user.dir", "read"));
    permissions.add(new PropertyPermission("test.src", "read"));
    permissions.add(new PropertyPermission("file.separator", "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>", "execute"));
}
 
源代码3 项目: openjdk-jdk9   文件: JSR166TestCase.java
/**
 * Returns a policy containing all the permissions we ever need.
 */
public static Policy permissivePolicy() {
    return new AdjustablePolicy
        // Permissions j.u.c. needs directly
        (new RuntimePermission("modifyThread"),
         new RuntimePermission("getClassLoader"),
         new RuntimePermission("setContextClassLoader"),
         // Permissions needed to change permissions!
         new SecurityPermission("getPolicy"),
         new SecurityPermission("setPolicy"),
         new RuntimePermission("setSecurityManager"),
         // Permissions needed by the junit test harness
         new RuntimePermission("accessDeclaredMembers"),
         new PropertyPermission("*", "read"),
         new java.io.FilePermission("<<ALL FILES>>", "read"));
}
 
源代码4 项目: streamsupport   文件: JSR166TestCase.java
/**
     * Returns a policy containing all the permissions we ever need.
     */
    public static Policy permissivePolicy() {
        return new AdjustablePolicy
            // Permissions j.u.c. needs directly
            (new RuntimePermission("modifyThread"),
             new RuntimePermission("getClassLoader"),
             new RuntimePermission("setContextClassLoader"),
//             new RuntimePermission("modifyThreadGroup"),
//             new RuntimePermission("enableContextClassLoaderOverride"),
             // Permissions needed to change permissions!
             new SecurityPermission("getPolicy"),
             new SecurityPermission("setPolicy"),
             new RuntimePermission("setSecurityManager"),
             // Permissions needed by the junit test harness
             new RuntimePermission("accessDeclaredMembers"),
             new PropertyPermission("*", "read"),
             new java.io.FilePermission("<<ALL FILES>>", "read"));
    }
 
源代码5 项目: database   文件: JSR166TestCase.java
/**
 * Returns a policy containing all the permissions we ever need.
 */
public static Policy permissivePolicy() {
    return new AdjustablePolicy
        // Permissions j.u.c. needs directly
        (new RuntimePermission("modifyThread"),
         new RuntimePermission("getClassLoader"),
         new RuntimePermission("setContextClassLoader"),
         // Permissions needed to change permissions!
         new SecurityPermission("getPolicy"),
         new SecurityPermission("setPolicy"),
         new RuntimePermission("setSecurityManager"),
         // Permissions needed by the junit test harness
         new RuntimePermission("accessDeclaredMembers"),
         new PropertyPermission("*", "read"),
         new java.io.FilePermission("<<ALL FILES>>", "read"));
}
 
源代码6 项目: caffeine   文件: JSR166TestCase.java
/**
 * Returns a policy containing all the permissions we ever need.
 */
public static Policy permissivePolicy() {
    return new AdjustablePolicy
        // Permissions j.u.c. needs directly
        (new RuntimePermission("modifyThread"),
         new RuntimePermission("getClassLoader"),
         new RuntimePermission("setContextClassLoader"),
         // Permissions needed to change permissions!
         new SecurityPermission("getPolicy"),
         new SecurityPermission("setPolicy"),
         new RuntimePermission("setSecurityManager"),
         // Permissions needed by the junit test harness
         new RuntimePermission("accessDeclaredMembers"),
         new PropertyPermission("*", "read"),
         new java.io.FilePermission("<<ALL FILES>>", "read"));
}
 
源代码7 项目: j2objc   文件: JSR166TestCase.java
/**
 * Returns a policy containing all the permissions we ever need.
 */
public static Policy permissivePolicy() {
    return new AdjustablePolicy
        // Permissions j.u.c. needs directly
        (new RuntimePermission("modifyThread"),
         new RuntimePermission("getClassLoader"),
         new RuntimePermission("setContextClassLoader"),
         // Permissions needed to change permissions!
         new SecurityPermission("getPolicy"),
         new SecurityPermission("setPolicy"),
         new RuntimePermission("setSecurityManager"),
         // Permissions needed by the junit test harness
         new RuntimePermission("accessDeclaredMembers"),
         new PropertyPermission("*", "read"),
         new java.io.FilePermission("<<ALL FILES>>", "read"));
}
 
源代码8 项目: dragonwell8_jdk   文件: KeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
    throws IOException, NoSuchAlgorithmException, CertificateException
{
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName());

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }
}
 
源代码9 项目: dragonwell8_jdk   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码10 项目: dragonwell8_jdk   文件: TestPolicy.java
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>",
            "read, write, delete"));
}
 
源代码11 项目: TencentKona-8   文件: KeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
    throws IOException, NoSuchAlgorithmException, CertificateException
{
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName());

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }
}
 
源代码12 项目: TencentKona-8   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码13 项目: TencentKona-8   文件: TestPolicy.java
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>",
            "read, write, delete"));
}
 
源代码14 项目: native-obfuscator   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码15 项目: jdk8u60   文件: KeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
    throws IOException, NoSuchAlgorithmException, CertificateException
{
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName(), entries);

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }
}
 
源代码16 项目: jdk8u60   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码17 项目: jdk8u60   文件: TestPolicy.java
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>",
            "read, write, delete"));
}
 
源代码18 项目: openjdk-jdk8u   文件: CKeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
        throws IOException, NoSuchAlgorithmException, CertificateException {
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName());

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }

    if (debug != null) {
        debug.println("MSCAPI keystore load: entry count: " +
                entries.size());
    }
}
 
源代码19 项目: openjdk-jdk8u   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码20 项目: openjdk-jdk8u   文件: TestPolicy.java
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>",
            "read, write, delete"));
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: KeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
    throws IOException, NoSuchAlgorithmException, CertificateException
{
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName());

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }
}
 
源代码22 项目: openjdk-jdk8u-backup   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码23 项目: openjdk-jdk8u-backup   文件: TestPolicy.java
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>",
            "read, write, delete"));
}
 
源代码24 项目: openjdk-jdk9   文件: KeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
    throws IOException, NoSuchAlgorithmException, CertificateException
{
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName());

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }
}
 
源代码25 项目: openjdk-jdk9   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}
 
源代码26 项目: openjdk-jdk9   文件: TestPolicy.java
private void setMinimalPermissions() {
    permissions.add(new SecurityPermission("getPolicy"));
    permissions.add(new SecurityPermission("setPolicy"));
    permissions.add(new RuntimePermission("getClassLoader"));
    permissions.add(new RuntimePermission("setSecurityManager"));
    permissions.add(new RuntimePermission("createSecurityManager"));
    permissions.add(new PropertyPermission("testng.show.stack.frames",
            "read"));
    permissions.add(new PropertyPermission("line.separator", "read"));
    permissions.add(new PropertyPermission("fileStringBuffer", "read"));
    permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
    permissions.add(new PropertyPermission("java.io.tmpdir", "read"));
    permissions.add(new FilePermission("<<ALL FILES>>",
            "read, write, delete"));
}
 
源代码27 项目: openjdk-jdk9   文件: JAXPPolicyManager.java
private void setDefaultPermissions() {
    //Permissions to set security manager and policy
    addPermission(new SecurityPermission("getPolicy"));
    addPermission(new SecurityPermission("setPolicy"));
    addPermission(new RuntimePermission("setSecurityManager"));
    addPermission(new PropertyPermission("test.src", "read"));
}
 
源代码28 项目: marshalsec   文件: SideEffectSecurityManager.java
/**
 * {@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);
}
 
源代码29 项目: jdk8u-jdk   文件: KeyStore.java
/**
 * Loads the keystore.
 *
 * A compatibility mode is supported for applications that assume
 * keystores are stream-based. It permits (but ignores) a non-null
 * <code>stream</code> or <code>password</code>.
 * The mode is enabled by default.
 * Set the
 * <code>sun.security.mscapi.keyStoreCompatibilityMode</code>
 * system property to <code>false</code> to disable compatibility mode
 * and reject a non-null <code>stream</code> or <code>password</code>.
 *
 * @param stream the input stream, which should be <code>null</code>.
 * @param password the password, which should be <code>null</code>.
 *
 * @exception IOException if there is an I/O or format problem with the
 * keystore data. Or if compatibility mode is disabled and either
 * parameter is non-null.
 * @exception NoSuchAlgorithmException if the algorithm used to check
 * the integrity of the keystore cannot be found
 * @exception CertificateException if any of the certificates in the
 * keystore could not be loaded
 * @exception SecurityException if the security check for
 *  <code>SecurityPermission("authProvider.<i>name</i>")</code> does not
 *  pass, where <i>name</i> is the value returned by
 *  this provider's <code>getName</code> method.
 */
public void engineLoad(InputStream stream, char[] password)
    throws IOException, NoSuchAlgorithmException, CertificateException
{
    if (stream != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore input stream must be null");
    }

    if (password != null && !keyStoreCompatibilityMode) {
        throw new IOException("Keystore password must be null");
    }

    /*
     * Use the same security check as AuthProvider.login
     */
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
        sm.checkPermission(new SecurityPermission(
            "authProvider.SunMSCAPI"));
    }

    // Clear all key entries
    entries.clear();

    try {

        // Load keys and/or certificate chains
        loadKeysOrCertificateChains(getName());

    } catch (KeyStoreException e) {
        throw new IOException(e);
    }
}
 
源代码30 项目: jdk8u-jdk   文件: NonPublicProxyClass.java
NewInstancePolicy(boolean grant) {
    this.grant = grant;
    permissions.add(new SecurityPermission("getPolicy"));
    if (grant) {
        permissions.add(new RuntimePermission("getClassLoader"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "p"));
        permissions.add(new ReflectPermission(NEW_PROXY_IN_PKG + "java.util.zip"));
    }
}