Package javax.jcr

Examples of javax.jcr.GuestCredentials


        return repository;
    }

    @Override
    public Credentials getReadOnlyCredentials() {
        return new GuestCredentials();
    }
View Full Code Here


        return repository;
    }

    @Override
    public Credentials getReadOnlyCredentials() {
        return new GuestCredentials();
    }
View Full Code Here

    }

    @Test
    public void loginWithAttribute() throws RepositoryException {
        Session session = ((JackrabbitRepository) getRepository()).login(
                new GuestCredentials(), null,
                Collections.<String, Object>singletonMap(RepositoryImpl.REFRESH_INTERVAL, 42));

        String[] attributeNames = session.getAttributeNames();
        assertEquals(1, attributeNames.length);
        assertEquals(RepositoryImpl.REFRESH_INTERVAL, attributeNames[0]);
View Full Code Here

    }

    @Test(expected = NoSuchWorkspaceException.class)
    public void loginInvalidWorkspace() throws RepositoryException {
        Repository repository = getRepository();
        repository.login(new GuestCredentials(), "invalid");
    }
View Full Code Here

     *
     * @throws Exception
     */
    @Test
    public void testGuestLogin() throws Exception {
        ContentSession cs = login(new GuestCredentials());
        assertEquals(UserConstants.DEFAULT_ANONYMOUS_ID, cs.getAuthInfo().getUserID());
        cs.close();
    }
View Full Code Here

        restrictions.put("rep:glob", vf.createValue("*/social/relationships/following/*"));
        tmpl.addEntry(EveryonePrincipal.getInstance(), new Privilege[]{acMgr.privilegeFromName(Privilege.JCR_READ)}, true, restrictions);
        acMgr.setPolicy(tmpl.getPath(), tmpl);
        adminSession.save();

        Session anonymousSession = getRepository().login(new GuestCredentials());
        QueryManager qm = anonymousSession.getWorkspace().getQueryManager();
        Query q = qm.createQuery("/jcr:root/home//social/relationships/following//*[@id='aaron.mcdonald@mailinator.com']", Query.XPATH);
        QueryResult r = q.execute();
        RowIterator it = r.getRows();
        Assert.assertTrue(it.hasNext());
View Full Code Here

        return repository;
    }

    @Override
    public Credentials getReadOnlyCredentials() {
        return new GuestCredentials();
    }
View Full Code Here

    }

    @Test
    public void loginWithAttribute() throws RepositoryException {
        Session session = ((JackrabbitRepository) getRepository()).login(
                new GuestCredentials(), null,
                Collections.<String, Object>singletonMap(RepositoryImpl.REFRESH_INTERVAL, 42));

        String[] attributeNames = session.getAttributeNames();
        assertEquals(1, attributeNames.length);
        assertEquals(RepositoryImpl.REFRESH_INTERVAL, attributeNames[0]);
View Full Code Here

    }

    @Test(expected = NoSuchWorkspaceException.class)
    public void loginInvalidWorkspace() throws RepositoryException {
        Repository repository = getRepository();
        repository.login(new GuestCredentials(), "invalid");
    }
View Full Code Here

     * @throws Exception
     *             if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = JcrUtils.getRepository();
        Session session = repository.login(new GuestCredentials());
        try {
            String user = session.getUserID();
            String name = repository.getDescriptor(Repository.REP_NAME_DESC);
            System.out.println("Logged in as " + user + " to a " + name
                    + " repository.");
View Full Code Here

TOP

Related Classes of javax.jcr.GuestCredentials

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.