Package java.security

Examples of java.security.ProtectionDomain$Key


         results.append(Integer.toHexString(iface.hashCode()));
         results.append(")");
         ClassLoader loader = ifaces[i].getClassLoader();
         results.append("\n++++ClassLoader: ");
         results.append(loader);
         ProtectionDomain pd = ifaces[i].getProtectionDomain();
         CodeSource cs = pd.getCodeSource();
         if( cs != null )
         {
            results.append("\n++++CodeSource: ");
            results.append(cs);
         }
View Full Code Here


         {
            allPermissions.add(permission);
         }
      }
      ProtectionDomain[] protectionDomains =
         new ProtectionDomain[]{new ProtectionDomain(new CodeSource(getCodeSource(),
            (java.security.cert.Certificate[])null), allPermissions)};
      return AccessController.doPrivileged(action, new AccessControlContext(protectionDomains));
   }
View Full Code Here

        if (bytecode != null) {
            // Use a protectionDomain to associate the codebase with the
            // class.

            // Associate the codebase with the class with a protection domain
            ProtectionDomain pd = (ProtectionDomain) protectionDomainMap.get(bytecode.codebase);
            if (pd == null) {
                ProtectionDomain cd = this.getClass().getProtectionDomain();
                URL url = cd.getCodeSource().getLocation();
                try {
                    url = new URL("jar:" + url + "!/" + bytecode.codebase);
                } catch (MalformedURLException mux) {
                    mux.printStackTrace(System.out);
                }

                CodeSource source = new CodeSource(url, (CodeSigner[]) null);
                pd = new ProtectionDomain(source, null, this, null);
                protectionDomainMap.put(bytecode.codebase, pd);
            }
            return defineClass(name, bytecode.bytes, 0, bytecode.length, pd);
        }
        throw new ClassNotFoundException(name);
View Full Code Here

            if (record) {
                record(bytecode);
            }
            // Use a protectionDomain to associate the codebase with the
            // class.
            ProtectionDomain pd = (ProtectionDomain) pdCache.get(bytecode.codebase);
            if (pd == null) {
                ProtectionDomain cd = JarClassLoader.class.getProtectionDomain();
                URL url = cd.getCodeSource().getLocation();
                try {
                    url = new URL("jar:" + url + "!/" + bytecode.codebase);
                } catch (MalformedURLException mux) {
                    mux.printStackTrace(System.out);
                }

                CodeSource source = new CodeSource(url, null);
                pd = new ProtectionDomain(source, null, this, null);
                pdCache.put(bytecode.codebase, pd);
            }

            // Do it the simple way.
            byte bytes[] = bytecode.bytes;
View Full Code Here

        Set principalsSet = caller.getPrincipals();
        principals = new Principal[ principalsSet.size() ];
        principalsSet.toArray( principals );
      }

      ProtectionDomain pd = new ProtectionDomain( ejbCS, null, null, principals );
      if ( policy.implies( pd, methodPerm ) == false ) {
        String msg = "Denied: " + methodPerm + ", caller=" + caller;
        SecurityException e = new SecurityException( msg );
        throw e;
      }
View Full Code Here

    // Allow user to only read any file in docs directory
    final String aHome = System.getenv("ACCUMULO_HOME");
    PermissionCollection pc = new Permissions();
    pc.add(new FilePermission(aHome + "/docs/-", "read"));
   
    AccessControlContext acc = new AccessControlContext(new ProtectionDomain[] {new ProtectionDomain(null, pc)});
   
    IOException e = AccessController.doPrivileged(new PrivilegedAction<IOException>() {
     
      @Override
      public IOException run() {
View Full Code Here

    private AccessControlContext createAccessControlContext() {
        return new AccessControlContext(AccessController.getContext(),
                new DomainCombiner() {              
                    public ProtectionDomain[] combine(ProtectionDomain[] arg0,
                                                      ProtectionDomain[] arg1) {                   
                        return new ProtectionDomain[] { new ProtectionDomain(null, null) {                       
                            public boolean implies(Permission permission) {                                                          
                                return getBundleContextForServiceLookup().getBundle().hasPermission(permission);
                            }
                        }
                    };
View Full Code Here

        
        //
        // Create the Rhino ProtectionDomain
        // and AccessControlContext
        //
        ProtectionDomain rhinoProtectionDomain
            = new ProtectionDomain(codeSource,
                                   getPermissions(codeSource));
       
        rhinoAccessControlContext
            = new AccessControlContext(new ProtectionDomain[]{
                rhinoProtectionDomain});
View Full Code Here

        private ProtectionDomain[] optimize(ProtectionDomain[] domains) {
            if (domains == null || domains.length == 0) {
                return null;
            }
            ProtectionDomain[] optimized = new ProtectionDomain[domains.length];
            ProtectionDomain pd;
            int num = 0;
            for (int i = 0; i < domains.length; i++) {
                if ((pd = domains[i]) != null) {
                    boolean found = false;
                    for (int j = 0; j < num && !found; j++) {
View Full Code Here

        {
            if (m_state == Bundle.UNINSTALLED)
            {
                return null;
            }
            final ProtectionDomain pd = this.getProtectionDomain();
            if (pd == null)
            {
                return null;
            }
            return (A) new AccessControlContext(new ProtectionDomain[] {pd});
View Full Code Here

TOP

Related Classes of java.security.ProtectionDomain$Key

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.