Search in sources :

Example 21 with SecurityConfiguration

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

the class SecurityProviderImplTest method testBindUserConfiguration.

@Test
public void testBindUserConfiguration() {
    UserConfiguration uc = Mockito.mock(UserConfiguration.class);
    securityProvider.bindUserConfiguration(uc);
    assertSame(uc, securityProvider.getConfiguration(UserConfiguration.class));
    for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
        if (sc instanceof UserConfiguration) {
            assertSame(uc, sc);
        }
    }
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration) Test(org.junit.Test)

Example 22 with SecurityConfiguration

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

the class ConfigurationInitializerTest method testInitCompositeBaseConfiguration.

@Test
public void testInitCompositeBaseConfiguration() {
    TestComposite<TestConfiguration> composite = new TestComposite<TestConfiguration>();
    composite.addConfiguration(new TestConfiguration());
    composite.addConfiguration(new TestConfiguration());
    ConfigurationInitializer.initializeConfigurations(sp, composite, params);
    // verify securityprovider
    assertSame(sp, composite.getSecurityProvider());
    // verify params
    for (SecurityConfiguration sc : composite.getConfigurations()) {
        ConfigurationParameters parameters = sc.getParameters();
        assertTrue(parameters.containsKey("key"));
        assertTrue(parameters.containsKey("key2"));
        assertEquals("value", 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 23 with SecurityConfiguration

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

the class InternalSecurityProviderTest method testSetTokenConfiguration.

@Test
public void testSetTokenConfiguration() {
    TokenConfiguration tc = Mockito.mock(TokenConfiguration.class);
    when(tc.getParameters()).thenReturn(PARAMS);
    securityProvider.setTokenConfiguration(tc);
    assertSame(tc, securityProvider.getConfiguration(TokenConfiguration.class));
    for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
        if (sc instanceof TokenConfiguration) {
            assertSame(tc, sc);
        }
    }
    assertEquals(PARAMS, securityProvider.getParameters(TokenConfiguration.NAME));
}
Also used : TokenConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration) SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) Test(org.junit.Test)

Example 24 with SecurityConfiguration

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

the class ConfigurationInitializerTest method testInitBaseConfigurationWithParam.

@Test
public void testInitBaseConfigurationWithParam() {
    TestConfiguration sc = new TestConfiguration();
    SecurityConfiguration afterInit = ConfigurationInitializer.initializeConfiguration(sp, sc, params);
    assertSame(sc, afterInit);
    // verify securityprovider
    assertSame(sp, sc.getSecurityProvider());
    // verify params
    ConfigurationParameters parameters = afterInit.getParameters();
    assertTrue(parameters.containsKey("key"));
    assertTrue(parameters.containsKey("key2"));
    assertEquals("value", 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 25 with SecurityConfiguration

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

the class ConfigurationInitializerTest method testInitBaseConfigurationReturnsSame.

@Test
public void testInitBaseConfigurationReturnsSame() {
    SecurityConfiguration sc = new TestConfiguration();
    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