use of com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProviderTest method roleConfigsWithGateway.
@Test
public void roleConfigsWithGateway() {
GatewayTopology topology = new GatewayTopology();
topology.setTopologyName("my-topology");
topology.setExposedServices(Json.silent(new ExposedServices()));
Gateway gateway = new Gateway();
gateway.setKnoxMasterSecret("admin");
gateway.setPath("/a/b/c");
gateway.setTopologies(Set.of(topology));
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setAccountId(Optional.of("1234"));
IdBroker idBroker = new IdBroker();
idBroker.setMasterSecret("supersecret");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
BlueprintView blueprintView = new BlueprintView("text", "7.2.11", "CDH", blueprintTextProcessor);
TemplatePreparationObject source = Builder.builder().withGateway(gateway, "key", new HashSet<>()).withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(blueprintView).withVirtualGroupView(new VirtualGroupRequest(TestConstants.CRN, "")).withProductDetails(new ClouderaManagerRepo().withVersion("7.4.2"), List.of(new ClouderaManagerProduct().withVersion("7.2.10").withName("CDH"))).withIdBroker(idBroker).build();
when(virtualGroupService.createOrGetVirtualGroup(source.getVirtualGroupRequest(), UmsVirtualGroupRight.KNOX_ADMIN)).thenReturn("");
when(entitlementService.isOjdbcTokenDhOneHour(anyString())).thenReturn(true);
assertEquals(List.of(config("idbroker_master_secret", "supersecret"), config("idbroker_gateway_knox_admin_groups", ""), config("idbroker_gateway_signing_keystore_name", "signing.jks"), config("idbroker_gateway_signing_keystore_type", "JKS"), config("idbroker_gateway_signing_key_alias", "signing-identity")), underTest.getRoleConfigs(KnoxRoles.IDBROKER, source));
assertEquals(List.of(config("gateway_master_secret", gateway.getKnoxMasterSecret()), config("gateway_default_topology_name", gateway.getTopologies().iterator().next().getTopologyName()), config("gateway_knox_admin_groups", ""), config("gateway_auto_discovery_enabled", "false"), config("gateway_path", gateway.getPath()), config("gateway_signing_keystore_name", "signing.jks"), config("gateway_signing_keystore_type", "JKS"), config("gateway_signing_key_alias", "signing-identity"), config("gateway_dispatch_whitelist", "^*.*$"), config("gateway_service_tokenstate_impl", "org.apache.knox.gateway.services.token.impl.JDBCTokenStateService")), ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.getRoleConfigs(KnoxRoles.KNOX_GATEWAY, source)));
assertEquals(List.of(), underTest.getRoleConfigs("NAMENODE", source));
}
use of com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest in project cloudbreak by hortonworks.
the class RangerRoleConfigProvider method getRoleConfigs.
@Override
protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) {
switch(roleType) {
case RangerRoles.RANGER_ADMIN:
String cmVersion = getCmVersion(source);
List<ApiClusterTemplateConfig> configList = new ArrayList<>();
// In CM 7.2.1 and above, the ranger database parameters have moved to the service
// config (see above getServiceConfigs).
RdsView rangerRdsView = getRdsView(source);
if (!isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_1)) {
addDbConfigs(rangerRdsView, configList, cmVersion);
}
addDbSslConfigsIfNeeded(rangerRdsView, configList, cmVersion);
VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
if (isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_0_1)) {
String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.RANGER_ADMIN);
configList.add(config(RANGER_DEFAULT_POLICY_GROUPS, adminGroup));
}
if (isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_6_0)) {
String hbaseAdminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.HBASE_ADMIN);
configList.add(config(RANGER_HBASE_ADMIN_VIRTUAL_GROUPS, hbaseAdminGroup));
}
return configList;
default:
return List.of();
}
}
use of com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest in project cloudbreak by hortonworks.
the class NifiConfigProvider method getServiceConfigs.
@Override
public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
List<ApiClusterTemplateConfig> configList = new ArrayList<>();
String cdhVersion = source.getBlueprintView().getProcessor().getStackVersion() == null ? "" : source.getBlueprintView().getProcessor().getStackVersion();
if (isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERAMANAGER_VERSION_7_1_0)) {
VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.NIFI_ADMIN);
configList.add(config("nifi.initial.admin.groups", adminGroup));
rangerAutoCompleteConfigProvider.extendServiceConfigs(source, configList);
}
return configList;
}
use of com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest in project cloudbreak by hortonworks.
the class NifiRegistryConfigProvider method getServiceConfigs.
@Override
public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
List<ApiClusterTemplateConfig> configList = new ArrayList<>();
String cdhVersion = source.getBlueprintView().getProcessor().getStackVersion() == null ? "" : source.getBlueprintView().getProcessor().getStackVersion();
if (isVersionNewerOrEqualThanLimited(cdhVersion, CLOUDERAMANAGER_VERSION_7_1_0)) {
VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.NIFI_REGISTRY_ADMIN);
configList.add(config("nifi.registry.initial.admin.groups", adminGroup));
rangerAutoCompleteConfigProvider.extendServiceConfigs(source, configList);
}
return configList;
}
use of com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest in project cloudbreak by hortonworks.
the class HbaseServiceConfigProvider method getServiceConfigs.
@Override
public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) {
List<ApiClusterTemplateConfig> configList = new ArrayList<>();
String cmVersion = templateProcessor.getCmVersion().orElse("");
if (isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_0)) {
VirtualGroupRequest virtualGroupRequest = source.getVirtualGroupRequest();
String adminGroup = virtualGroupService.createOrGetVirtualGroup(virtualGroupRequest, UmsVirtualGroupRight.HBASE_ADMIN);
configList.add(config(SPNEGO_ADMIN_GROUP, adminGroup));
}
return configList;
}
Aggregations