Search in sources :

Example 6 with SecurityConfiguration

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

the class InternalSecurityProviderTest method testSetAuthorizationConfiguration.

@Test
public void testSetAuthorizationConfiguration() {
    AuthorizationConfiguration ac = Mockito.mock(AuthorizationConfiguration.class);
    when(ac.getParameters()).thenReturn(PARAMS);
    securityProvider.setAuthorizationConfiguration(ac);
    assertSame(ac, securityProvider.getConfiguration(AuthorizationConfiguration.class));
    for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
        if (sc instanceof AuthorizationConfiguration) {
            assertSame(ac, sc);
        }
    }
    assertEquals(PARAMS, securityProvider.getParameters(AuthorizationConfiguration.NAME));
}
Also used : AuthorizationConfiguration(org.apache.jackrabbit.oak.spi.security.authorization.AuthorizationConfiguration) SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) Test(org.junit.Test)

Example 7 with SecurityConfiguration

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

the class SecurityProviderRegistrationTest method mockConfiguration.

private static <T> T mockConfiguration(Class<? extends SecurityConfiguration> cl) {
    SecurityConfiguration sc = Mockito.mock(cl);
    when(sc.getContext()).thenReturn(new ContextImpl());
    when(sc.getParameters()).thenReturn(ConfigurationParameters.EMPTY);
    return (T) sc;
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration)

Example 8 with SecurityConfiguration

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

the class ConfigurationInitializerTest method testInitNonBaseConfiguration.

@Test
public void testInitNonBaseConfiguration() {
    SecurityConfiguration sc = new SecurityConfiguration.Default();
    ConfigurationInitializer.initializeConfiguration(sp, sc);
    assertFalse(sc.getParameters().containsKey("key"));
}
Also used : SecurityConfiguration(org.apache.jackrabbit.oak.spi.security.SecurityConfiguration) Test(org.junit.Test)

Example 9 with SecurityConfiguration

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

the class ConfigurationInitializerTest method testInitBaseConfigurationWithParamReturnsSame.

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

Example 10 with SecurityConfiguration

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

the class InternalSecurityProviderTest method testSetAuthenticationConfiguration.

@Test
public void testSetAuthenticationConfiguration() {
    AuthenticationConfiguration ac = Mockito.mock(AuthenticationConfiguration.class);
    when(ac.getParameters()).thenReturn(PARAMS);
    securityProvider.setAuthenticationConfiguration(ac);
    assertSame(ac, securityProvider.getConfiguration(AuthenticationConfiguration.class));
    for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
        if (sc instanceof AuthenticationConfiguration) {
            assertSame(ac, sc);
        }
    }
    assertEquals(PARAMS, securityProvider.getParameters(AuthenticationConfiguration.NAME));
}
Also used : AuthenticationConfiguration(org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration) 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