Examples of ExternalUser


Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

    }

    @Test
    public void testNullIntermediatePath() throws Exception {
        providerConfig.getUserConfig().setMakeDnPath(false);
        ExternalUser user = idp.getUser(TEST_USER1_UID);
        assertNotNull("User 1 must exist", user);
        assertNull("Intermediate path must be null", user.getIntermediatePath());
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

    }

    @Test
    public void testSplitDNIntermediatePath() throws Exception {
        providerConfig.getUserConfig().setMakeDnPath(true);
        ExternalUser user = idp.getUser(TEST_USER1_UID);
        assertNotNull("User 1 must exist", user);
        assertEquals("Intermediate path must be the split dn", TEST_USER1_PATH, user.getIntermediatePath());
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

    }

    @Test
    public void testSplitDNIntermediatePath2() throws Exception {
        providerConfig.getUserConfig().setMakeDnPath(true);
        ExternalUser user = idp.getUser(TEST_USER5_UID);
        assertNotNull("User 5 must exist", user);
        assertEquals("Intermediate path must be the split dn", TEST_USER5_PATH, user.getIntermediatePath());
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

                    } else {
                        ret = syncGroup(external, group);
                        timer.mark("sync");
                    }
                } else {
                    ExternalUser external = idp.getUser(id);
                    timer.mark("retrieve");
                    if (external == null) {
                        auth.remove();
                        log.debug("removing authorizable '{}' that no longer exists on IDP {}", id, idp.getName());
                        timer.mark("remove");
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

        if (!(credentials instanceof SimpleCredentials)) {
            log.debug("LDAP IDP can only authenticate SimpleCredentials.");
            return null;
        }
        final SimpleCredentials creds = (SimpleCredentials) credentials;
        final ExternalUser user = getUser(creds.getUserID());
        if (user != null) {
            // authenticate
            LdapConnection connection = null;
            try {
                DebugTimer timer = new DebugTimer();
                connection = userPool.getConnection();
                timer.mark("connect");
                connection.bind(user.getExternalId().getId(), new String(creds.getPassword()));
                timer.mark("bind");
                if (log.isDebugEnabled()) {
                    log.debug("authenticate({}) {}", user.getId(), timer.getString());
                }
            } catch (LdapAuthenticationException e) {
                throw new LoginException("Unable to authenticate against LDAP server: " + e.getMessage());
            } catch (Exception e) {
                throw new ExternalIdentityException("Error while binding user credentials", e);
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

        if (!(credentials instanceof SimpleCredentials)) {
            log.debug("LDAP IDP can only authenticate SimpleCredentials.");
            return null;
        }
        final SimpleCredentials creds = (SimpleCredentials) credentials;
        final ExternalUser user = getUser(creds.getUserID());
        if (user != null) {
            // authenticate
            LdapConnection connection = null;
            try {
                DebugTimer timer = new DebugTimer();
                connection = userPool.getConnection();
                timer.mark("connect");
                connection.bind(user.getExternalId().getId(), new String(creds.getPassword()));
                timer.mark("bind");
                if (log.isDebugEnabled()) {
                    log.debug("authenticate({}) {}", user.getId(), timer.getString());
                }
            } catch (LdapAuthenticationException e) {
                throw new LoginException("Unable to authenticate against LDAP server: " + e.getMessage());
            } catch (Exception e) {
                throw new ExternalIdentityException("Error while binding user credentials", e);
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

    @Test
    public void testSyncUpdate() throws Exception {
        // create user upfront in order to test update mode
        Authorizable user = userManager.createUser(USER_ID, null);
        ExternalUser externalUser = idp.getUser(USER_ID);
        user.setProperty("rep:externalId", new ValueFactoryImpl(root, NamePathMapper.DEFAULT).createValue(externalUser.getExternalId().getString()));
        root.commit();

        ContentSession cs = null;
        try {
            cs = login(new SimpleCredentials(USER_ID, USER_PWD.toCharArray()));
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

                    } else {
                        ret = syncGroup(external, group);
                        timer.mark("sync");
                    }
                } else {
                    ExternalUser external = idp.getUser(id);
                    timer.mark("retrieve");
                    if (external == null) {
                        SyncedIdentityImpl syncId = createSyncedIdentity(auth);
                        if (!keepMissing) {
                            auth.remove();
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

            List<String> list = new ArrayList<String>();
            context.setForceGroupSync(true).setForceUserSync(true);
            try {
                Iterator<ExternalUser> iter = idp.listUsers();
                while (iter.hasNext()) {
                    ExternalUser user = iter.next();
                    try {
                        SyncResult r = context.sync(user);
                        systemSession.save();
                        list.add(getJSONString(r));
                    } catch (SyncException e) {
                        list.add(getJSONString(user.getExternalId(), e));
                    } catch (RepositoryException e) {
                        list.add(getJSONString(user.getExternalId(), e));
                    }
                }
                return list.toArray(new String[list.size()]);
            } catch (ExternalIdentityException e) {
                throw new IllegalArgumentException("Unable to retrieve external users", e);
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser

        if (!(credentials instanceof SimpleCredentials)) {
            log.debug("LDAP IDP can only authenticate SimpleCredentials.");
            return null;
        }
        final SimpleCredentials creds = (SimpleCredentials) credentials;
        final ExternalUser user = getUser(creds.getUserID());
        if (user != null) {
            // OAK-2078: check for non-empty passwords to avoid anonymous bind on weakly configured servers
            // see http://tools.ietf.org/html/rfc4513#section-5.1.1 for details.
            if (creds.getPassword().length == 0) {
                throw new LoginException("Refusing to authenticate against LDAP server: Empty passwords not allowed.");
            }

            // authenticate
            LdapConnection connection = null;
            try {
                DebugTimer timer = new DebugTimer();
                if (userPool == null) {
                    connection = userConnectionFactory.makeObject();
                } else {
                    connection = userPool.getConnection();
                }
                timer.mark("connect");
                connection.bind(user.getExternalId().getId(), new String(creds.getPassword()));
                timer.mark("bind");
                if (log.isDebugEnabled()) {
                    log.debug("authenticate({}) {}", user.getId(), timer.getString());
                }
            } catch (LdapAuthenticationException e) {
                throw new LoginException("Unable to authenticate against LDAP server: " + e.getMessage());
            } catch (Exception e) {
                throw new ExternalIdentityException("Error while binding user credentials", e);
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.