Logo Search packages:      
Sourcecode: icedtea-web version File versions  Download package

PermissionCollection net::sourceforge::jnlp::runtime::JNLPClassLoader::getPermissions ( CodeSource  cs  )  [inline, protected]

Returns the permissions for the CodeSource.

Definition at line 555 of file JNLPClassLoader.java.

References getCodeSourceSecurity(), net::sourceforge::jnlp::SecurityDesc::getSandBoxPermissions(), resourcePermissions, runtimePermissions, and security.

Referenced by net::sourceforge::jnlp::runtime::JNLPSecurityManager::addPermission(), and net::sourceforge::jnlp::runtime::JNLPPolicy::getPermissions().

                                                                 {
        Permissions result = new Permissions();

        // should check for extensions or boot, automatically give all
        // access w/o security dialog once we actually check certificates.

        // copy security permissions from SecurityDesc element
         if (security != null) {
            // Security desc. is used only to track security settings for the
            // application. However, an application may comprise of multiple
            // jars, and as such, security must be evaluated on a per jar basis.

            // set default perms
            PermissionCollection permissions = security.getSandBoxPermissions();

            // If more than default is needed:
            // 1. Code must be signed
            // 2. ALL or J2EE permissions must be requested (note: plugin requests ALL automatically)
            if (cs.getCodeSigners() != null &&
                    (getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.ALL_PERMISSIONS) ||
                     getCodeSourceSecurity(cs.getLocation()).getSecurityType().equals(SecurityDesc.J2EE_PERMISSIONS))
                    ) {

                permissions = getCodeSourceSecurity(cs.getLocation()).getPermissions();
            }

            Enumeration<Permission> e = permissions.elements();
            while (e.hasMoreElements())
                result.add(e.nextElement());
        }

        // add in permission to read the cached JAR files
        for (int i=0; i < resourcePermissions.size(); i++)
            result.add((Permission) resourcePermissions.get(i));

        // add in the permissions that the user granted.
        for (int i=0; i < runtimePermissions.size(); i++)
                result.add(runtimePermissions.get(i));

        return result;
    }


Generated by  Doxygen 1.6.0   Back to index