Examples of ExternalIdentityRef


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

        assertIfEquals("Groups", TEST_USER1_GROUPS, id.getDeclaredGroups());
    }

    @Test
    public void testGetGroups2() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER0_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertTrue("User instance", id instanceof ExternalUser);
        assertIfEquals("Groups", TEST_USER0_GROUPS, id.getDeclaredGroups());
    }
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

        assertNull("Authenticate must return NULL for unknown user", user);
    }

    @Test
    public void testGetUserByForeignRef() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER1_DN, "foobar");
        ExternalIdentity id = idp.getIdentity(ref);
        assertNull("Foreign ref must be null", id);
    }
View Full Code Here

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

        assertNull("Foreign ref must be null", id);
    }

    @Test
    public void testGetUnknownUserByRef() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef("bla=foo," + TEST_USER1_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertNull("Unknown user must return null", id);
    }
View Full Code Here

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

        assertNull("Unknown user must return null", id);
    }

    @Test
    public void testGetGroupByRef() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_GROUP1_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertTrue("Group instance", id instanceof ExternalGroup);
        assertEquals("Group Name", TEST_GROUP1_NAME, id.getId());
    }
View Full Code Here

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

    }


    @Test
    public void testGetMembers() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_GROUP1_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertTrue("Group instance", id instanceof ExternalGroup);

        ExternalGroup grp = (ExternalGroup) id;
        assertIfEquals("Group members", TEST_GROUP1_MEMBERS, grp.getDeclaredMembers());
View Full Code Here

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

        assertIfEquals("Group members", TEST_GROUP1_MEMBERS, grp.getDeclaredMembers());
    }

    @Test
    public void testGetGroups() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER1_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertTrue("User instance", id instanceof ExternalUser);
        assertIfEquals("Groups", TEST_USER1_GROUPS, id.getDeclaredGroups());
    }
View Full Code Here

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

        assertIfEquals("Groups", TEST_USER1_GROUPS, id.getDeclaredGroups());
    }

    @Test
    public void testGetGroups2() throws Exception {
        ExternalIdentityRef ref = new ExternalIdentityRef(TEST_USER0_DN, IDP_NAME);
        ExternalIdentity id = idp.getIdentity(ref);
        assertTrue("User instance", id instanceof ExternalUser);
        assertIfEquals("Groups", TEST_USER0_GROUPS, id.getDeclaredGroups());
    }
View Full Code Here

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

            throws RepositoryException {
        Authorizable auth = userManager.getAuthorizable(id);
        if (auth == null) {
            return null;
        }
        ExternalIdentityRef ref = getIdentityRef(auth);
        Value[] lmValues = auth.getProperty(REP_LAST_SYNCED);
        long lastModified = -1;
        if (lmValues != null && lmValues.length > 0) {
            lastModified = lmValues[0].getLong();
        }
View Full Code Here

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

                Authorizable auth = userManager.getAuthorizable(id);
                if (auth == null) {
                    return false;
                }
                // check if we need to deal with this authorizable
                ExternalIdentityRef ref = getIdentityRef(auth);
                if (ref == null || !idp.getName().equals(ref.getProviderName())) {
                    return false;
                }

                if (auth instanceof Group) {
                    Group group = (Group) auth;
                    ExternalGroup external = idp.getGroup(id);
                    timer.mark("retrieve");
                    if (external == null) {
                        if (group.getDeclaredMembers().hasNext()) {
                            log.info("won't remove local group with members: {}", id);
                        } else {
                            auth.remove();
                            log.debug("removing authorizable '{}' that no longer exists on IDP {}", id, idp.getName());
                            timer.mark("remove");
                            ret = true;
                        }
                    } 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");
                        ret = true;
                    } 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.