Package org.jboss.security

Examples of org.jboss.security.SimpleGroup.addMember()


   {
      SimplePrincipal sp1 = new SimplePrincipal("sp1");
      SimplePrincipal sp2 = new SimplePrincipal("sp2");
     
      SimpleGroup sg = new SimpleGroup("sg1");
      sg.addMember(sp1);
      sg.addMember(sp2);
      assertTrue("sg.isMember(sp1)", sg.isMember(sp1));
      assertTrue("sg.isMember(sp2)", sg.isMember(sp2));
     
      //Clone
View Full Code Here


      SimplePrincipal sp1 = new SimplePrincipal("sp1");
      SimplePrincipal sp2 = new SimplePrincipal("sp2");
     
      SimpleGroup sg = new SimpleGroup("sg1");
      sg.addMember(sp1);
      sg.addMember(sp2);
      assertTrue("sg.isMember(sp1)", sg.isMember(sp1));
      assertTrue("sg.isMember(sp2)", sg.isMember(sp2));
     
      //Clone
      SimpleGroup clonedSP = (SimpleGroup)sg.clone();
View Full Code Here

   }
  
   protected ProtectionDomain getProtectionDomain(String username, String role) throws Exception
   {
      Group gp = new SimpleGroup("Roles");
      gp.addMember(new SimplePrincipal(role));
      Principal sp = new SimplePrincipal(username);
      prepareAndSetAuthenticatedSubject(sp,gp);
      return new ProtectionDomain(null,null,null,new Principal[] { sp,gp} );
   }
  
View Full Code Here

   {
      protected Group[] getRoleSets()
      {
         SimpleGroup roles = new SimpleGroup("Roles");
         Group[] roleSets = {roles};
         roles.addMember(new SimplePrincipal("TestRole"));
         roles.addMember(new SimplePrincipal("Role2"));
         return roleSets;
      }
      /** This represents the 'true' password
       */
 
View Full Code Here

      protected Group[] getRoleSets()
      {
         SimpleGroup roles = new SimpleGroup("Roles");
         Group[] roleSets = {roles};
         roles.addMember(new SimplePrincipal("TestRole"));
         roles.addMember(new SimplePrincipal("Role2"));
         return roleSets;
      }
      /** This represents the 'true' password
       */
      protected String getUsersPassword()
View Full Code Here

         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

         {
            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

           
         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);
      }

      public boolean login() throws LoginException
      {
View Full Code Here

    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

        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

TOP
Copyright © 2018 www.massapi.com. 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.