Package org.jboss.security.identity

Examples of org.jboss.security.identity.Role


         if (subject != null)
         {
            for(Principal p : subject.getPrincipals())
            {
               // TODO: not really true, but for the moment lets assume that the principal is also the role
               Role myRole = new SimpleRole(p.getName());
               if(methodRoles.containsRole(myRole))
                  return AuthorizationContext.PERMIT;
            }
         }
         if (ejbResource.getCallerRunAsIdentity() != null)
View Full Code Here


         " in the deployment descriptor for ejb " + this.ejbName);

      /*HashSet<Principal> set = new HashSet<Principal>();
      set.add(new SimplePrincipal(roleName));*/
     
      Role deploymentrole = new SimpleRole(roleName);

      boolean allowed = false;
      if (callerRunAs == null)
         allowed = principalRole.containsRole(deploymentrole);
         //allowed = am.doesUserHaveRole(ejbPrincipal, set);
View Full Code Here

            log.trace("no match found for security role " + roleName +
                  " in the deployment descriptor for ejb " + this.ejbName);
         }
      }
      Role deploymentrole = new SimpleRole(roleName);

      boolean allowed = false;
      if (callerRunAs == null)
         allowed = principalRole.containsRole(deploymentrole);
      else
View Full Code Here

         if(methodRoles.containsRole(SimpleRole.ANYBODY_ROLE))
            return AuthorizationContext.PERMIT;
         for(Principal p : subject.getPrincipals())
         {
            // TODO: not really true, but for the moment lets assume that the principal is also the role
            Role myRole = new SimpleRole(p.getName());
            if(methodRoles.containsRole(myRole))
               return AuthorizationContext.PERMIT;
         }
         return AuthorizationContext.DENY;
      }
View Full Code Here

public class RoleGroupUnitTestCase extends TestCase
{

   public void testAnybodyRole()
   {
      Role aRole = new SimpleRole("aRole");

      SimpleRoleGroup srg = new SimpleRoleGroup("Roles");
      srg.addRole(SimpleRole.ANYBODY_ROLE);
      assertTrue(srg.containsRole(aRole));
   }
View Full Code Here

            log.trace("no match found for security role " + roleName +
                  " in the deployment descriptor for ejb " + this.ejbName);
         }
      }
      Role deploymentrole = new SimpleRole(roleName);

      boolean allowed = false;
      if (callerRunAs == null)
         allowed = principalRole.containsRole(deploymentrole);
      else
View Full Code Here

      assertEquals("Role names are different", identity.getRole().getRoleName(), restored.getRole().getRoleName());
   }

   public void testReadIdentityWithRoleAndParent() throws Exception
   {
      Role parent = new SimpleRole("parent");
      Role role = new SimpleRole("testRole", parent);
      Identity identity = IdentityFactory.createIdentityWithRole(identityName, role);
      assertFalse("File already exists", file.exists());
      assertNotNull("Failed to persist", ps.persistIdentity(identity));
      assertTrue("File was not created", file.exists());
View Full Code Here

      assertTrue(RoleFactory.createRoleGroup("myRoleGroup") instanceof SimpleRoleGroup);
   }

   public void testSimpleRoleContains() throws Exception
   {
      Role firstRole = new SimpleRole("A");
      Role secondRole = new SimpleRole("B");

      assertTrue(firstRole.containsAll(firstRole));
      assertFalse(firstRole.containsAll(secondRole));
      assertFalse(secondRole.containsAll(firstRole));
   }
View Full Code Here

      this.resources = new Resource[2];
      for (int i = 0; i < resources.length; i++)
         resources[i] = new TestResource(i, "Test Resource " + i);

      // Identity 'john' has two roles (role1 and role2).
      Role role1 = RoleFactory.createRole("role1");
      Role role2 = RoleFactory.createRole("role2");
      RoleGroup roleGroup = RoleFactory.createRoleGroup("RoleGroup");
      roleGroup.addRole(role1);
      roleGroup.addRole(role2);
      this.identity = IdentityFactory.createIdentityWithRole("john", roleGroup);
View Full Code Here

TOP

Related Classes of org.jboss.security.identity.Role

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.