use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.
the class CugConfigurationTest method testExcludedPrincipals.
@Test
public void testExcludedPrincipals() {
ConfigurationParameters params = ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, true, CugConstants.PARAM_CUG_SUPPORTED_PATHS, "/content");
CugConfiguration cc = createConfiguration(params);
List<Principal> excluded = ImmutableList.of(SystemPrincipal.INSTANCE, new AdminPrincipal() {
@Override
public String getName() {
return "admin";
}
}, new SystemUserPrincipal() {
@Override
public String getName() {
return "systemUser";
}
});
for (Principal p : excluded) {
Set<Principal> principals = ImmutableSet.of(p, EveryonePrincipal.getInstance());
PermissionProvider pp = cc.getPermissionProvider(root, "default", principals);
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
}
use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.
the class CugConfigurationWithMountsTest method createConfiguration.
private static CugConfiguration createConfiguration(MountInfoProvider mip) {
ConfigurationParameters params = ConfigurationParameters.of(AbstractCugTest.CUG_CONFIG, ConfigurationParameters.of(CugConstants.PARAM_MOUNT_PROVIDER, mip));
SecurityProvider sp = new CugSecurityProvider(ConfigurationParameters.of(ImmutableMap.of(AuthorizationConfiguration.NAME, params)));
return new CugConfiguration(sp);
}
use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.
the class CugAccessControlManagerTest method testGetEffectivePoliciesNotEnabled.
@Test
public void testGetEffectivePoliciesNotEnabled() throws Exception {
cugAccessControlManager.setPolicy(SUPPORTED_PATH, createCug(SUPPORTED_PATH));
root.commit();
ConfigurationParameters config = ConfigurationParameters.of(AuthorizationConfiguration.NAME, ConfigurationParameters.of(CugConstants.PARAM_CUG_SUPPORTED_PATHS, SUPPORTED_PATHS, CugConstants.PARAM_CUG_ENABLED, false));
CugAccessControlManager acMgr = new CugAccessControlManager(root, NamePathMapper.DEFAULT, new CugSecurityProvider(config), ImmutableSet.copyOf(SUPPORTED_PATHS));
AccessControlPolicy[] policies = acMgr.getEffectivePolicies(SUPPORTED_PATH);
assertEquals(0, policies.length);
AccessControlPolicy[] effectiveOnChild = acMgr.getEffectivePolicies(SUPPORTED_PATH + "/subtree");
assertEquals(0, policies.length);
assertEquals(policies.length, effectiveOnChild.length);
}
use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.
the class CugConfigurationTest method testGetPermissionProviderDisabled2.
@Test
public void testGetPermissionProviderDisabled2() {
ConfigurationParameters params = ConfigurationParameters.of(CugConstants.PARAM_CUG_ENABLED, false, CugConstants.PARAM_CUG_SUPPORTED_PATHS, "/content");
CugConfiguration cc = createConfiguration(params);
PermissionProvider pp = cc.getPermissionProvider(root, "default", ImmutableSet.<Principal>of(EveryonePrincipal.getInstance()));
assertSame(EmptyPermissionProvider.getInstance(), pp);
}
use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.
the class RepositoryUpgrade method mapSecurityConfig.
protected ConfigurationParameters mapSecurityConfig(SecurityConfig config) {
ConfigurationParameters loginConfig = mapConfigurationParameters(config.getLoginModuleConfig(), LoginModuleConfig.PARAM_ADMIN_ID, UserConstants.PARAM_ADMIN_ID, LoginModuleConfig.PARAM_ANONYMOUS_ID, UserConstants.PARAM_ANONYMOUS_ID);
ConfigurationParameters userConfig;
if (config.getSecurityManagerConfig() == null) {
userConfig = ConfigurationParameters.EMPTY;
} else {
userConfig = mapConfigurationParameters(config.getSecurityManagerConfig().getUserManagerConfig(), UserManagerImpl.PARAM_USERS_PATH, UserConstants.PARAM_USER_PATH, UserManagerImpl.PARAM_GROUPS_PATH, UserConstants.PARAM_GROUP_PATH, UserManagerImpl.PARAM_DEFAULT_DEPTH, UserConstants.PARAM_DEFAULT_DEPTH, UserManagerImpl.PARAM_PASSWORD_HASH_ALGORITHM, UserConstants.PARAM_PASSWORD_HASH_ALGORITHM, UserManagerImpl.PARAM_PASSWORD_HASH_ITERATIONS, UserConstants.PARAM_PASSWORD_HASH_ITERATIONS);
}
return ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME, ConfigurationParameters.of(loginConfig, userConfig)));
}
Aggregations