@NotNull public static Root createSystemRoot(@NotNull NodeStore store, @Nullable CommitHook hook, @Nullable String workspaceName, @Nullable SecurityProvider securityProvider, @Nullable QueryIndexProvider indexProvider) { return SystemRoot.create(store, (hook == null) ? EmptyHook.INSTANCE : hook, (workspaceName == null) ? Oak.DEFAULT_WORKSPACE_NAME : workspaceName, (securityProvider == null) ? new OpenSecurityProvider() : securityProvider, (indexProvider == null) ? new CompositeQueryIndexProvider() : indexProvider); } }
@NotNull @Override public <T> T getConfiguration(@NotNull Class<T> configClass) { if (AuthorizationConfiguration.class == configClass) { return (T) new OpenAuthorizationConfiguration() { @NotNull @Override public PermissionProvider getPermissionProvider(@NotNull Root root, @NotNull String workspaceName, @NotNull Set<Principal> principals) { return permissionProvider; } }; } else { return super.getConfiguration(configClass); } } };
@Test public void testGetConfigurations() { Iterable<? extends SecurityConfiguration> configurations = securityProvider.getConfigurations(); assertEquals(2, Iterables.size(configurations)); } }
@Test public void testGetParameters() { assertSame(ConfigurationParameters.EMPTY, securityProvider.getParameters(null)); assertSame(ConfigurationParameters.EMPTY, securityProvider.getParameters(AuthorizationConfiguration.NAME)); }
@NotNull public static Root createSystemRoot(@NotNull NodeStore store, @Nullable CommitHook hook, @Nullable String workspaceName, @Nullable SecurityProvider securityProvider, @Nullable QueryIndexProvider indexProvider) { return SystemRoot.create(store, (hook == null) ? EmptyHook.INSTANCE : hook, (workspaceName == null) ? Oak.DEFAULT_WORKSPACE_NAME : workspaceName, (securityProvider == null) ? new OpenSecurityProvider() : securityProvider, (indexProvider == null) ? new CompositeQueryIndexProvider() : indexProvider); } }
@Test(expected = IllegalArgumentException.class) public void testGetUserConfiguration() { securityProvider.getConfiguration(UserConfiguration.class); }
@Nonnull public static Root createSystemRoot(@Nonnull NodeStore store, @Nullable CommitHook hook, @Nullable String workspaceName, @Nullable SecurityProvider securityProvider, @Nullable QueryIndexProvider indexProvider) { return SystemRoot.create(store, (hook == null) ? EmptyHook.INSTANCE : hook, (workspaceName == null) ? Oak.DEFAULT_WORKSPACE_NAME : workspaceName, (securityProvider == null) ? new OpenSecurityProvider() : securityProvider, (indexProvider == null) ? new CompositeQueryIndexProvider() : indexProvider); } }
@Test(expected = IllegalArgumentException.class) public void testGetPrincipalConfiguration() { securityProvider.getConfiguration(PrincipalConfiguration.class); }
/** * @deprecated with Oak 1.7.2 due to the usage of deprecated {@link QueryEngineSettings} */ @NotNull public static Root createSystemRoot(@NotNull NodeStore store, @Nullable CommitHook hook, @Nullable String workspaceName, @Nullable SecurityProvider securityProvider, @Nullable QueryEngineSettings queryEngineSettings, @Nullable QueryIndexProvider indexProvider) { return SystemRoot.create(store, (hook == null) ? EmptyHook.INSTANCE : hook, (workspaceName == null) ? Oak.DEFAULT_WORKSPACE_NAME : workspaceName, (securityProvider == null) ? new OpenSecurityProvider() : securityProvider, queryEngineSettings, (indexProvider == null) ? new CompositeQueryIndexProvider(): indexProvider); }
@Test public void testGetAuthenticationConfiguration() { assertTrue(securityProvider.getConfiguration(AuthenticationConfiguration.class) instanceof OpenAuthenticationConfiguration); }
/** * @deprecated with Oak 1.7.2 due to the usage of deprecated {@link QueryEngineSettings} */ @NotNull public static Root createSystemRoot(@NotNull NodeStore store, @Nullable CommitHook hook, @Nullable String workspaceName, @Nullable SecurityProvider securityProvider, @Nullable QueryEngineSettings queryEngineSettings, @Nullable QueryIndexProvider indexProvider) { return SystemRoot.create(store, (hook == null) ? EmptyHook.INSTANCE : hook, (workspaceName == null) ? Oak.DEFAULT_WORKSPACE_NAME : workspaceName, (securityProvider == null) ? new OpenSecurityProvider() : securityProvider, queryEngineSettings, (indexProvider == null) ? new CompositeQueryIndexProvider(): indexProvider); }
@Test public void testGetAuthorizationConfiguration() { assertTrue(securityProvider.getConfiguration(AuthorizationConfiguration.class) instanceof OpenAuthorizationConfiguration); }
/** * @deprecated with Oak 1.7.2 due to the usage of deprecated {@link QueryEngineSettings} */ @Nonnull public static Root createSystemRoot(@Nonnull NodeStore store, @Nullable CommitHook hook, @Nullable String workspaceName, @Nullable SecurityProvider securityProvider, @Nullable QueryEngineSettings queryEngineSettings, @Nullable QueryIndexProvider indexProvider) { return SystemRoot.create(store, (hook == null) ? EmptyHook.INSTANCE : hook, (workspaceName == null) ? Oak.DEFAULT_WORKSPACE_NAME : workspaceName, (securityProvider == null) ? new OpenSecurityProvider() : securityProvider, queryEngineSettings, (indexProvider == null) ? new CompositeQueryIndexProvider(): indexProvider); }
@Test public void commitContextInCommitInfo() throws Exception{ CommitInfoCapturingStore store = new CommitInfoCapturingStore(); Oak oak = new Oak(store); ContentRepository repo = oak.with(new OpenSecurityProvider()).createContentRepository(); assertThat(store.infos, is(not(empty()))); for (CommitInfo ci : store.infos){ assertNotNull(ci.getInfo().get(CommitContext.NAME)); } ((Closeable)repo).close(); }
protected ContentSession createContentSession() { return new Oak(store).with(new OpenSecurityProvider()).createContentSession(); } }
protected ContentRepository createContentRepository() { return new Oak(store).with(new OpenSecurityProvider()).createContentRepository(); }
@Test public void testGetSecurityProvider() { AbstractLoginModule loginModule = initLoginModule(TestCredentials.class, new TestCallbackHandler(null, new OpenSecurityProvider(), null)); SecurityProvider securityProvider = loginModule.getSecurityProvider(); assertNotNull(securityProvider); // securityProvider is stored as field -> second access returns the same object assertSame(securityProvider, loginModule.getSecurityProvider()); }
private void registerRequiredServices() { context.registerService(SecurityProvider.class, new OpenSecurityProvider()); context.registerService(NodeStore.class, new MemoryNodeStore()); context.registerService(IndexEditorProvider.class, new PropertyIndexEditorProvider(), ImmutableMap.<String, Object>of("type", "property")); context.registerService(IndexEditorProvider.class, new ReferenceEditorProvider(), ImmutableMap.<String, Object>of("type", "reference")); }
private static ContentRepository newRepo(ThreeWayConflictHandler handler) { return new Oak().with(new OpenSecurityProvider()).with(handler).createContentRepository(); }
private static ContentRepository newRepo(ThreeWayConflictHandler handler) { return new Oak().with(new OpenSecurityProvider()).with(handler).createContentRepository(); }