CompositeAuthorizationConfiguration extends CompositeConfiguration<AuthorizationConfiguration> implements AuthorizationConfiguration { @NotNull @Override public AccessControlManager getAccessControlManager(@NotNull final Root root, @NotNull final NamePathMapper namePathMapper) { List<AuthorizationConfiguration> configurations = getConfigurations(); switch (configurations.size()) { case 0: throw new IllegalStateException(); case 1: return configurations.get(0).getAccessControlManager(root, namePathMapper); default: List<AccessControlManager> mgrs = Lists.transform(configurations, authorizationConfiguration -> authorizationConfiguration.getAccessControlManager(root, namePathMapper)); return new CompositeAccessControlManager(root, namePathMapper, getSecurityProvider(), mgrs, aggregationFilter); } } CompositeAuthorizationConfiguration();  CompositeAuthorizationConfiguration(@NotNull SecurityProvider securityProvider); void withCompositionType(@Nullable String ct); void withAggregationFilter(@NotNull AggregationFilter aggregationFilter); @NotNull @Override AccessControlManager getAccessControlManager(@NotNull final Root root,
                                                        @NotNull final NamePathMapper namePathMapper); @NotNull @Override RestrictionProvider getRestrictionProvider(); @NotNull @Override PermissionProvider getPermissionProvider(@NotNull final Root root,
                                                    @NotNull final String workspaceName,
                                                    @NotNull final Set<Principal> principals);  }
@Test(expected = IllegalStateException.class) public void testEmptyGetAccessControlManager() { getCompositeConfiguration().getAccessControlManager(root, NamePathMapper.DEFAULT); }
@Test public void testSingleGetAccessControlManager() { CompositeAuthorizationConfiguration cc = getCompositeConfiguration(createAuthorizationConfigurationImpl()); AccessControlManager accessControlManager = cc.getAccessControlManager(root, NamePathMapper.DEFAULT); assertFalse(accessControlManager instanceof CompositeAccessControlManager); }
@Test public void testMultipleGetAccessControlManager() throws RepositoryException { CompositeAuthorizationConfiguration cc = getCompositeConfiguration( createAuthorizationConfigurationImpl(), createAuthorizationConfigurationImpl()); AccessControlManager accessControlManager = cc.getAccessControlManager(root, NamePathMapper.DEFAULT); assertTrue(accessControlManager instanceof CompositeAccessControlManager); }