Package javax.jcr

Examples of javax.jcr.Credentials


    /**
     * {@inheritDoc}
     */
    public SessionInfo obtain(Credentials credentials, String workspaceName)
            throws LoginException, NoSuchWorkspaceException, RepositoryException {
        Credentials duplicate = SessionInfoImpl.duplicateCredentials(credentials);
        return new SessionInfoImpl(repository.login(credentials, workspaceName), duplicate, getNameFactory(), getPathFactory());
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public SessionInfo impersonate(SessionInfo sessionInfo, Credentials credentials) throws LoginException, RepositoryException {
        Credentials duplicate = SessionInfoImpl.duplicateCredentials(credentials);
        SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
        return new SessionInfoImpl(sInfo.getSession().impersonate(credentials), duplicate, getNameFactory(), getPathFactory());
    }
View Full Code Here

                continue;
            }
            checked++;
            final String username = parts[0].trim();
            final String password = parts[1].trim();
            final Credentials creds = new SimpleCredentials(username, password.toCharArray());
            Session s = null;
            try {
                s = repository.login(creds);
                if(s != null) {
                    failures++;
View Full Code Here

     *         successfull authentication.
     * @throws NullPointerException if <code>userName</code> is
     *             <code>null</code>.
     */
    public Object authenticate(String userName, String password) {
        final Credentials creds = new SimpleCredentials(userName,
            (password == null) ? new char[0] : password.toCharArray());
        Session session = null;
        try {
            session = repository.login(creds);
            if (session instanceof JackrabbitSession) {
View Full Code Here

    private Repository getRepository() {
      return repository;
    }

    private Session createSession() throws RepositoryException {
        final Credentials credentials = new SimpleCredentials("admin",
                "admin".toCharArray());
        return repository.login(credentials, "default");
    }
View Full Code Here

            if (!contentSyncRoot.exists()) {
              throw new IllegalArgumentException("contentSyncRoot does not exist: "+contentSyncRoot);
            }

            Repository jcrRepo = RepositoryUtils.getRepository(repo.getRepositoryInfo());
            Credentials credentials = RepositoryUtils.getCredentials(repo.getRepositoryInfo());
           
            session = jcrRepo.login(credentials);

            RepositoryAddress address = RepositoryUtils.getRepositoryAddress(repo.getRepositoryInfo());
View Full Code Here

            info.getPassword());
    }

    @Test
    public void testSetCredentials() {
        final Credentials creds = new SimpleCredentials("user", new char[0]);
        final AuthenticationInfo info = new AuthenticationInfo("test");

        info.put(CREDENTIALS, creds);
        Assert.assertSame(creds, info.get(CREDENTIALS));
    }
View Full Code Here

        final AuthenticationInfo info = new AuthenticationInfo("test");

        assertNull(info.get(CREDENTIALS));
        assertFalse(info.containsKey(CREDENTIALS));

        final Credentials creds = new SimpleCredentials("user", new char[0]);
        info.put(CREDENTIALS, creds);

        assertSame(creds, info.get(CREDENTIALS));

        final String user = "user";
View Full Code Here

    }


    private void checkPassword(Authorizable authorizable, String oldPassword)
            throws RepositoryException {
        Credentials oldCreds = ((User) authorizable).getCredentials();
        if (oldCreds instanceof SimpleCredentials) {
            char[] oldCredsPwd = ((SimpleCredentials) oldCreds).getPassword();
            if (oldPassword.equals(String.valueOf(oldCredsPwd))) {
                return;
            }
        } else {
            try {
                // CryptSimpleCredentials.matches(SimpleCredentials credentials)
                Class<?> oldCredsClass = oldCreds.getClass();
                Method matcher = oldCredsClass.getMethod("matches",
                    SimpleCredentials.class);
                SimpleCredentials newCreds = new SimpleCredentials(
                    authorizable.getPrincipal().getName(),
                    oldPassword.toCharArray());
View Full Code Here

        return null;
    }

    @Override
    protected Session createAdministrativeSession(String workspace) throws RepositoryException {
        final Credentials adminCredentials = new AdministrativeCredentials(this.adminUserName);
        return this.getRepository().login(adminCredentials, workspace);
    }
View Full Code Here

TOP

Related Classes of javax.jcr.Credentials

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.