Package org.jboss.security.identity.plugins

Examples of org.jboss.security.identity.plugins.SimpleRoleGroup


      else
      {
         if(callerRunAs instanceof RunAsIdentity)
         {
            RunAsIdentity callerRunAsIdentity = (RunAsIdentity) callerRunAs;
            SimpleRoleGroup srg = new SimpleRoleGroup(callerRunAsIdentity.getRunAsRoles());
            allowed = srg.containsRole(deploymentrole);
         }
      }
      return allowed ? AuthorizationContext.PERMIT : AuthorizationContext.DENY;
   }
View Full Code Here


    * Return a RoleGroup of Run-As roles
    * @return
    */
   public RoleGroup getRunAsRolesAsRoleGroup()
   {
      return new SimpleRoleGroup(runAsRoles);
   }
View Full Code Here

      policyRegistration.registerPolicy(contextID, PolicyRegistration.XACML, is);
   }
  
   private RoleGroup getRoleGroup()
   {
      SimpleRoleGroup srg = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      srg.getRoles().add(new SimpleRole("ProjectUser"));
      return srg;
   }
View Full Code Here

      policyRegistration.registerPolicy(contextID, PolicyRegistration.XACML, is);
   }
  
   private RoleGroup getRoleGroup()
   {
      SimpleRoleGroup srg = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      srg.getRoles().add(new SimpleRole("ServletUserRole"));
      return srg;
   }
View Full Code Here

    * @param roles
    * @return
    */
   private RoleGroup getRoleGroup(String[] roles)
   {
      SimpleRoleGroup srg = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);

      List<Role> roleList = srg.getRoles();
     
      for(String role:roles)
      {
         roleList.add(new SimpleRole(role));  
      }
View Full Code Here

     
      HashMap<String,Object> map = new HashMap<String,Object>();
      map.put(SecurityConstants.PRINCIPAL_IDENTIFIER, principal);
      map.put(SecurityConstants.DEPLOYMENT_PRINCIPAL_ROLES_MAP, rolesMap);
     
      RoleGroup grp = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      grp.addRole(new SimpleRole("oldRole"));

      MappingContext<RoleGroup> mc = sc.getMappingManager().getMappingContext(RoleGroup.class);
      assertNotNull("Mapping Context is not null", mc);
      mc.performMapping(map, grp);
     
      grp = (RoleGroup) mc.getMappingResult().getMappedObject();
     
      assertFalse("oldRole does not exist", grp.containsRole(new SimpleRole("oldRole")));
      assertTrue("t1 exists?",grp.containsRole(new SimpleRole("t1")));
      assertTrue("t2 exists?",grp.containsRole(new SimpleRole("t2")));
   }
View Full Code Here

   }
  
   public void testRoles()
   {
      JBossSecurityContext sc = this.getSC("other");
      SimpleRoleGroup roleGroup = new SimpleRoleGroup("Roles");
      roleGroup.addRole(new SimpleRole("testRole"));
      sc.getUtil().setRoles(roleGroup);
     
      //Retrieve the roles
      RoleGroup scRoles = sc.getUtil().getRoles();
      assertNotNull(scRoles);
View Full Code Here

      am.authorize(wr);//This should just pass as the default module PERMITS all
   }
  
   private RoleGroup getRoleGroup()
   {
      RoleGroup rg = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      rg.addRole(new SimpleRole("ServletUserRole"));
      return rg;
   }
View Full Code Here

      return ap;
   }
  
   private RoleGroup getRoleGroup()
   {
      RoleGroup rg = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      rg.getRoles().add(new SimpleRole("ServletUserRole"));
      return rg;
   }
View Full Code Here

      assertFalse(secondRole.containsAll(firstRole));
   }

   public void testSimpleRoleGroupContains() throws Exception
   {
      SimpleRoleGroup firstRoleGroup = new SimpleRoleGroup("firstrg");
      firstRoleGroup.getRoles().add(new SimpleRole("A"));
      firstRoleGroup.getRoles().add(new SimpleRole("B"));
      firstRoleGroup.getRoles().add(new SimpleRole("C"));

      SimpleRoleGroup secondRoleGroup = new SimpleRoleGroup("secondrg");
      secondRoleGroup.getRoles().add(new SimpleRole("A"));
      secondRoleGroup.getRoles().add(new SimpleRole("B"));

      assertTrue(firstRoleGroup.containsAll(firstRoleGroup));
      assertTrue(secondRoleGroup.containsAll(secondRoleGroup));
      assertTrue(firstRoleGroup.containsAll(secondRoleGroup));
      assertFalse(secondRoleGroup.containsAll(firstRoleGroup));

      assertTrue(firstRoleGroup.containsAtleastOneRole(secondRoleGroup));
      assertTrue(secondRoleGroup.containsAtleastOneRole(firstRoleGroup));
   }
View Full Code Here

TOP

Related Classes of org.jboss.security.identity.plugins.SimpleRoleGroup

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.