Examples of EJBXACMLPolicyModuleDelegate


Examples of org.jboss.security.authorization.modules.ejb.EJBXACMLPolicyModuleDelegate

      setSecurityConfiguration();
   }

   public void testValidEJBPolicyContextHandler() throws Exception
   {
      EJBXACMLPolicyModuleDelegate pc = new EJBXACMLPolicyModuleDelegate();

      PolicyRegistration policyRegistration = new JBossPolicyRegistration();
      registerPolicy(policyRegistration);
      EJBResource er = getEJBResource(policyRegistration);
     
      er.setPolicyContextID(contextID);
      int res = pc.authorize(er, new Subject(), getRoleGroup());
      assertEquals(AuthorizationContext.PERMIT, res);
   }
View Full Code Here

Examples of org.jboss.security.authorization.modules.ejb.EJBXACMLPolicyModuleDelegate

      assertEquals(AuthorizationContext.PERMIT, res);
   }
  
   public void testInvalidEJBPolicyContextHandler() throws Exception
   {
      EJBXACMLPolicyModuleDelegate pc = new EJBXACMLPolicyModuleDelegate();
     
      PolicyRegistration policyRegistration = new JBossPolicyRegistration();
      registerPolicy(policyRegistration);
      EJBResource er = getEJBResource(policyRegistration);
     
      er.setPolicyContextID(contextID);
      er.setPrincipal(new SimplePrincipal("baduser"));

      int res = pc.authorize(er, new Subject(), getRoleGroup());
      assertEquals(AuthorizationContext.DENY, res);
   }
View Full Code Here

Examples of org.jboss.security.authorization.modules.ejb.EJBXACMLPolicyModuleDelegate

      assertEquals(AuthorizationContext.DENY, res);
   }
  
   public void testEJBContextIsCallerInRoleValid() throws Exception
   {
      EJBXACMLPolicyModuleDelegate pc = new EJBXACMLPolicyModuleDelegate();
     
      PolicyRegistration policyRegistration = new JBossPolicyRegistration();
      registerPolicy(policyRegistration);
      EJBResource er = getEJBResource(policyRegistration);
     
      er.setPolicyContextID(contextID);
      er.setPrincipal(new SimplePrincipal("baduser"));
      er.getMap().put(ResourceKeys.ROLEREF_PERM_CHECK, true);
      er.getMap().put(ResourceKeys.ROLENAME, "employee");

      Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
      roleRefSet.add(this.getSecurityRoleRef("employee", "ProjectUser"));
      er.setSecurityRoleReferences(roleRefSet);
     
      int res = pc.authorize(er, new Subject(), getRoleGroup());
      assertEquals(AuthorizationContext.PERMIT, res);
   }
View Full Code Here

Examples of org.jboss.security.authorization.modules.ejb.EJBXACMLPolicyModuleDelegate

      assertEquals(AuthorizationContext.PERMIT, res);
   }
  
   public void testEJBContextIsCallerInRoleInvalid() throws Exception
   {
      EJBXACMLPolicyModuleDelegate pc = new EJBXACMLPolicyModuleDelegate();
     
      PolicyRegistration policyRegistration = new JBossPolicyRegistration();
      registerPolicy(policyRegistration);
      EJBResource er = getEJBResource(policyRegistration);
     
      er.setPolicyContextID(contextID);
      er.setPrincipal(new SimplePrincipal("baduser"));
      er.getMap().put(ResourceKeys.ROLEREF_PERM_CHECK, true);
      er.getMap().put(ResourceKeys.ROLENAME, "employee");

      Set<SecurityRoleRef> roleRefSet = new HashSet<SecurityRoleRef>();
      roleRefSet.add(this.getSecurityRoleRef("employee", "baduser"));
      er.setSecurityRoleReferences(roleRefSet);
     
      int res = pc.authorize(er, new Subject(), getRoleGroup());
      assertEquals(AuthorizationContext.DENY, res);
   }
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.