Package org.jboss.security

Examples of org.jboss.security.SimpleGroup


      char roleGroupSeperator, AbstractServerLoginModule aslm)
   {
      Logger log = aslm.log;     
      boolean trace = log.isTraceEnabled();
      Enumeration<?> users = roles.propertyNames();
      SimpleGroup rolesGroup = new SimpleGroup("Roles");
      ArrayList<Group> groups = new ArrayList<Group>();
      groups.add(rolesGroup);
      while (users.hasMoreElements() && targetUser != null)
      {
         String user = (String) users.nextElement();
         String value = roles.getProperty(user);
         if( trace )
            log.trace("Checking user: "+user+", roles string: "+value);
         // See if this entry is of the form targetUser[.GroupName]=roles
         //JBAS-3742 - skip potential '.' in targetUser
         int index = user.indexOf(roleGroupSeperator, targetUser.length());
         boolean isRoleGroup = false;
         boolean userMatch = false;
         if (index > 0 && targetUser.regionMatches(0, user, 0, index) == true)
            isRoleGroup = true;
         else
            userMatch = targetUser.equals(user);

         // Check for username.RoleGroup pattern
         if (isRoleGroup == true)
         {
            String groupName = user.substring(index + 1);
            if (groupName.equals("Roles"))
            {
               if( trace )
                  log.trace("Adding to Roles: "+value);
               parseGroupMembers(rolesGroup, value, aslm);
            }
            else
            {
               if( trace )
                  log.trace("Adding to "+groupName+": "+value);
               SimpleGroup group = new SimpleGroup(groupName);
               parseGroupMembers(group, value, aslm);
               groups.add(group);
            }
         }
         else if (userMatch == true)
View Full Code Here


         if( subjectGroup instanceof NestableGroup )
         {
            /* A NestableGroup only allows Groups to be added to it so we
            need to add a SimpleGroup to subjectRoles to contain the roles
            */
            SimpleGroup tmp = new SimpleGroup("Roles");
            subjectGroup.addMember(tmp);
            subjectGroup = tmp;
         }
         // Copy the group members to the Subject group
         Enumeration<? extends Principal> members = group.members();
View Full Code Here

         }
      }
      // If we did not find a group create one
      if( roles == null )
      {
         roles = new SimpleGroup(name);
         principals.add(roles);
      }
      return roles;
   }
View Full Code Here

      return isValid;
   }

   protected Group[] getRoleSets() throws LoginException
   {
      Group[] roleSets = {new SimpleGroup("Roles")};
      if( guestOnly == false )
         roleSets[0].addMember(new SimplePrincipal("user"));
      roleSets[0].addMember(new SimplePrincipal("guest"));
      return roleSets;
   }
View Full Code Here

    }

    public void testEquals()
    {
        System.out.println("testEquals");
        SimpleGroup CallerPrincipal = new SimpleGroup("Roles");
        assertTrue(group.equals(CallerPrincipal));
    }
View Full Code Here

    }

    public void testNobody()
    {
        System.out.println("testNobody");
        SimpleGroup nobodyGroup = new SimpleGroup("<NOBODY>");
        SimplePrincipal nobody = new SimplePrincipal("<NOBODY>");
        nobodyGroup.addMember(nobody);
        group.addMember(nobodyGroup);
        boolean isMember = group.isMember(NobodyPrincipal.NOBODY_PRINCIPAL);
        assertTrue("NobodyPrincipal.isMember == false", isMember == false);
    }
View Full Code Here

   }

   @Override
   protected Group[] getRoleSets()
   {
      SimpleGroup roles = new SimpleGroup("Roles");
      Group[] roleSets = {roles};
      roles.addMember(new SimplePrincipal("TestRole"));
      roles.addMember(new SimplePrincipal("Role2"));
      return roleSets;
   }
View Full Code Here

  public static class TestLoginModule extends UsernamePasswordLoginModule
  {
     @Override
   protected Group[] getRoleSets()
     {
        SimpleGroup roles = new SimpleGroup("Roles");
        Group[] roleSets = {roles};
        roles.addMember(new SimplePrincipal("TestRole"));
        roles.addMember(new SimplePrincipal("Role2"));
        return roleSets;
     }
View Full Code Here

         if( subjectGroup instanceof NestableGroup)
         {
            /* A NestableGroup only allows Groups to be added to it so we
            need to add a SimpleGroup to subjectRoles to contain the roles
            */
            SimpleGroup tmp = new SimpleGroup("Roles");
            subjectGroup.addMember(tmp);
            subjectGroup = tmp;
         }
         // Copy the group members to the Subject group
         Enumeration<? extends Principal> members = group.members();
         while( members.hasMoreElements() )
         {
            Principal role = (Principal) members.nextElement();
            subjectGroup.addMember(role);
         }
      }
      // add the CallerPrincipal group if none has been added in getRoleSets
      Group callerGroup = new SimpleGroup(SecurityConstants.CALLER_PRINCIPAL_GROUP);
      callerGroup.addMember(identity);
      principals.add(callerGroup);
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      Principal userPrincipal = getPrincipal(subject);
      sc.getUtil().createSubjectInfo(userPrincipal, credentials, subject);
      List<String> rolesAsStringList = new ArrayList<String>();
View Full Code Here

         }
      }
      // If we did not find a group create one
      if( roles == null )
      {
         roles = new SimpleGroup(name);
         principals.add(roles);
      }
      return roles;
   }
View Full Code Here

TOP

Related Classes of org.jboss.security.SimpleGroup

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.