Package java.security

Examples of java.security.Policy$UnsupportedEmptyCollection


        // 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


            }

            final URL sourceUrl = jar.getResource(name.replace('.', '/')
                + ".class");
            final CodeSource cs = new CodeSource(sourceUrl, (Certificate[]) null);
            final Policy policy = (Policy) AccessController
                .doPrivileged(GetPolicyAction.getInstance());
            final ProtectionDomain pd = new ProtectionDomain(cs, policy
                .getPermissions(cs));
            final Class<?> cls = defineClass(name, b, pd);
            resolveClass(cls);
            return cls;
        } else {
View Full Code Here

         IllegalStateException ex = new IllegalStateException("Failed to parse jacc-policy-config-states.xml");
         ex.initCause(e);
         throw ex;
      }
      // Get the DelegatingPolicy
      Policy p = Policy.getPolicy();
      if( (p instanceof DelegatingPolicy) == false )
      {
         // Assume that the installed policy delegates to the DelegatingPolicy
         p = DelegatingPolicy.getInstance();
      }
View Full Code Here

  PermissionCollection perms = (PermissionCollection)
      AccessController.doPrivileged(new PrivilegedAction() {
    public Object run() {
        CodeSource codesource =
      new CodeSource(null, (Certificate[]) null);
        Policy p = java.security.Policy.getPolicy();
        if (p != null) {
      return p.getPermissions(codesource);
        } else {
      return new Permissions();
        }
    }
      });
View Full Code Here

        String policyProvider = System.getProperty("javax.security.jacc.policy.provider", JaccProvider.Policy.class.getName());
        try {
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            Class policyClass = Class.forName(policyProvider, true, classLoader);
            Policy policy = (Policy) policyClass.newInstance();
            policy.refresh();
            Policy.setPolicy(policy);
        } catch (Exception e) {
            throw new IllegalStateException("Could not install JACC Policy Provider: "+policyProvider, e);
        }
    }
View Full Code Here

            new AggregatePolicyProvider(initialGlobalPolicy);
        Policy.setPolicy(globalPolicy);
              logger.log(Level.FINEST,
            "Global policy set: {0}", globalPolicy);
          }
    Policy service_policy =
        getServicePolicyProvider(
            new PolicyFileProvider(desc.policy));
    Policy backstop_policy =
        getServicePolicyProvider(initialGlobalPolicy);
                LoaderSplitPolicyProvider split_service_policy =
                    new LoaderSplitPolicyProvider(
                        cl, service_policy, backstop_policy);
    /* Grant "this" code enough permission to do its work
View Full Code Here

            return path.toString();
        }
    }
   
    static Policy getServicePolicyProvider(Policy service_policy) throws Exception {
        Policy servicePolicyWrapper = null;
        if (servicePolicyProvider != null) {
       Class sp = Class.forName(servicePolicyProvider);
      logger.log(Level.FINEST,
          "Obtained custom service policy implementation class: {0}", sp);
      Constructor constructor =
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

        PermissionCollection perms = (PermissionCollection)
                AccessController.doPrivileged(new PrivilegedAction() {
                    public Object run() {
                        CodeSource cs =
                                new CodeSource(null, (Certificate []) null);
                        Policy policy = Policy.getPolicy();

                        if (policy != null) {
                            return policy.getPermissions(cs);
                        }
                        return new Permissions();
                    }
                });
View Full Code Here

                return testImpl();
            } else {
                // Emulate calling from restricted code. We create a
                // calling context with only the permission to read
                // the file.
                Policy policy = Policy.getPolicy();
                URL classesURL = (new File("classes")).toURL();
                CodeSource cs = new CodeSource(classesURL, null);
                PermissionCollection permissionsOrig
                    = policy.getPermissions(cs);
                Permissions permissions = new Permissions();
                Enumeration iter = permissionsOrig.elements();
                while (iter.hasMoreElements()) {
                    Permission p = (Permission)iter.nextElement();
                    if (!(p instanceof RuntimePermission)) {
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.