Package org.apache.activemq.jaas

Examples of org.apache.activemq.jaas.GroupPrincipal


            userPasswords.put(user.getUsername(), user.getPassword());
            Set<GroupPrincipal> groups = new HashSet<GroupPrincipal>();
            StringTokenizer iter = new StringTokenizer(user.getGroups(), ",");
            while (iter.hasMoreTokens()) {
                String name = iter.nextToken().trim();
                groups.add(new GroupPrincipal(name));
            }
            userGroups.put(user.getUsername(), groups);
        }
    }
View Full Code Here


    protected Set parseACLs(String roles) {
        Set answer = new HashSet();
        StringTokenizer iter = new StringTokenizer(roles, ",");
        while (iter.hasMoreTokens()) {
            String name = iter.nextToken().trim();
            answer.add(new GroupPrincipal(name));
        }
        return answer;
    }
View Full Code Here

     */
    public void testGetAdminACLs() {
        ActiveMQDestination q1 = new ActiveMQQueue("queue1");
        Set aclsq1 = authMap.getAdminACLs(q1);
        assertEquals(1, aclsq1.size());
        assertTrue(aclsq1.contains(new GroupPrincipal("role1")));

        ActiveMQDestination t1 = new ActiveMQTopic("topic1");
        Set aclst1 = authMap.getAdminACLs(t1);
        assertEquals(1, aclst1.size());
        assertTrue(aclst1.contains(new GroupPrincipal("role1")));
    }
View Full Code Here

     */
    public void testGetReadACLs() {
        ActiveMQDestination q1 = new ActiveMQQueue("queue1");
        Set aclsq1 = authMap.getReadACLs(q1);
        assertEquals(1, aclsq1.size());
        assertTrue(aclsq1.contains(new GroupPrincipal("role1")));

        ActiveMQDestination t1 = new ActiveMQTopic("topic1");
        Set aclst1 = authMap.getReadACLs(t1);
        assertEquals(1, aclst1.size());
        assertTrue(aclst1.contains(new GroupPrincipal("role2")));
    }
View Full Code Here

     */
    public void testGetWriteACLs() {
        ActiveMQDestination q1 = new ActiveMQQueue("queue1");
        Set aclsq1 = authMap.getWriteACLs(q1);
        assertEquals(2, aclsq1.size());
        assertTrue(aclsq1.contains(new GroupPrincipal("role1")));
        assertTrue(aclsq1.contains(new GroupPrincipal("role2")));

        ActiveMQDestination t1 = new ActiveMQTopic("topic1");
        Set aclst1 = authMap.getWriteACLs(t1);
        assertEquals(1, aclst1.size());
        assertTrue(aclst1.contains(new GroupPrincipal("role3")));
    }
View Full Code Here

            }
        }
       
        for (int i = 0; i < groupNames.length; ++i) {
            if (groupNames[i].length() > 0) {
                subject.getPrincipals().add(new GroupPrincipal(groupNames[i]));
            }
        }
       
        return true;
    }
View Full Code Here

                }
                acls = addAttributeValues(roleAttribute, attrs, acls);
            }
            for (Iterator iter = acls.iterator(); iter.hasNext();) {
                String roleName = (String) iter.next();
                roles.add(new GroupPrincipal(roleName));
            }
            return roles;
        }
        catch (NamingException e) {
            log.error(e);
View Full Code Here

* @version $Rev: $ $Date: $
*/
public class GroupPrincipalTest extends TestCase {

    public void testArguments() {
        GroupPrincipal principal = new GroupPrincipal("FOO");

       assertEquals("FOO", principal.getName());

        try {
            new GroupPrincipal(null);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException ingore) {

        }
    }
View Full Code Here

        }
    }

    public void testHash() {
        GroupPrincipal p1 = new GroupPrincipal("FOO");
        GroupPrincipal p2 = new GroupPrincipal("FOO");

        assertEquals(p1.hashCode(), p1.hashCode());
        assertEquals(p1.hashCode(), p2.hashCode());
    }
View Full Code Here

        assertEquals(p1.hashCode(), p1.hashCode());
        assertEquals(p1.hashCode(), p2.hashCode());
    }

    public void testEquals() {
        GroupPrincipal p1 = new GroupPrincipal("FOO");
        GroupPrincipal p2 = new GroupPrincipal("FOO");
        GroupPrincipal p3 = new GroupPrincipal("BAR");

        assertTrue(p1.equals(p1));
        assertTrue(p1.equals(p2));
        assertFalse(p1.equals(null));
        assertFalse(p1.equals("FOO"));
View Full Code Here

TOP

Related Classes of org.apache.activemq.jaas.GroupPrincipal

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.