Package org.jboss.security.identity.plugins

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


      AbstractEJBAuthorizationHelper authorizationHelper = SecurityHelperFactory.getEJBAuthorizationHelper(sc);
      authorizationHelper.setPolicyRegistration(container.getPolicyRegistration());

      isAuthorized = SecurityActions.authorize(authorizationHelper, ejbName, ejbMethod, mi.getPrincipal(),
            mi.getType().toInterfaceString(), ejbCS, caller, callerRunAsIdentity, container.getJaccContextID(),
            new SimpleRoleGroup(methodRoles));

      String msg = "Denied: caller with subject=" + caller + " and security context post-mapping roles="
            + SecurityActions.getRolesFromSecurityContext(currentSC) + ": ejbMethod=" + ejbMethod;
      if (!isAuthorized)
         throw new SecurityException(msg);
View Full Code Here


                             iface,
                             ejbCS,
                             sc.getUtil().getSubject(),
                             callerRunAs,
                             contextID,
                             new SimpleRoleGroup(methodRoles));
            if(!isAuthorized)
               throw new EJBAccessException("Caller unauthorized");
        
         return invocation.invokeNext();
      }
View Full Code Here

   public void testCtrWithPrincipalSet()
   {
      Set<Principal> principalSet = new HashSet<Principal>();
      principalSet.add(new SimplePrincipal("aRole"));
     
      SimpleRoleGroup sr = new SimpleRoleGroup(principalSet);
      assertNotNull(sr);
      assertEquals("aRole",sr.getRoles().get(0).getRoleName());
   }
View Full Code Here

*/
public class SecurityTestUtil
{  
   public static 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

      return srg;
   }
  
   public static RoleGroup getRoleGroup(String rolename)
   {
      SimpleRoleGroup srg = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      srg.getRoles().add(new SimpleRole(rolename));
      return srg;
   }
View Full Code Here

         callerPrincipal = new SimplePrincipal(callerRunAs.getName());
      }
     
      RoleGroup roles = this.getCurrentRoles(callerPrincipal, authenticatedSubject, sc);
      if(roles == null)
         roles = new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
      return roles;
  
View Full Code Here

  
   private RoleGroup getRoleGroup(Group roleGroup)
   {
      if(roleGroup == null)
         throw new IllegalArgumentException("roleGroup is null");
      SimpleRoleGroup srg = new SimpleRoleGroup(roleGroup.getName());
      Enumeration<? extends Principal> principals = roleGroup.members();
      while(principals.hasMoreElements())
      {
         srg.getRoles().add(new SimpleRole(principals.nextElement().getName()));
      }
      return srg; 
   }
View Full Code Here

         throw new IllegalArgumentException("resource has null context map");
   }
  
   private RoleGroup getEmptyRoleGroup()
   {
      return new SimpleRoleGroup(SecurityConstants.ROLES_IDENTIFIER);
   }
View Full Code Here

   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

      assertTrue(srg.containsRole(aRole));
   }

   public void testNestedRoles()
   {
      SimpleRoleGroup srg = new SimpleRoleGroup("nested");
      srg.addRole(new SimpleRole("aRole"));
      srg.addRole(new SimpleRole("bRole"));

      SimpleRoleGroup methodRoles = new SimpleRoleGroup("Roles");
      methodRoles.addRole(srg);

      //Create user role now
      SimpleRoleGroup userRole = new SimpleRoleGroup("Roles");
      userRole.addRole(new SimpleRole("aRole"));
      methodRoles.containsAtleastOneRole(userRole);
   }
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.