Package org.jboss.naming

Examples of org.jboss.naming.JndiPermission


               Name fullName = (Name) prefix.clone();
               fullName.addAll(name);
               SecurityManager sm = getSecurityManager();
               if(sm != null)
               {
                  JndiPermission perm = new JndiPermission(fullName, JndiPermission.BIND);
                  sm.checkPermission(perm);
               }

               Binding newb = setBinding(name,obj,className);
               // Notify event listeners
View Full Code Here


            Name fullName = (Name) prefix.clone();
            String comp = name.get(0);
            fullName.add(comp);
            if(sm != null)
            {
               JndiPermission perm = new JndiPermission(fullName, JndiPermission.REBIND);
               sm.checkPermission(perm);
            }
           
            Binding oldb = table.get(comp);
            Binding newb = setBinding(name,obj,className);
View Full Code Here

               SecurityManager sm = getSecurityManager();
               Name fullName = (Name) prefix.clone();
               fullName.addAll(name);
               if(sm != null)
               {
                  JndiPermission perm = new JndiPermission(fullName, JndiPermission.UNBIND);
                  sm.checkPermission(perm);
               }
              
               Binding newb = null;
               Binding oldb = removeBinding(name);
View Full Code Here

      if (name.isEmpty())
      {
         SecurityManager sm = getSecurityManager();
         if(sm != null)
         {
            JndiPermission perm = new JndiPermission(prefix, JndiPermission.LOOKUP);
            sm.checkPermission(perm);
         }
        
         // Return this
         result = new NamingContext(null, (Name)(prefix.clone()), getRoot());
      }
      else if (name.size() > 1)
      {
         // Recurse to find correct context
//         System.out.println("lookup#"+name+"#");
        
         Object ctx = getObject(name);
         if (ctx instanceof NamingServer)
         {
            result = ((NamingServer)ctx).lookup(name.getSuffix(1));
         }
         else if (ctx instanceof Reference)
         {
            // Federation
            if (((Reference)ctx).get("nns") != null)
            {
               CannotProceedException cpe = new CannotProceedException();
               cpe.setResolvedObj(ctx);
               cpe.setRemainingName(name.getSuffix(1));
               throw cpe;
            }
           
            result = new ResolveResult(ctx, name.getSuffix(1));
         } else
         {
            throw new NotContextException();
         }
      }
      else
      {
         // Get object to return
         if (name.get(0).equals(""))
         {
            SecurityManager sm = getSecurityManager();
            if(sm != null)
            {
               JndiPermission perm = new JndiPermission(prefix, JndiPermission.LOOKUP);
               sm.checkPermission(perm);
            }
            result = new NamingContext(null, (Name)(prefix.clone()), getRoot());
         }
         else
         {
//            System.out.println("lookup "+name);
            SecurityManager sm = getSecurityManager();
            Name fullName = (Name)(prefix.clone());
            fullName.addAll(name);
            if(sm != null)
            {
               JndiPermission perm = new JndiPermission(fullName, JndiPermission.LOOKUP);
               sm.checkPermission(perm);
            }
           
            Object res = getObject(name);
           
View Full Code Here

      if (name.isEmpty())
      {
         SecurityManager sm = getSecurityManager();
         if(sm != null)
         {
            JndiPermission perm = new JndiPermission(prefix, JndiPermission.LIST);
            sm.checkPermission(perm);
         }

         ArrayList<NameClassPair> list = new ArrayList<NameClassPair>();
         for(Binding b : table.values())
View Full Code Here

      if (name.isEmpty())
      {
         SecurityManager sm = getSecurityManager();
         if(sm != null)
         {
            JndiPermission perm = new JndiPermission(prefix, JndiPermission.LIST_BINDINGS);
            sm.checkPermission(perm);
         }

         Collection<Binding> bindings = table.values();
         Collection<Binding> newBindings = new ArrayList<Binding>(bindings.size());
View Full Code Here

            Name fullName = (Name) prefix.clone();
            fullName.addAll(name);
            SecurityManager sm = getSecurityManager();
            if(sm != null)
            {
               JndiPermission perm = new JndiPermission(fullName, JndiPermission.CREATE_SUBCONTEXT);
               sm.checkPermission(perm);
            }
            NamingServer subContext = createNamingServer(fullName, this);
            subCtx = new NamingContext(null, fullName, getRoot());
            setBinding(name, subContext, NamingContext.class.getName());
View Full Code Here

      qsm.clearPerms();
      System.setSecurityManager(qsm);

      HashSet<JndiPermission> expectedPerms = new HashSet<JndiPermission>();
      // expected doOps() permissions
      expectedPerms.add(new JndiPermission("path1", "createSubcontext"));
      expectedPerms.add(new JndiPermission("path1", "lookup"));
      expectedPerms.add(new JndiPermission("path1", "list"));
      expectedPerms.add(new JndiPermission("path1", "listBindings"));
      expectedPerms.add(new JndiPermission("path1/x", "bind"));
      expectedPerms.add(new JndiPermission("path1/x", "rebind"));
      expectedPerms.add(new JndiPermission("path1/x", "unbind"));
      expectedPerms.add(new JndiPermission("path1", "unbind"));
      doOps();
      // expected doBadOps() permissions
      expectedPerms.add(new JndiPermission("path2", "createSubcontext"));
      expectedPerms.add(new JndiPermission("path1x", "createSubcontext"));
      expectedPerms.add(new JndiPermission("path1x", "rebind"));
      expectedPerms.add(new JndiPermission("path1x", "lookup"));
      expectedPerms.add(new JndiPermission("path1x", "list"));
      expectedPerms.add(new JndiPermission("path1x", "listBindings"));
      expectedPerms.add(new JndiPermission("path1x/x", "bind"));
      expectedPerms.add(new JndiPermission("path1x/x", "rebind"));
      expectedPerms.add(new JndiPermission("path1x", "unbind"));
      doBadOps(false);

      List<Permission> perms = qsm.getPerms();
      for(Permission p : perms)
      {
View Full Code Here

   {
      TestSecurityManager tsm = new TestSecurityManager();
      /*
       The permissions that should be needed
       */
      tsm.addPermission(new JndiPermission("path1", "createSubcontext,lookup,list,listBindings,unbind"));
      tsm.addPermission(new JndiPermission("path1x", "createSubcontext,unbind"));
      tsm.addPermission(new JndiPermission("path1/*", "list,listBindings,lookup"));
      tsm.addPermission(new JndiPermission("path1/x", "bind,rebind,unbind"));
      tsm.addPermission(new RuntimePermission("setSecurityManager"));
      tsm.addPermission(new FilePermission("<<ALL FILES>>", "read"));
      tsm.addPermission(new RuntimePermission("createClassLoader"));
      tsm.addPermission(new ReflectPermission("suppressAccessChecks"));
      tsm.addPermission(new SerializablePermission("enableSubstitution"));
View Full Code Here

    */
   public void testAllPermission()
      throws Exception
   {
      TestSecurityManager tsm = new TestSecurityManager();
      tsm.addPermission(new JndiPermission("<<ALL BINDINGS>>", "*"));
      tsm.addPermission(new RuntimePermission("setSecurityManager"));
      tsm.addPermission(new FilePermission("<<ALL FILES>>", "read"));
      tsm.addPermission(new RuntimePermission("createClassLoader"));
      tsm.addPermission(new ReflectPermission("suppressAccessChecks"));
      tsm.addPermission(new SerializablePermission("enableSubstitution"));
View Full Code Here

TOP

Related Classes of org.jboss.naming.JndiPermission

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.