Package org.jboss.security

Examples of org.jboss.security.SimpleGroup


      while(iter.hasNext())
      {
         Principal p = (Principal)iter.next();
         if(p instanceof SimpleGroup)
         {
            SimpleGroup sg = (SimpleGroup)p;
            ranAsserts = true;
            assertTrue("testRole exists?", sg.isMember(new SimplePrincipal("testRole")));
            assertTrue("testRole2 exists?", sg.isMember(new SimplePrincipal("testRole2")));
            assertTrue("Role4 exists?", sg.isMember(new SimplePrincipal("Role4")));
            if(replaceRole)
              assertFalse("Role3 does not exist?", sg.isMember(new SimplePrincipal("Role3")));
            else
               assertTrue("Role3 exists?", sg.isMember(new SimplePrincipal("Role3")));
         }
      }
      assertTrue("Ran Asserts?",ranAsserts);
   }
View Full Code Here


   public static class TestLoginModule extends UsernamePasswordLoginModule
   {
      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

    * @throws LoginException
    */
   protected Group[] getRoleSets() throws LoginException
   {
      Group[] groups = super.getRoleSets();
      Group[] newGroups = {new SimpleGroup("Roles")};
      Group roles = null;
      Group newRoles = newGroups[0];
      for(int n = 0; n < groups.length; n ++)
      {
         Group g = groups[n];
View Full Code Here

      public void addRole(String roleName, String roleGroup)
      {
         Group group = (Group) roleGroups.get(roleGroup);
         if( group == null )
         {
            group = new SimpleGroup(roleGroup);
            roleGroups.put(roleGroup, group);
         }
         SimplePrincipal role = new SimplePrincipal(roleName);
         group.addMember(role);
      }
View Full Code Here

   protected Group[] getRoleSets() throws LoginException
   {
      try
      {
         // The declarative permissions
         Group roles = new SimpleGroup("Roles");
         // The caller identity
         Group callerPrincipal = new SimpleGroup("CallerPrincipal");
         Group[] groups = {roles, callerPrincipal};
         log.info("Getting roles for user=" + getUsername());
         // Add the Echo role
         roles.addMember(new SimplePrincipal("Echo"));
         // Add the custom principal for the caller
         callerPrincipal.addMember(caller);
         return groups;
      }
      catch (Exception e)
      {
         log.error("Failed to obtain groups for user=" + getUsername(), e);
View Full Code Here

         if(subject != null)
         {
            subject.getPrincipals().add(tp);
         }
           
         SimpleGroup sg = new SimpleGroup("Roles");
         sg.addMember(new SimplePrincipal("Echo"));
         subject.getPrincipals().add(sg);
         SimpleGroup cg = new SimpleGroup("CallerPrincipal");
         cg.addMember(tp);
         subject.getPrincipals().add(cg);
      }
View Full Code Here

        return identity;
    }

    @Override
    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup("Roles");
        Group[] groups = { roles };
        //group mapping would go here
        if(getIdentity().getName().equals("anil")) {
            roles.addMember(new SimplePrincipal("gooduser"));
        }
        roles.addMember(getIdentity());
        return groups;
    }
View Full Code Here

        return false;
    }

    @Override
    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
        roles.addMember(new SimplePrincipal(role));
        return new Group[] { roles };
    }
View Full Code Here

     * @see org.jboss.security.auth.spi.AbstractServerLoginModule#getRoleSets()
     */
    @Override
    protected Group[] getRoleSets() throws LoginException {
        try {
            Group roles = new SimpleGroup(SecurityConstants.ROLES_IDENTIFIER);
            roles.addMember(new SimplePrincipal(role));
            Group callerPrincipal = new SimpleGroup(SecurityConstants.CALLER_PRINCIPAL_GROUP);
            callerPrincipal.addMember(new CustomPrincipal(CALLER_NAME));
            return new Group[] { roles, callerPrincipal };
        } catch (Exception e) {
            throw new LoginException(e.toString());
        }
    }
View Full Code Here

        return identity;
    }

    @Override
    protected Group[] getRoleSets() throws LoginException {
        Group roles = new SimpleGroup("Roles");
        Group callerPrincipal = new SimpleGroup("CallerPrincipal");
        Group[] groups = { roles, callerPrincipal };
        callerPrincipal.addMember(getIdentity());
        return groups;
    }
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.