Examples of SimpleCredentials


Examples of javax.jcr.SimpleCredentials

             */
            private Session getLongLivedSession(final Session slingSession) throws RepositoryException {
                Session adminSession = null;
                final String user = slingSession.getUserID();
                try {
                    final SimpleCredentials credentials = new SimpleCredentials(user, EMPTY_PW);
                    final String wsp = slingSession.getWorkspace().getName();
                    adminSession = SlingDavExServlet.this.repository.loginAdministrative(wsp);
                    return adminSession.impersonate(credentials);
                } catch (RepositoryException re) {

View Full Code Here

Examples of javax.jcr.SimpleCredentials

        s.logout();
    }

    @Test
    public void testExplicitAdminLogin() throws RepositoryException {
        final Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
        repository.login(creds).logout();
    }
View Full Code Here

Examples of javax.jcr.SimpleCredentials

        repository.login(creds).logout();
    }

    @Test(expected=RepositoryException.class)
    public void testWrongLogin() throws RepositoryException {
        final Credentials creds = new SimpleCredentials("badName", "badPAssword".toCharArray());
        repository.login(creds);
    }
View Full Code Here

Examples of javax.jcr.SimpleCredentials

     */
    protected Session createServiceSession(String serviceUserName, String workspace) throws RepositoryException {
        Session admin = null;
        try {
            admin = this.createAdministrativeSession(workspace);
            return admin.impersonate(new SimpleCredentials(serviceUserName, new char[0]));
        } finally {
            if (admin != null) {
                admin.logout();
            }
        }
View Full Code Here

Examples of javax.jcr.SimpleCredentials

                        tmpSession = repository.loginAdministrative(workspace);
                        if (tmpSession.getUserID().equals(session.getUserID())) {
                            session = tmpSession;
                            tmpSession = null;
                        } else {
                            session = tmpSession.impersonate(new SimpleCredentials(
                                session.getUserID(), new char[0]));
                        }
                    } finally {
                        if (tmpSession != null) {
                            tmpSession.logout();
View Full Code Here

Examples of javax.jcr.SimpleCredentials

            final boolean logoutSession)
    throws LoginException {
        final String sudoUser = getSudoUser(authenticationInfo);
        if (sudoUser != null && !session.getUserID().equals(sudoUser)) {
            try {
                final SimpleCredentials creds = new SimpleCredentials(sudoUser,
                    new char[0]);
                copyAttributes(creds, authenticationInfo);
                creds.setAttribute(ResourceResolver.USER_IMPERSONATOR,
                    session.getUserID());
                return session.impersonate(creds);
            } catch (final RepositoryException re) {
                throw getLoginException(re);
            } finally {
View Full Code Here

Examples of javax.jcr.SimpleCredentials

            } else {
                // otherwise try to create SimpleCredentials if the userId is set
                final Object userId = authenticationInfo.get(ResourceResolverFactory.USER);
                if (userId instanceof String) {
                    final Object password = authenticationInfo.get(ResourceResolverFactory.PASSWORD);
                    final SimpleCredentials credentials = new SimpleCredentials(
                            (String) userId, ((password instanceof char[])
                            ? (char[]) password
                            : new char[0]));

                    // add attributes
View Full Code Here

Examples of javax.jcr.SimpleCredentials

            return "default";
        }

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

Examples of javax.jcr.SimpleCredentials

        final String userName = this.serviceUserMapper.getServiceUserID(usingBundle, subServiceName);
        if (userName == null) {
            throw new LoginException("Cannot derive user name for bundle "
                + usingBundle + " and sub service " + subServiceName);
        }
        final SimpleCredentials creds = new SimpleCredentials(userName, new char[0]);

        Session admin = null;
        try {
            admin = this.loginAdministrativeInternal(workspace);
            return admin.impersonate(creds);
View Full Code Here

Examples of javax.jcr.SimpleCredentials

     * @param anonUser the user name of the anon user.
     * @return a Credentials implementation that represents the anon user.
     */
    protected Credentials getAnonCredentials(String anonUser) {
        // NB: this method is overridden in the Jackrabbit Service bundle to avoid using the anon password. SLING-1282
        return new SimpleCredentials(anonUser, anonPass);
    }
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.