Package javax.jcr

Examples of javax.jcr.SimpleCredentials


        MongoConnection con = createConnection();
        MongoMK mk = new MongoMK.Builder()
                .setMongoDB(con.getDB())
                .setClusterId(1).open();
        Session session = new Jcr(mk).createRepository().login(
                new SimpleCredentials("admin", "admin".toCharArray()));
        session.logout();
        mk.dispose(); // closes connection as well
    }
View Full Code Here


        }

        @Override
        public void run() {
            try {
                Session session = repo.login(new SimpleCredentials(
                        "admin", "admin".toCharArray()));
                ensureIndex(session.getRootNode(), PROP_NAME);

                String nodeName = "testroot-" + Thread.currentThread().getName();
                createNodes(session, nodeName, LOOP_COUNT, NODE_COUNT, exceptions);
View Full Code Here

        // nodeStore = fixture.createNodeStore(1);
        nodeStore = fixture.createNodeStore();
       
        if (nodeStore != null) {
            Repository rep  = new Jcr(nodeStore).createRepository();
            session = rep.login(new SimpleCredentials("admin", "admin".toCharArray()));
        }
    }
View Full Code Here

        ns1 = fixture.createNodeStore(1);
        if (ns1 == null) {
            return;
        }
        r1  = new Jcr(ns1).createRepository();
        s1 = r1.login(new SimpleCredentials("admin", "admin".toCharArray()));
        ns2 = fixture.createNodeStore(2);
        r2  = new Jcr(ns2).createRepository();
        s2 = r2.login(new SimpleCredentials("admin", "admin".toCharArray()));
    }
View Full Code Here

    @Before
    public void before() throws Exception {
        repository = new Jcr().createRepository();

        Session admin = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
        sessions.add(admin);
        Node testNode = admin.getRootNode().addNode("testNode");
        AccessControlUtils.addAccessControlEntry(admin, testNode.getPath(),
                EveryonePrincipal.getInstance(), new String[]{Privilege.JCR_READ}, true);
        admin.save();
View Full Code Here

        System.setProperty("derby.stream.error.file", "target/derby.log");
        jackrabbitRepository = JcrUtils.getRepository(
                new File("target", "jackrabbit").toURI().toURL().toString());
        oakRepository = new Jcr().createRepository();

        writeSessions.add((JackrabbitSession) jackrabbitRepository.login(new SimpleCredentials("admin", "admin".toCharArray())));
        writeSessions.add((JackrabbitSession) oakRepository.login(new SimpleCredentials("admin", "admin".toCharArray())));

        setupAuthorizables();
        setupContent();

        readSessions.add(jackrabbitRepository.login(new SimpleCredentials(userId, userId.toCharArray())));
        readSessions.add(oakRepository.login(new SimpleCredentials(userId, userId.toCharArray())));
    }
View Full Code Here

            securityProvider = new SecurityProviderImpl();
        }
        Jcr jcr = new Jcr();
        jcr.with(securityProvider);
        repo = jcr.createRepository();
        adminSession = repo.login(new SimpleCredentials(UserConstants.DEFAULT_ADMIN_ID, UserConstants.DEFAULT_ADMIN_ID.toCharArray()));

        if (!(adminSession instanceof JackrabbitSession)) {
            throw new NotExecutableException();
        }
        userMgr = ((JackrabbitSession) adminSession).getUserManager();
View Full Code Here

        session.save();

        Map<String,Object> attrs = new HashMap<String, Object>();
        attrs.put(RepositoryImpl.REFRESH_INTERVAL, 0);
        observingSession = ((JackrabbitRepository) getRepository()).login(new SimpleCredentials("admin", "admin".toCharArray()), null, attrs);
        observationManager = observingSession.getWorkspace().getObservationManager();
    }
View Full Code Here

            assertTrue(e.getCause() instanceof CommitFailedException);
        }
    }

    private Session newSession(boolean refreshIntervalZero) throws RepositoryException {
        Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
        if (refreshIntervalZero){
            return ((JackrabbitRepository) getRepository())
                    .login(creds, null, Collections.<String, Object>singletonMap(REFRESH_INTERVAL, 0));
        } else{
            return getRepository().login(creds);
View Full Code Here

            throw new RepositoryException(msg);
        }

        // set IMPERSONATOR_ATTRIBUTE attribute of given credentials
        // with subject of current session
        SimpleCredentials creds = (SimpleCredentials) otherCredentials;
        creds.setAttribute(SecurityConstants.IMPERSONATOR_ATTRIBUTE, subject);

        try {
            return rep.login(otherCredentials, getWorkspace().getName());
        } catch (NoSuchWorkspaceException nswe) {
            // should never get here...
            String msg = "impersonate failed";
            log.error(msg, nswe);
            throw new RepositoryException(msg, nswe);
        } finally {
            // make sure IMPERSONATOR_ATTRIBUTE is removed
            creds.removeAttribute(SecurityConstants.IMPERSONATOR_ATTRIBUTE);
        }
    }
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.