Package javax.jcr

Examples of javax.jcr.SimpleCredentials


            assertNotNull(umgr.getAuthorizable("testUser"));
            if (userPath != null) {
                assertTrue(s.nodeExists(userPath));               
            }
            // ... and able to login to that workspace
            Session us = getHelper().getRepository().login(new SimpleCredentials("testUser", "testUser".toCharArray()), altWsp);
            us.logout();

        } finally {
            // remove the test user in the second workspace
            Authorizable dest = ((JackrabbitSession) s).getUserManager().getAuthorizable("testUser");
View Full Code Here


            // other users created in the default workspace...
            u = ((JackrabbitSession) superuser).getUserManager().createUser("testUser", "testUser");
            superuser.save();

            // the new user must be able to login to the repo
            s = getHelper().getRepository().login(new SimpleCredentials("testUser", "testUser".toCharArray()));

        } finally {
            if (s != null) {
                s.logout();
            }
View Full Code Here

        umgr.autoSave(false);
        try {
            // other users created in the default workspace...
            umgr.createUser(uid, uid);
            // the new user must be able to login to the repo
            s = getHelper().getRepository().login(new SimpleCredentials(uid, uid.toCharArray()));

            fail("Non-saved user node -> must not be able to login.");

        } catch (LoginException e) {
            // success
View Full Code Here

        Exchange out = template.send("direct:a", exchange);
        assertNotNull(out);
        String uuid = out.getOut().getBody(String.class);
        assertNotNull("Out body was null; expected JCR node UUID", uuid);
        Session session = getRepository().login(
                new SimpleCredentials("admin", "admin".toCharArray()));
        try {
            Node node = session.getNodeByIdentifier(uuid);
            assertNotNull(node);
            assertEquals(BASE_REPO_PATH + "/node", node.getPath());
        } finally {
View Full Code Here

                    Base64.decode(authStr[1].toCharArray(), out);
                    String decAuthStr = out.toString("ISO-8859-1");
                    int pos = decAuthStr.indexOf(':');
                    String userid = decAuthStr.substring(0, pos);
                    String passwd = decAuthStr.substring(pos + 1);
                    return new SimpleCredentials(userid, passwd.toCharArray());
                }
                throw new ServletException("Unable to decode authorization.");
            } else {
                // check special handling
                if (defaultHeaderValue == null) {
                    throw new LoginException();
                } else if (defaultHeaderValue.equals("")) {
                    return null;
                } else {
                    int pos = defaultHeaderValue.indexOf(':');
                    if (pos<0) {
                        return new SimpleCredentials(defaultHeaderValue, null);
                    } else {
                        return new SimpleCredentials(
                                defaultHeaderValue.substring(0, pos),
                                defaultHeaderValue.substring(pos+1).toCharArray()
                        );
                    }
                }
View Full Code Here

        try {
            UserManager uMgr = getUserManager(superuser);
            // create the testUser
            uid = "testUser" + UUID.randomUUID();
            creds = new SimpleCredentials(uid, uid.toCharArray());

            testUser = uMgr.createUser(uid, uid);
            if (!uMgr.isAutoSave()) {
                superuser.save();
            }
View Full Code Here

    protected Repository getRepository() {
        return repository;
    }

    protected Session openSession() throws RepositoryException {
        return getRepository().login(new SimpleCredentials("user", "pass".toCharArray()));
    }
View Full Code Here

        repository = new TransientRepository(CONFIG_FILE,
                "target/repository_with_auth");

        // set up a user to authenticate
        SessionImpl session = (SessionImpl) repository
                .login(new SimpleCredentials("admin", "admin".toCharArray()));
        UserManager userManager = session.getUserManager();
        User user = (User) userManager.getAuthorizable("test");
        if (user == null) {
            user = userManager.createUser("test", "quatloos");
        }
View Full Code Here

        Exchange exchange = createExchangeWithBody("<body/>");
        Exchange out = template.send("direct:a", exchange);
        assertNotNull(out);
        String uuid = out.getOut().getBody(String.class);
        assertNotNull("Out body was null; expected JCR node UUID", uuid);
        Session session = repository.login(new SimpleCredentials("user", "pass".toCharArray()));
        try {
            Node node = session.getNodeByIdentifier(uuid);
            assertNotNull(node);
            assertEquals("/home/test/node/with/path", node.getPath());
        } finally {
View Full Code Here

            return "default";
        }

        public Session loginAdministrative(String workspace)
                throws RepositoryException {
            final Credentials credentials = new SimpleCredentials(ADMIN_NAME,
                ADMIN_PASSWORD.toCharArray());
            return this.login(credentials, workspace);
        }
View Full Code Here

TOP

Related Classes of javax.jcr.SimpleCredentials

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.