public static Tables newInstance(List<String> tables, SecurityContext securityContext, boolean isAuthorizerInvoked, Principals principals, Keytabs keytabs) { return new Tables(tables, new Security(securityContext, new Authorizer(isAuthorizerInvoked), principals, keytabs)); }
public static HiveDatabases newInstance(List<String> databases, SecurityContext securityContext, Principals principals, Keytabs keytabs) { final Security security = new Security(securityContext, new Authorizer(false), principals, keytabs); return databases == null ? new HiveDatabases(Collections.emptyList(), security) : new HiveDatabases(databases, security); }
/** * Sets authorizer info iff {@code authentication.isEnabled()}, otherwise it is set to null */ public Security(SecurityContext securityContext, Authorizer authorizer, Principals principals, Keytabs keytabs) { this.securityContext = securityContext; this.authentication = new Authentication(securityContext); this.principals = principals; this.keytabs = keytabs; if (authentication.isEnabled()) { this.authorizer = authorizer; } }
public static HBaseNamespaces newInstance(NamespaceDescriptor[] namespaceDescriptors, SecurityContext securityContext, boolean isAuthorizerInvoked, Principals principals, Keytabs keytabs) { List<String> namespaces = Collections.emptyList(); if (namespaceDescriptors != null) { namespaces = Arrays.stream(namespaceDescriptors).map(NamespaceDescriptor::getName).collect(Collectors.toList()); } return new HBaseNamespaces(namespaces, new Security(securityContext, new Authorizer(isAuthorizerInvoked), principals, keytabs)); }
public static KafkaBrokersInfo<KafkaBrokersInfo.BrokerId> brokerIds( List<String> brokerIds, Security security, KafkaBrokerListeners kafkaBrokerListeners) throws IOException { List<KafkaBrokersInfo.BrokerId> brokerIdsType = Collections.emptyList(); if (brokerIds != null) { brokerIdsType = new ArrayList<>(brokerIds.size()); for (String brokerId : brokerIds) { brokerIdsType.add(new KafkaBrokersInfo.BrokerId(brokerId)); } } return new KafkaBrokersInfo<>(brokerIdsType, security, kafkaBrokerListeners.getProtocolToHostsWithPort()); }
private ComponentProcess newComponentProcess(ComponentProcess componentProcess, KafkaBrokerListeners.ListenersPropEntry listenersPropEntry) { ComponentProcess newComponentProcess = new ComponentProcess(); newComponentProcess.setComponentId(componentProcess.getComponentId()); newComponentProcess.setHost(componentProcess.getHost()); newComponentProcess.setTimestamp(componentProcess.getTimestamp()); newComponentProcess.setProtocol(listenersPropEntry.getProtocol().name()); newComponentProcess.setPort(listenersPropEntry.getPort()); return newComponentProcess; }
public Security getSecurity() throws IOException { return new Security(securityContext, new Authorizer(false), getPrincipals(), getKeytabs()); } }
public static KafkaBrokersInfo<String> fromZk( List<String> brokerInfo, Security security, KafkaBrokerListeners kafkaBrokerListeners) throws IOException { return brokerInfo == null ? new KafkaBrokersInfo<>(Collections.<String>emptyList(), security, kafkaBrokerListeners.getProtocolToHostsWithPort()) : new KafkaBrokersInfo<>(brokerInfo, security, kafkaBrokerListeners.getProtocolToHostsWithPort()); }
@JsonProperty("principals") @JsonInclude(JsonInclude.Include.NON_NULL) public Map<String, List<Principal>> getPrincipalsMap() { return getMapIfSecureIfNotEmpty(principals.toMap()); }
@JsonProperty("keytabs") @JsonInclude(JsonInclude.Include.NON_NULL) public Map<String, String > getKeytabsMap() { return getStringsMapIfSecureIfNotEmpty(keytabs.toMap()); }
public Keytabs getKeytabs() throws IOException { return Keytabs.fromAmbariConfig(kafkaEnvConfig); }
public ListenersPropParsed(Map<String, String> configMap) { parseProps(configMap); }
public KafkaBrokerListeners getKafkaBrokerListeners() { return KafkaBrokerListeners.newInstance(brokerConfig, kafkaBroker, kafkaBrokerProcesses); }
/** * Instance built from map with service (e.g Hive, HBase) properties */ public static Keytabs fromServiceProperties(ServiceConfiguration serviceConfig) throws IOException { return fromServiceProperties(serviceConfig.getConfigurationMap()); }
/** * Instance built from services configurations in Ambari */ public static Principals fromAmbariConfig(ServiceConfiguration serviceConfig, Map<String, Pair<Component, Collection<ComponentProcess>>> serviceToComponent) throws IOException { return fromAmbariConfig(serviceConfig.getConfigurationMap(), serviceToComponent); }
/** * Instance built from service configuration properties (e.g hive-metastore.xml, hbase-site.xml) */ public static Principals fromServiceProperties(ServiceConfiguration serviceConfig, Pair<Component, Collection<ComponentProcess>> component) throws IOException { return fromServiceProperties(serviceConfig.getConfigurationMap(), component); }
public KafkaBrokersInfo<HostPort> getBrokerHostPortFromStreamsJson() throws ServiceNotFoundException, ServiceComponentNotFoundException, IOException { return KafkaBrokersInfo.hostPort(kafkaBrokerProcesses, getSecurity(), getKafkaBrokerListeners()); }
public Security getSecurity() throws IOException { return new Security(securityContext, new Authorizer(false), getPrincipals(), getKeytabs()); }
public Keytabs getKeytabs() throws IOException { return Keytabs.fromAmbariConfig(stormEnvConfig); }
/** * Instance built from map with Ambari configurations */ public static Keytabs fromAmbariConfig(ServiceConfiguration serviceConfig) throws IOException { return fromAmbariConfig(serviceConfig.getConfigurationMap()); }