Search in sources :

Example 1 with SecurityConfiguration

use of org.apache.jackrabbit.oak.spi.security.SecurityConfiguration in project jackrabbit-oak by apache.

the class SecurityProviderImplTest method testBindPrivilegeConfiguration.

@Test
public void testBindPrivilegeConfiguration() {
    PrivilegeConfiguration pc = Mockito.mock(PrivilegeConfiguration.class);
    securityProvider.bindPrivilegeConfiguration(pc);
    assertSame(pc, securityProvider.getConfiguration(PrivilegeConfiguration.class));
    for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
        if (sc instanceof PrivilegeConfiguration) {
            assertSame(pc, sc);
        }
    }
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) PrivilegeConfiguration(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration) Test(org.junit.Test)

Example 2 with SecurityConfiguration

use of org.apache.jackrabbit.oak.spi.security.SecurityConfiguration in project jackrabbit-oak by apache.

the class SecurityProviderImplTest method testUnBindPrivilegeConfiguration.

@Test
public void testUnBindPrivilegeConfiguration() {
    PrivilegeConfiguration pc = Mockito.mock(PrivilegeConfiguration.class);
    securityProvider.bindPrivilegeConfiguration(pc);
    securityProvider.unbindPrivilegeConfiguration(pc);
    assertNull(securityProvider.getConfiguration(PrivilegeConfiguration.class));
    for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
        if (sc instanceof PrivilegeConfiguration) {
            fail();
        }
    }
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) PrivilegeConfiguration(org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration) Test(org.junit.Test)

Example 3 with SecurityConfiguration

use of org.apache.jackrabbit.oak.spi.security.SecurityConfiguration in project jackrabbit-oak by apache.

the class ConfigurationInitializerTest method testInitConfigurationWithParamReturnsSame.

@Test
public void testInitConfigurationWithParamReturnsSame() {
    SecurityConfiguration sc = new SecurityConfiguration.Default();
    assertSame(sc, ConfigurationInitializer.initializeConfiguration(sp, sc, params));
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) Test(org.junit.Test)

Example 4 with SecurityConfiguration

use of org.apache.jackrabbit.oak.spi.security.SecurityConfiguration in project jackrabbit-oak by apache.

the class ConfigurationInitializerTest method testInitBaseConfiguration.

@Test
public void testInitBaseConfiguration() {
    TestConfiguration sc = new TestConfiguration();
    SecurityConfiguration afterInit = ConfigurationInitializer.initializeConfiguration(sp, sc);
    assertSame(sc, afterInit);
    // verify securityprovider
    assertSame(sp, sc.getSecurityProvider());
    // verify params
    ConfigurationParameters parameters = afterInit.getParameters();
    assertTrue(parameters.containsKey("key"));
    assertTrue(parameters.containsKey("key2"));
    assertEquals("initialValue", parameters.get("key"));
    assertEquals("initialValue", parameters.get("key2"));
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) Test(org.junit.Test)

Example 5 with SecurityConfiguration

use of org.apache.jackrabbit.oak.spi.security.SecurityConfiguration in project jackrabbit-oak by apache.

the class ConfigurationInitializerTest method testInitConfigurationReturnsSame.

@Test
public void testInitConfigurationReturnsSame() {
    SecurityConfiguration sc = new SecurityConfiguration.Default();
    assertSame(sc, ConfigurationInitializer.initializeConfiguration(sp, sc));
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) Test(org.junit.Test)

Aggregations

SecurityConfiguration (org.apache.jackrabbit.oak.spi.security.SecurityConfiguration)27 Test (org.junit.Test)21 PrivilegeConfiguration (org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration)4 UserConfiguration (org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)4 CommitHook (org.apache.jackrabbit.oak.spi.commit.CommitHook)3 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)3 ConfigurationParameters (org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)3 AuthenticationConfiguration (org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration)3 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2 ArrayList (java.util.ArrayList)2 CompositeIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.CompositeIndexEditorProvider)2 IndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider)2 WorkspaceInitializer (org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer)2 PrincipalConfiguration (org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration)2 Stopwatch (com.google.common.base.Stopwatch)1 IOException (java.io.IOException)1 Executor (java.util.concurrent.Executor)1 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 Nonnull (javax.annotation.Nonnull)1