Package org.jboss.security.authorization.modules.ejb

Examples of org.jboss.security.authorization.modules.ejb.EJBPolicyModuleDelegate.authorize()


      resource.setPrincipal(new SimplePrincipal("AuthenticatedPrincipal"));
      resource.setEjbMethod(DummyClass.class.getDeclaredMethods()[0]);
      resource.setEjbName(DummyClass.class.getCanonicalName());
      resource.setEjbMethodRoles( getRoleGroup(new String[] {"gooduser"}) );
     
      assertEquals(AuthorizationContext.PERMIT,epmd.authorize(resource,
            new Subject(),
            getRoleGroup(new String[]{"gooduser", "validuser" })) );
   }
  
   /**
 
View Full Code Here


      resource.setPrincipal(new SimplePrincipal("AuthenticatedPrincipal"));
      resource.setEjbMethod(DummyClass.class.getDeclaredMethods()[0]);
      resource.setEjbName(DummyClass.class.getCanonicalName());
      resource.setEjbMethodRoles( getRoleGroup(new String[] {"gooduser"}) );
     
      int res = epmd.authorize(resource, new Subject(), getRoleGroup(new String[]{"baduser"}));
     
      assertEquals(AuthorizationContext.DENY, res);
   }
  
   /**
 
View Full Code Here

      resource.setPrincipal(new SimplePrincipal("AuthenticatedPrincipal"));
      resource.setEjbMethod(DummyClass.class.getDeclaredMethods()[0]);
      resource.setEjbName(DummyClass.class.getCanonicalName());
      resource.setEjbMethodRoles( getRoleGroup(new String[] {AnybodyPrincipal.ANYBODY}) );
     
      int res = epmd.authorize(resource, new Subject(), getRoleGroup(new String[]{"baduser"}));
      assertEquals(AuthorizationContext.PERMIT, res);
   }
  
   /**
    * Test that in the absence of method roles sent, the authorization fails
View Full Code Here

      EJBResource resource = new EJBResource(cmap);
      resource.setPrincipal(new SimplePrincipal("AuthenticatedPrincipal"));
      resource.setEjbMethod(DummyClass.class.getDeclaredMethods()[0]);
      resource.setEjbName(DummyClass.class.getCanonicalName());
     
      int res = epmd.authorize(resource, new Subject(), getRoleGroup(new String[]{"baduser"}));
      assertEquals(AuthorizationContext.DENY, res);
   }
  
   /**
    * Test EJBContext.isCallerInRole (Success Case)
View Full Code Here

      Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
      roleRefSet.add(new SecurityRoleRef("employee", "gooduser"));
      resource.setSecurityRoleReferences(roleRefSet);
     
      int result = epmd.authorize(resource,
            new Subject(),
            getRoleGroup(new String[]{"gooduser", "validuser" }));
     
      assertEquals(AuthorizationContext.PERMIT, result);
   }
View Full Code Here

      Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
      roleRefSet.add(new SecurityRoleRef("employee", "baduser")); //Bad user
      resource.setSecurityRoleReferences(roleRefSet);
     
      int result = epmd.authorize(resource,
            new Subject(),
            getRoleGroup(new String[]{"gooduser", "validuser" }));
     
      assertEquals(AuthorizationContext.DENY, result);
   }
View Full Code Here

      Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
      roleRefSet.add(new SecurityRoleRef("employee", "gooduser"))
      resource.setSecurityRoleReferences(roleRefSet);

      int result = epmd.authorize(resource,
            new Subject(),
            getRoleGroup(new String[]{"gooduser", "validuser" }));
      assertEquals(AuthorizationContext.PERMIT, result);
   }
  
View Full Code Here

      roleRefSet.add(new SecurityRoleRef("employee", "baduser")); //Bad user
      resource.setSecurityRoleReferences(roleRefSet);
     
      try
      {
          epmd.authorize(resource,
               new Subject(),
               getRoleGroup(new String[]{"gooduser", "validuser" }));
          fail("Should have thrown a RuntimeException due to ejb 1.1 restrictions");
      }
      catch(RuntimeException e)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.