Examples of SimpleCredentials


Examples of javax.jcr.SimpleCredentials

    private VltSerializationDataBuilder builder;

    public static void main(String[] args) throws RepositoryException, URISyntaxException, IOException {
        RepositoryAddress address = new RepositoryAddress("http://localhost:8080/server/root");
        Repository repo = new RepositoryProvider().getRepository(address);
        Session session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));

        VaultFileSystem fs = Mounter.mount(null, null, address, "/", session);

        String[] attempts = new String[] { "/rep:policy", "/var" };
View Full Code Here

Examples of javax.jcr.SimpleCredentials

            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

Examples of javax.jcr.SimpleCredentials

        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

Examples of javax.jcr.SimpleCredentials

    @Test
    public void testPutStringObject() {
        final AuthenticationInfo info = new AuthenticationInfo("test", "user",
            new char[2]);
        info.put(CREDENTIALS,
                new SimpleCredentials("user", new char[2]));

        test_put_fail(info, AuthenticationInfo.AUTH_TYPE, null);
        test_put_fail(info, ResourceResolverFactory.USER, null);
        test_put_fail(info, ResourceResolverFactory.PASSWORD, null);
View Full Code Here

Examples of javax.jcr.SimpleCredentials

            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());
                boolean match = (Boolean) matcher.invoke(oldCreds, newCreds);
                if (match) {
                    return;
View Full Code Here

Examples of javax.jcr.SimpleCredentials

        SetField.set(c, "repository", repo);
        final Session s = Mockito.mock(Session.class);
        Mockito.when(repo.login(Matchers.any(Credentials.class))).thenAnswer(new Answer<Session>() {
            @Override
            public Session answer(InvocationOnMock invocation) {
                final SimpleCredentials c = (SimpleCredentials)invocation.getArguments()[0];
                if("admin".equals(c.getUserID())) {
                    return s;
                }
                return null;
            }
        });
       
        return c.execute();
    }
View Full Code Here

Examples of javax.jcr.SimpleCredentials

    }

    @Test
    public void testLogin() throws RepositoryException {
        assertNotNull(repository.login());
        assertNotNull(repository.login(new SimpleCredentials(USER_NAME, PASSWORD)));
        assertNotNull(repository.login(MockJcr.DEFAULT_WORKSPACE));
        assertNotNull(repository.login(new SimpleCredentials(USER_NAME, PASSWORD), MockJcr.DEFAULT_WORKSPACE));
    }
View Full Code Here

Examples of javax.jcr.SimpleCredentials

                        }
                        REGISTERED_REPOSITORIES.put(address, repository);
                    }
                }

                session = repository.login(new SimpleCredentials(repositoryInfo.getUsername(), repositoryInfo
                        .getPassword().toCharArray()));
                return address;
            } catch (URISyntaxException e) {
                throw new RuntimeException(e);
            } catch (RepositoryException e) {
View Full Code Here

Examples of javax.jcr.SimpleCredentials

    }

    public static Credentials getCredentials(RepositoryInfo repositoryInfo) {

        return new SimpleCredentials(repositoryInfo.getUsername(), repositoryInfo.getPassword().toCharArray());
    }
View Full Code Here

Examples of javax.jcr.SimpleCredentials

            return admin;
        }

        // else impersonate as the owner and logout the admin session again
        try {
            return admin.impersonate(new SimpleCredentials(this.classLoaderOwner, new char[0]));
        } finally {
            admin.logout();
        }
    }
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.