/** * Indicates whether or not the component contains at least one sensitive property. * * @param component the component to interogate * @return whether or not the component contains at least one sensitive property. */ private boolean containsSensitiveProperties(final ConfigurableComponent component) { for (PropertyDescriptor descriptor : component.getPropertyDescriptors()) { if (descriptor.isSensitive()) { return true; } } return false; }
if (property.isSensitive()) { sensitiveProperties.add(property.getName()); } else {
private static void addConfiguration(final Element element, final Map<PropertyDescriptor, String> properties, final String annotationData, final StringEncryptor encryptor) { final Document doc = element.getOwnerDocument(); for (final Map.Entry<PropertyDescriptor, String> entry : properties.entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); String value = entry.getValue(); if (value != null && descriptor.isSensitive()) { value = ENC_PREFIX + encryptor.encrypt(value) + ENC_SUFFIX; } if (value == null) { value = descriptor.getDefaultValue(); } final Element propElement = doc.createElement("property"); addTextElement(propElement, "name", descriptor.getName()); if (value != null) { addTextElement(propElement, "value", value); } element.appendChild(propElement); } if (annotationData != null) { addTextElement(element, "annotationData", annotationData); } }
private void lookupSensitiveControllerServiceProperties(final Set<ControllerServiceDTO> controllerServices) { // go through each service for (final ControllerServiceDTO serviceDTO : controllerServices) { // ensure that some property configuration have been specified final Map<String, String> serviceProperties = serviceDTO.getProperties(); if (serviceProperties != null) { // find the corresponding controller service final ControllerServiceNode serviceNode = flowController.getFlowManager().getControllerServiceNode(serviceDTO.getId()); if (serviceNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Controller Service '%s' could not be found", serviceDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : serviceNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { serviceProperties.put(descriptor.getName(), entry.getValue()); } } } } }
private Map<String, String> mapProperties(final ComponentNode component, final ControllerServiceProvider serviceProvider) { final Map<String, String> mapped = new HashMap<>(); component.getProperties().keySet().stream() .filter(property -> !property.isSensitive()) .forEach(property -> { String value = component.getProperty(property); if (value == null) { value = property.getDefaultValue(); } if (value != null && property.getControllerServiceDefinition() != null) { // Property references a Controller Service. Instead of storing the existing value, we want // to store the Versioned Component ID of the service. final ControllerServiceNode controllerService = serviceProvider.getControllerServiceNode(value); if (controllerService != null) { value = getId(controllerService.getVersionedComponentId(), controllerService.getIdentifier()); } } mapped.put(property.getName(), value); }); return mapped; }
private void lookupSensitiveProcessorProperties(final Set<ProcessorDTO> processors) { final ProcessGroup rootGroup = flowController.getFlowManager().getRootGroup(); // go through each processor for (final ProcessorDTO processorDTO : processors) { final ProcessorConfigDTO processorConfig = processorDTO.getConfig(); // ensure that some property configuration have been specified if (processorConfig != null && processorConfig.getProperties() != null) { final Map<String, String> processorProperties = processorConfig.getProperties(); // find the corresponding processor final ProcessorNode processorNode = rootGroup.findProcessor(processorDTO.getId()); if (processorNode == null) { throw new IllegalArgumentException(String.format("Unable to create snippet because Processor '%s' could not be found", processorDTO.getId())); } // look for sensitive properties get the actual value for (Entry<PropertyDescriptor, String> entry : processorNode.getProperties().entrySet()) { final PropertyDescriptor descriptor = entry.getKey(); if (descriptor.isSensitive()) { processorProperties.put(descriptor.getName(), entry.getValue()); } } } } }
if (property.isSensitive()) { xmlStreamWriter.writeEmptyElement("br"); writeSimpleElement(xmlStreamWriter, "strong", "Sensitive Property: true");
if (propertyValue != null && descriptor.isSensitive()) { propertyValue = SENSITIVE_VALUE_MASK; } else if (propertyValue == null && descriptor.getDefaultValue() != null) {
if (propertyValue != null && descriptor.isSensitive()) { propertyValue = SENSITIVE_VALUE_MASK;
if (propertyValue != null && descriptor.isSensitive()) { propertyValue = SENSITIVE_VALUE_MASK;
if (propertyValue != null && descriptor.isSensitive()) { propertyValue = SENSITIVE_VALUE_MASK;
if (descriptor.isSensitive()) { continue;
if (propertyDescriptor != null && propertyDescriptor.isSensitive()) { if (newValue != null) { newValue = "********";
if (propertyDescriptor != null && propertyDescriptor.isSensitive()) { if (newValue != null) { newValue = "********";
if (propertyDescriptor != null && propertyDescriptor.isSensitive()) { if (newValue != null) { newValue = "********";
dto.setDisplayName(propertyDescriptor.getDisplayName()); dto.setRequired(propertyDescriptor.isRequired()); dto.setSensitive(propertyDescriptor.isSensitive()); dto.setDynamic(propertyDescriptor.isDynamic()); dto.setDescription(propertyDescriptor.getDescription());
private void writeProperty(final PropertyDescriptor property) throws IOException { writeStartElement("property"); writeTextElement("name", property.getName()); writeTextElement("displayName", property.getDisplayName()); writeTextElement("description", property.getDescription()); writeTextElement("defaultValue", property.getDefaultValue()); writeTextElement("controllerServiceDefinition", property.getControllerServiceDefinition() == null ? null : property.getControllerServiceDefinition().getName()); writeTextArray("allowableValues", "allowableValue", property.getAllowableValues(), AllowableValue::getDisplayName); writeBooleanElement("required", property.isRequired()); writeBooleanElement("sensitive", property.isSensitive()); writeBooleanElement("expressionLanguageSupported", property.isExpressionLanguageSupported()); writeTextElement("expressionLanguageScope", property.getExpressionLanguageScope() == null ? null : property.getExpressionLanguageScope().name()); writeBooleanElement("dynamicallyModifiesClasspath", property.isDynamicClasspathModifier()); writeBooleanElement("dynamic", property.isDynamic()); writeEndElement(); }