Examples of ExternalIdentityRef


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

                Authorizable auth = userManager.getAuthorizable(id);
                if (auth == null) {
                    return new SyncResultImpl(new SyncedIdentityImpl(id, null, false, -1), SyncResult.Status.NO_SUCH_AUTHORIZABLE);
                }
                // check if we need to deal with this authorizable
                ExternalIdentityRef ref = getIdentityRef(auth);
                if (ref == null || !idp.getName().equals(ref.getProviderName())) {
                    return new SyncResultImpl(new SyncedIdentityImpl(id, null, false, -1), SyncResult.Status.FOREIGN);
                }

                if (auth instanceof Group) {
                    Group group = (Group) auth;
                    ExternalGroup external = idp.getGroup(id);
                    timer.mark("retrieve");
                    if (external == null) {
                        SyncedIdentityImpl syncId = createSyncedIdentity(auth);
                        if (group.getDeclaredMembers().hasNext()) {
                            log.info("won't remove local group with members: {}", id);
                            ret = new SyncResultImpl(syncId, SyncResult.Status.NOP);
                        } else if (!keepMissing) {
                            auth.remove();
                            log.debug("removing authorizable '{}' that no longer exists on IDP {}", id, idp.getName());
                            timer.mark("remove");
                            ret = new SyncResultImpl(syncId, SyncResult.Status.DELETE);
                        } else {
                            ret = new SyncResultImpl(syncId, SyncResult.Status.MISSING);
                            log.info("external identity missing for {}, but purge == false.", id);
                        }
                    } 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();
                            log.debug("removing authorizable '{}' that no longer exists on IDP {}", id, idp.getName());
                            timer.mark("remove");
                            ret = new SyncResultImpl(syncId, SyncResult.Status.DELETE);
                        } else {
                            ret = new SyncResultImpl(syncId, SyncResult.Status.MISSING);
                            log.info("external identity missing for {}, but purge == false.", id);
                        }
                    } else {
                        ret = syncUser(external, (User) auth);
                        timer.mark("sync");
                    }
                }
                if (log.isDebugEnabled()) {
                    log.debug("sync({}) -> {} {}", id, ref.getString(), timer.getString());
                }
                return ret;
            } catch (RepositoryException e) {
                throw new SyncException(e);
            } catch (ExternalIdentityException e) {
View Full Code Here

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

         *
         * @param auth the authorizable.
         * @return {@code true} if same IDP.
         */
        private boolean isSameIDP(@Nullable Authorizable auth) throws RepositoryException {
            ExternalIdentityRef ref = getIdentityRef(auth);
            return ref != null && idp.getName().equals(ref.getProviderName());
        }
View Full Code Here

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

        @Nonnull
        public String[] syncExternalUsers(@Nonnull String[] externalIds) {
            List<String> list = new ArrayList<String>();
            context.setForceGroupSync(true).setForceUserSync(true);
            for (String externalId: externalIds) {
                ExternalIdentityRef ref = ExternalIdentityRef.fromString(externalId);
                try {
                    ExternalIdentity id = idp.getIdentity(ref);
                    if (id != null) {
                        SyncResult r = context.sync(id);
                        systemSession.save();
View Full Code Here

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

        return result;
    }

    private ExternalUser createUser(Entry e, String id)
            throws LdapInvalidAttributeValueException {
        ExternalIdentityRef ref = new ExternalIdentityRef(e.getDn().getName(), this.getName());
        if (id == null) {
            id = e.get(config.getUserConfig().getIdAttribute()).getString();
        }
        String path = config.getUserConfig().makeDnPath()
                ? createDNPath(e.getDn())
View Full Code Here

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

        return user;
    }

    private ExternalGroup createGroup(Entry e, String name)
            throws LdapInvalidAttributeValueException {
        ExternalIdentityRef ref = new ExternalIdentityRef(e.getDn().getName(), this.getName());
        if (name == null) {
            name = e.get(config.getGroupConfig().getIdAttribute()).getString();
        }
        String path = config.getGroupConfig().makeDnPath()
                ? createDNPath(e.getDn())
View Full Code Here

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

            timer.mark("search");
            while (searchCursor.next()) {
                Response response = searchCursor.get();
                if (response instanceof SearchResultEntry) {
                    Entry resultEntry = ((SearchResultEntry) response).getEntry();
                    ExternalIdentityRef groupRef = new ExternalIdentityRef(resultEntry.getDn().toString(), this.getName());
                    groups.put(groupRef.getId(), groupRef);
                }
            }
            timer.mark("iterate");
            if (log.isDebugEnabled()) {
                log.debug("search below {} with {} found {} entries. {}",
View Full Code Here

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

            timer.mark("connect");
            Entry entry = connection.lookup(ref.getId());
            timer.mark("lookup");
            Attribute attr = entry.get(config.getGroupMemberAttribute());
            for (Value value: attr) {
                ExternalIdentityRef memberRef = new ExternalIdentityRef(value.getString(), this.getName());
                members.put(memberRef.getId(), memberRef);
            }
            timer.mark("iterate");
            if (log.isDebugEnabled()) {
                log.debug("members lookup of {} found {} members. {}", ref.getId(), members.size(), timer.getString());
            }
View Full Code Here

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

     * @return the id
     * @throws RepositoryException if an error occurrs
     */
    @CheckForNull
    private static SyncedIdentityImpl createSyncedIdentity(@Nullable Authorizable auth) throws RepositoryException {
        ExternalIdentityRef ref = auth == null ? null : getIdentityRef(auth);
        if (ref == null) {
            return null;
        } else {
            Value[] lmValues = auth.getProperty(REP_LAST_SYNCED);
            long lastModified = -1;
View Full Code Here

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

    public static final String[] TEST_USER0_GROUPS = {TEST_GROUP1_DN, TEST_GROUP2_DN, TEST_GROUP3_DN};
    public static final String[] TEST_USER1_GROUPS = {TEST_GROUP1_DN};

    @Test
    public void testGetUserByRef() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER1_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertTrue("User instance", id instanceof ExternalUser);
        assertEquals("User ID", TEST_USER1_UID, id.getId());
    }
View Full Code Here

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

                Authorizable auth = userManager.getAuthorizable(id);
                if (auth == null) {
                    return new SyncResultImpl(new SyncedIdentityImpl(id, null, false, -1), SyncResult.Status.NO_SUCH_AUTHORIZABLE);
                }
                // check if we need to deal with this authorizable
                ExternalIdentityRef ref = getIdentityRef(auth);
                if (ref == null || !idp.getName().equals(ref.getProviderName())) {
                    return new SyncResultImpl(new SyncedIdentityImpl(id, null, false, -1), SyncResult.Status.FOREIGN);
                }

                if (auth instanceof Group) {
                    Group group = (Group) auth;
                    ExternalGroup external = idp.getGroup(id);
                    timer.mark("retrieve");
                    if (external == null) {
                        SyncedIdentityImpl syncId = createSyncedIdentity(auth);
                        if (group.getDeclaredMembers().hasNext()) {
                            log.info("won't remove local group with members: {}", id);
                            ret = new SyncResultImpl(syncId, SyncResult.Status.NOP);
                        } else if (!keepMissing) {
                            auth.remove();
                            log.debug("removing authorizable '{}' that no longer exists on IDP {}", id, idp.getName());
                            timer.mark("remove");
                            ret = new SyncResultImpl(syncId, SyncResult.Status.DELETE);
                        } else {
                            ret = new SyncResultImpl(syncId, SyncResult.Status.MISSING);
                            log.info("external identity missing for {}, but purge == false.", id);
                        }
                    } 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();
                            log.debug("removing authorizable '{}' that no longer exists on IDP {}", id, idp.getName());
                            timer.mark("remove");
                            ret = new SyncResultImpl(syncId, SyncResult.Status.DELETE);
                        } else {
                            ret = new SyncResultImpl(syncId, SyncResult.Status.MISSING);
                            log.info("external identity missing for {}, but purge == false.", id);
                        }
                    } else {
                        ret = syncUser(external, (User) auth);
                        timer.mark("sync");
                    }
                }
                if (log.isDebugEnabled()) {
                    log.debug("sync({}) -> {} {}", id, ref.getString(), timer.getString());
                }
                return ret;
            } catch (RepositoryException e) {
                throw new SyncException(e);
            } catch (ExternalIdentityException 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.