Search in sources :

Example 1 with SyncedIdentity

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.

the class DefaultSyncContextTest method testCreateSyncedIdentityEmptyLastSyncedProperty.

@Test
public void testCreateSyncedIdentityEmptyLastSyncedProperty() throws Exception {
    Group gr = createTestGroup();
    gr.setProperty(DefaultSyncContext.REP_LAST_SYNCED, new Value[0]);
    SyncedIdentity si = DefaultSyncContext.createSyncedIdentity(gr);
    assertNotNull(si);
    assertEquals(-1, si.lastSynced());
}
Also used : Group(org.apache.jackrabbit.api.security.user.Group) ExternalGroup(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup) SyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 2 with SyncedIdentity

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.

the class DefaultSyncContextTest method testCreateSyncedIdentitySyncedGroup.

@Test
public void testCreateSyncedIdentitySyncedGroup() throws Exception {
    ExternalIdentity externalGroup = idp.listGroups().next();
    sync(externalGroup);
    Authorizable a = userManager.getAuthorizable(externalGroup.getId());
    SyncedIdentity si = DefaultSyncContext.createSyncedIdentity(a);
    assertNotNull(si);
    assertEquals(a.getID(), si.getId());
    assertNotNull(si.getExternalIdRef());
    assertTrue(si.isGroup());
    assertEquals(syncCtx.now, si.lastSynced());
}
Also used : ExternalIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity) Authorizable(org.apache.jackrabbit.api.security.user.Authorizable) SyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 3 with SyncedIdentity

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.

the class DefaultSyncContextTest method testCreateSyncedIdentityLocalUser.

@Test
public void testCreateSyncedIdentityLocalUser() throws Exception {
    User u = getTestUser();
    SyncedIdentity si = DefaultSyncContext.createSyncedIdentity(u);
    assertNotNull(si);
    assertEquals(u.getID(), si.getId());
    assertNull(si.getExternalIdRef());
    assertFalse(si.isGroup());
    assertEquals(-1, si.lastSynced());
}
Also used : User(org.apache.jackrabbit.api.security.user.User) ExternalUser(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser) SyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 4 with SyncedIdentity

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.

the class DefaultSyncHandlerTest method testFindMissingIdentity.

@Test
public void testFindMissingIdentity() throws Exception {
    SyncedIdentity id = syncHandler.findIdentity(userManager, "foobar");
    assertNull("unknown authorizable should not exist", id);
}
Also used : DefaultSyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncedIdentity) SyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity) Test(org.junit.Test)

Example 5 with SyncedIdentity

use of org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity in project jackrabbit-oak by apache.

the class DefaultSyncHandlerTest method testFindLocalIdentity.

@Test
public void testFindLocalIdentity() throws Exception {
    SyncedIdentity id = syncHandler.findIdentity(userManager, "admin");
    assertNotNull("known authorizable should exist", id);
    assertNull("local user should not have external ref", id.getExternalIdRef());
}
Also used : DefaultSyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncedIdentity) SyncedIdentity(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity) Test(org.junit.Test)

Aggregations

SyncedIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncedIdentity)34 Test (org.junit.Test)30 AbstractExternalAuthTest (org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest)15 DefaultSyncedIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.basic.DefaultSyncedIdentity)13 SyncResult (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncResult)11 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)6 ExternalIdentityRef (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityRef)6 ExternalGroup (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalGroup)5 Group (org.apache.jackrabbit.api.security.user.Group)4 User (org.apache.jackrabbit.api.security.user.User)4 ExternalIdentity (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentity)4 ExternalUser (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalUser)4 SimpleCredentials (javax.jcr.SimpleCredentials)3 RepositoryException (javax.jcr.RepositoryException)2 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 Nonnull (javax.annotation.Nonnull)1 Value (javax.jcr.Value)1 LoginException (javax.security.auth.login.LoginException)1 JackrabbitSession (org.apache.jackrabbit.api.JackrabbitSession)1