Search in sources :

Example 1 with SyncHandler

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

the class DefaultSyncHandlerTest method before.

@Before
public void before() throws Exception {
    super.before();
    userManager = getUserManager(root);
    SyncHandler sh = syncManager.getSyncHandler("default");
    assertTrue(sh instanceof DefaultSyncHandler);
    syncHandler = (DefaultSyncHandler) sh;
}
Also used : SyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler) Before(org.junit.Before)

Example 2 with SyncHandler

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

the class ExternalPrincipalConfigurationTest method testAddingSyncHandler.

@Test
public void testAddingSyncHandler() throws Exception {
    Map<String, Object> enableProps = ImmutableMap.<String, Object>of(DefaultSyncConfigImpl.PARAM_USER_DYNAMIC_MEMBERSHIP, true);
    Map<String, Object> disableProps = ImmutableMap.<String, Object>of(DefaultSyncConfigImpl.PARAM_USER_DYNAMIC_MEMBERSHIP, false);
    SyncHandler sh = new DefaultSyncHandler();
    context.registerService(SyncHandler.class, sh, ImmutableMap.<String, Object>of());
    assertIsEnabled(principalConfiguration, false);
    context.registerService(SyncHandler.class, sh, disableProps);
    assertIsEnabled(principalConfiguration, false);
    context.registerService(SyncHandler.class, sh, enableProps);
    assertIsEnabled(principalConfiguration, true);
    context.registerService(DefaultSyncHandler.class, new DefaultSyncHandler(), enableProps);
    assertIsEnabled(principalConfiguration, true);
}
Also used : SyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler) DefaultSyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler) DefaultSyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 3 with SyncHandler

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

the class ExternalPrincipalConfigurationTest method testAddingCustomSyncHandler.

@Test
public void testAddingCustomSyncHandler() throws Exception {
    Map<String, Object> enableProps = ImmutableMap.<String, Object>of(DefaultSyncConfigImpl.PARAM_USER_DYNAMIC_MEMBERSHIP, true);
    SyncHandler sh = new TestSyncHandler();
    context.registerService(SyncHandler.class, sh, ImmutableMap.<String, Object>of());
    assertIsEnabled(principalConfiguration, false);
    context.registerService(SyncHandler.class, sh, enableProps);
    assertIsEnabled(principalConfiguration, true);
}
Also used : SyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler) DefaultSyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 4 with SyncHandler

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

the class SyncMBeanImpl method getDelegatee.

@Nonnull
private Delegatee getDelegatee() {
    SyncHandler handler = syncManager.getSyncHandler(syncName);
    if (handler == null) {
        log.error("No sync manager available for name {}.", syncName);
        throw new IllegalArgumentException("No sync manager available for name " + syncName);
    }
    ExternalIdentityProvider idp = idpManager.getProvider(idpName);
    if (idp == null) {
        log.error("No idp available for name", idpName);
        throw new IllegalArgumentException("No idp manager available for name " + idpName);
    }
    return Delegatee.createInstance(repository, securityProvider, handler, idp);
}
Also used : ExternalIdentityProvider(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityProvider) SyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler) Nonnull(javax.annotation.Nonnull)

Example 5 with SyncHandler

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

the class SyncMBeanImplTest method before.

@Before
public void before() throws Exception {
    super.before();
    syncMgr = new SyncManager() {

        @CheckForNull
        @Override
        public SyncHandler getSyncHandler(@Nonnull String name) {
            if (SYNC_NAME.equals(name)) {
                return new DefaultSyncHandler(syncConfig);
            } else if (ThrowingSyncHandler.NAME.equals(name)) {
                return new ThrowingSyncHandler(false);
            } else if (ThrowingSyncHandler.NAME_ALLOWS_IDENTITY_LISTING.equals(name)) {
                return new ThrowingSyncHandler(true);
            } else {
                return null;
            }
        }
    };
    idpMgr = new ExternalIdentityProviderManager() {

        @CheckForNull
        @Override
        public ExternalIdentityProvider getProvider(@Nonnull String name) {
            if (name.equals(idp.getName())) {
                return idp;
            } else {
                return null;
            }
        }
    };
    syncMBean = createSyncMBeanImpl(SYNC_NAME, idp.getName());
}
Also used : ExternalIdentityProvider(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityProvider) SyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler) DefaultSyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler) CheckForNull(javax.annotation.CheckForNull) SyncManager(org.apache.jackrabbit.oak.spi.security.authentication.external.SyncManager) DefaultSyncHandler(org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler) ExternalIdentityProviderManager(org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityProviderManager) Before(org.junit.Before)

Aggregations

SyncHandler (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncHandler)5 DefaultSyncHandler (org.apache.jackrabbit.oak.spi.security.authentication.external.impl.DefaultSyncHandler)3 AbstractExternalAuthTest (org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest)2 ExternalIdentityProvider (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityProvider)2 Before (org.junit.Before)2 Test (org.junit.Test)2 CheckForNull (javax.annotation.CheckForNull)1 Nonnull (javax.annotation.Nonnull)1 ExternalIdentityProviderManager (org.apache.jackrabbit.oak.spi.security.authentication.external.ExternalIdentityProviderManager)1 SyncManager (org.apache.jackrabbit.oak.spi.security.authentication.external.SyncManager)1