mirror of https://github.com/apache/nifi.git
NIFI-9300: Fix AWSCredentialsService EL attribute evaluation. (#5456)
This commit is contained in:
parent
507a8f5bc3
commit
32c7d856c8
|
@ -19,6 +19,7 @@ package org.apache.nifi.processors.aws.credentials.provider.service;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -33,7 +34,6 @@ import org.apache.nifi.controller.ConfigurationContext;
|
|||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialPropertyDescriptors;
|
||||
import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialsProviderFactory;
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
|
||||
import com.amazonaws.auth.AWSCredentialsProvider;
|
||||
|
||||
|
@ -99,21 +99,19 @@ public class AWSCredentialsProviderControllerService extends AbstractControllerS
|
|||
|
||||
@Override
|
||||
protected Collection<ValidationResult> customValidate(final ValidationContext validationContext) {
|
||||
final Collection<ValidationResult> validationFailureResults =
|
||||
credentialsProviderFactory.validate(validationContext);
|
||||
return validationFailureResults;
|
||||
return credentialsProviderFactory.validate(validationContext);
|
||||
}
|
||||
|
||||
@OnEnabled
|
||||
public void onConfigured(final ConfigurationContext context) throws InitializationException {
|
||||
final Map<PropertyDescriptor, String> properties = context.getProperties();
|
||||
properties.keySet().forEach(propertyDescriptor -> {
|
||||
public void onConfigured(final ConfigurationContext context) {
|
||||
final Map<PropertyDescriptor, String> evaluatedProperties = new HashMap<>(context.getProperties());
|
||||
evaluatedProperties.keySet().forEach(propertyDescriptor -> {
|
||||
if (propertyDescriptor.isExpressionLanguageSupported()) {
|
||||
properties.put(propertyDescriptor,
|
||||
evaluatedProperties.put(propertyDescriptor,
|
||||
context.getProperty(propertyDescriptor).evaluateAttributeExpressions().getValue());
|
||||
}
|
||||
});
|
||||
credentialsProvider = credentialsProviderFactory.getCredentialsProvider(properties);
|
||||
credentialsProvider = credentialsProviderFactory.getCredentialsProvider(evaluatedProperties);
|
||||
getLogger().debug("Using credentials provider: " + credentialsProvider.getClass());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue