Package java.security

Examples of java.security.Policy$UnsupportedEmptyCollection


        try {
            // The policy file may have been modified to adjust
            // permissions, so we're reloading it when loading or
            // reloading a Context
            Policy policy = Policy.getPolicy();
            policy.refresh();
        } catch (AccessControlException e) {
            // Some policy files may restrict this, even for the core,
            // so this exception is ignored
        }
View Full Code Here


        try {
            // The policy file may have been modified to adjust
            // permissions, so we're reloading it when loading or
            // reloading a Context
            Policy policy = Policy.getPolicy();
            policy.refresh();
        } catch (AccessControlException e) {
            // Some policy files may restrict this, even for the core,
            // so this exception is ignored
        }
View Full Code Here

        // Setup the PermissionCollection for this web app context
        // based on the permissions configured for the root of the
        // web app context directory, then add a file read permission
        // for that directory.
        Policy policy = Policy.getPolicy();
        CodeSource source = null;
        PermissionCollection permissions = null;
        if( policy != null ) {
            try {         
                // Get the permissions for the web app context
                String docBase = context.getRealPath("/");
                if( docBase == null ) {
                    docBase = options.getScratchDir().toString();
                }
                String codeBase = docBase;
                if (!codeBase.endsWith(File.separator)){
                    codeBase = codeBase + File.separator;
                }
                File contextDir = new File(codeBase);
                URL url = contextDir.getCanonicalFile().toURI().toURL();
                source = new CodeSource(url,(Certificate[])null);
                permissions = policy.getPermissions(source);

                // Create a file read permission for web app context directory
                if (!docBase.endsWith(File.separator)){
                    permissions.add
                        (new FilePermission(docBase,"read"));
View Full Code Here

        if (!POLICY_INSTALLED) {
            policyProvider = sysOverRide(policyProvider, POLICY_PROVIDER);

            if (policyProvider != null) {
                Policy policy = (Policy) classLoader.loadClass(policyProvider).newInstance();
                policy.refresh();
                Policy.setPolicy(policy);
            }

            POLICY_INSTALLED = true;
        }
View Full Code Here

        for (PolicyConfiguration policyConfiguration : contextIdToPolicyConfigurationMap.values()) {
            policyConfiguration.commit();
        }

        //refresh policy
        Policy policy = Policy.getPolicy();
        policy.refresh();

    }
View Full Code Here

        // Setup the PermissionCollection for this web app context
        // based on the permissions configured for the root of the
        // web app context directory, then add a file read permission
        // for that directory.
        Policy policy = Policy.getPolicy();
        if( policy != null ) {
            try {         
                // Get the permissions for the web app context
                String docBase = context.getRealPath("/");
                if( docBase == null ) {
                    docBase = options.getScratchDir().toString();
                }
                String codeBase = docBase;
                if (!codeBase.endsWith(File.separator)){
                    codeBase = codeBase + File.separator;
                }
                File contextDir = new File(codeBase);
                URL url = contextDir.getCanonicalFile().toURL();
                codeSource = new CodeSource(url, (Certificate[]) null);
                permissionCollection = policy.getPermissions(codeSource);

                // Create a file read permission for web app context directory
                if (!docBase.endsWith(File.separator)){
                    permissionCollection.add
                        (new FilePermission(docBase,"read"));
View Full Code Here

                }                             
            }
        }
        if (!need) return;

        Policy ppc = null;
        if (pp != null) {
            try {
                ppc = (Policy)Class.forName(pp).newInstance();
            } catch (Exception e) {
                throw new BrokerException(e.getClass().getName()+": "+
                      e.getMessage()+" - "+
                      AccessController.PROP_ACCESSCONTROL_PREFIX+
                      JAASAccessControlModel.PROP_POLICY_PROVIDER+"="+pp);
            }
        }

        synchronized(System.class) {
            if (System.getSecurityManager() == null) {
                String val = System.getProperty("java.security.policy");
                if (val == null) {
                    /*
                    logger.log(logger.INFO, "Set java.security.policy to MQ default policy file");
                    System.setProperty("java.security.policy",
                    "file:"+Globals.getInstanceEtcDir()+File.separator+DEFAULT_POLICY_FILENAME);
                    */
                } else {
                    logger.log(logger.INFO, "java.security.policy="+val);
                }
                System.setSecurityManager(new SecurityManager());
                logger.log(logger.INFO, Globals.getBrokerResources().getKString(
                                  BrokerResources.I_SET_DEFAULT_SECURITY_MANAGER));
            }
        }
        if (ppc != null) {
            logger.log(logger.INFO, AccessController.PROP_ACCESSCONTROL_PREFIX+
                                    JAASAccessControlModel.PROP_POLICY_PROVIDER+"="+pp);
            Policy.setPolicy(ppc);
            logger.log(logger.INFO, Globals.getBrokerResources().getKString(
                    BrokerResources.I_SET_JAVA_POLICY_PROVIDER, ppc.getClass().getName()));
        }
    }
View Full Code Here

        // Invoke main(args) using new classloader.
        Thread.currentThread().setContextClassLoader(cl);
        // re-eval the policy now that env is set
        try
        {
            Policy policy=Policy.getPolicy();
            if (policy!=null)
                policy.refresh();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
View Full Code Here

        if (!POLICY_INSTALLED) {
            policyProvider = sysOverRide(policyProvider, POLICY_PROVIDER);

            if (policyProvider != null) {
                Policy policy = (Policy) classLoader.loadClass(policyProvider).newInstance();
                policy.refresh();
                Policy.setPolicy(policy);
            }

            POLICY_INSTALLED = true;
        }
View Full Code Here

        for (PolicyConfiguration policyConfiguration : contextIdToPolicyConfigurationMap.values()) {
            policyConfiguration.commit();
        }

        //refresh policy
        Policy policy = Policy.getPolicy();
        policy.refresh();

    }
View Full Code Here

TOP

Related Classes of java.security.Policy$UnsupportedEmptyCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.