Examples of TestPrincipal


Examples of org.apache.jackrabbit.core.security.TestPrincipal

        siblingPath = n2.getPath();

        // create the testGroup
        UserManager umgr = getUserManager(superuser);

        Principal groupPrincipal = new TestPrincipal("testGroup" + UUID.randomUUID());
        testGroup = umgr.createGroup(groupPrincipal);
        testUser = umgr.createUser("testUser" + UUID.randomUUID(), "pw");
        if (!umgr.isAutoSave() && superuser.hasPendingChanges()) {
            superuser.save();
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

        public void testMultipleGroupPermissionsOnNode() throws NotExecutableException, RepositoryException {
        Group testGroup = getTestGroup();

        /* create a second group the test user is member of */
        Principal principal = new TestPrincipal("testGroup" + UUID.randomUUID());
        UserManager umgr = getUserManager(superuser);
        Group group2 = umgr.createGroup(principal);
        try {
            group2.addMember(testUser);
            if (!umgr.isAutoSave() && superuser.hasPendingChanges()) {
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

    public void testMultipleGroupPermissionsOnNode2() throws NotExecutableException, RepositoryException {
        Group testGroup = getTestGroup();

        /* create a second group the test user is member of */
        Principal principal = new TestPrincipal("testGroup" + UUID.randomUUID());
        UserManager umgr = getUserManager(superuser);
        Group group2 = umgr.createGroup(principal);

        try {
            group2.addMember(testUser);
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

        String pn = "any_principal" + UUID.randomUUID();
        return getTestPrincipal(pn);
    }

    protected Principal getTestPrincipal(String name) throws RepositoryException {
        return new TestPrincipal(name);
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

        UserManager uMgr = getUserManager(superuser);
        User u = null;
        User u2 = null;
        try {
            u = uMgr.createUser("t", "t");
            u2 = uMgr.createUser("tt", "tt", new TestPrincipal("tt"), "t/tt");
            if (!uMgr.isAutoSave()) {
                superuser.save();
            }

            Principal p = u.getPrincipal();
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

    }

    protected Group getTestGroup() throws RepositoryException, NotExecutableException {
        if (testGroup == null) {
            // create the testGroup
            Principal principal = new TestPrincipal("testGroup" + UUID.randomUUID());
            UserManager umgr = getUserManager(superuser);
            testGroup = umgr.createGroup(principal);
            testGroup.addMember(testUser);
            if (!umgr.isAutoSave() && superuser.hasPendingChanges()) {
                superuser.save();
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

    }

    public void testAddInvalidEntry() throws RepositoryException, NotExecutableException {
        Principal unknownPrincipal;
        if (!pMgr.hasPrincipal("an unknown principal")) {
            unknownPrincipal = new TestPrincipal("an unknown principal");
        } else {
            throw new NotExecutableException();
        }
        JackrabbitAccessControlList pt = createEmptyTemplate(getTestPath());
        try {
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

            assertNotNull("User with id " + uid + " must exist.", ath);
            assertFalse("User with id " + uid + " must not be a group.", ath.isGroup());
        }

        // test for groups as well
        GroupImpl gr = (GroupImpl) uMgr.createGroup(new TestPrincipal("z[x]"));
        save(s);
        // remember the z-folder for later removal
        toRemove.add((NodeImpl) gr.getNode().getParent().getParent());

        assertEquals("z[x]", gr.getID());
        String expectedPath = groupsPath + "/z/" + Text.escapeIllegalJcrChars("z[") + "/" + Text.escapeIllegalJcrChars("z[x]");
        assertEquals(expectedPath, gr.getNode().getPath());

        Authorizable ath = uMgr.getAuthorizable(gr.getID());
        assertNotNull(ath);
        assertTrue(ath.isGroup());

        // test if conflicting authorizables are detected.
        try {
            uMgr.createUser("z[x]", "z[x]");
            save(s);
            fail("A group \"z[x]\" already exists.");
        } catch (AuthorizableExistsException e) {
            // success
        }

        try {
            uMgr.createGroup(new TestPrincipal("z*rik"));
            save(s);
            fail("A user \"z*rik\" already exists");
        } catch (AuthorizableExistsException e) {
            // success
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.security.TestPrincipal

     * @throws Exception
     */
    public void testCacheDoesntContainTestPrincipalImpl() throws Exception {
        Set<Principal> principals = getPrincipalSetFromSession(superuser);
        for (Principal p : principals) {
            Principal testPrinc = new TestPrincipal(p.getName());
            principalProvider.getGroupMembership(testPrinc);
            Principal fromProvider = principalProvider.getPrincipal(p.getName());

            assertNotSame(testPrinc, fromProvider);
            assertFalse(fromProvider instanceof TestPrincipal);
View Full Code Here

Examples of org.jboss.soa.esb.services.security.TestPrincipal

    final String userName = "testUser";
    final String password = "testPassword";
    Builder builder = new SecurityConfig.Builder("UserPassLogin");
    builder.callBackhandler("org.jboss.internal.soa.esb.services.security.UserPassCallbackHandler");
    SecurityConfig configInfo = builder.build();
    TestPrincipal principal = new TestPrincipal(userName);
    Set<Object> credentials = new HashSet<Object>();
    credentials.add(password);

    AuthenticationRequest authRequest = new AuthenticationRequestImpl.Builder(principal, credentials).build();
    SecurityContext context = new SecurityContext(subject, SecurityContext.getConfigurationTimeout());
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.