stijn192 commented on a change in pull request #4430:
URL: https://github.com/apache/nifi/pull/4430#discussion_r475399575
##########
File path:
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/storage/AzureStorageCredentialsControllerService.java
##########
@@ -77,16 +78,37 @@
final String accountKey =
validationContext.getProperty(AzureStorageUtils.ACCOUNT_KEY).getValue();
final String sasToken =
validationContext.getProperty(AzureStorageUtils.PROP_SAS_TOKEN).getValue();
- if (StringUtils.isBlank(accountKey) && StringUtils.isBlank(sasToken)) {
+ final Boolean accountKeyIsSet =
validationContext.getProperty(AzureStorageUtils.ACCOUNT_KEY).isSet();
+ final Boolean sasTokenIsSet =
validationContext.getProperty(AzureStorageUtils.PROP_SAS_TOKEN).isSet();
+
+ if (StringUtils.isAllBlank(accountKey, sasToken)) {
results.add(new
ValidationResult.Builder().subject("AzureStorageCredentialsControllerService")
.valid(false)
.explanation("either " +
AzureStorageUtils.ACCOUNT_KEY.getDisplayName() + " or " +
AzureStorageUtils.PROP_SAS_TOKEN.getDisplayName() + " is required")
.build());
- } else if (StringUtils.isNotBlank(accountKey) &&
StringUtils.isNotBlank(sasToken)) {
- results.add(new
ValidationResult.Builder().subject("AzureStorageCredentialsControllerService")
+ }
+
+ if (BooleanUtils.xor(new Boolean[] { accountKeyIsSet, sasTokenIsSet
})) {
+ if (accountKeyIsSet) {
+ if (StringUtils.isBlank(accountKey)) {
+ results.add(new
ValidationResult.Builder().subject("AzureStorageCredentialsControllerService")
.valid(false)
- .explanation("cannot set both " +
AzureStorageUtils.ACCOUNT_KEY.getDisplayName() + " and " +
AzureStorageUtils.PROP_SAS_TOKEN.getDisplayName())
+
.explanation(AzureStorageUtils.ACCOUNT_KEY.getDisplayName() + " must be set
when using Account Key authentication.")
.build());
+ }
+ } else if (sasTokenIsSet) {
+ if (StringUtils.isBlank(sasToken)) {
+ results.add(new
ValidationResult.Builder().subject("AzureStorageCredentialsControllerService")
+ .valid(false)
+
.explanation(AzureStorageUtils.PROP_SAS_TOKEN.getDisplayName() + " must be set
when using SAS token authentication.")
+ .build());
+ }
Review comment:
Also added an validator on the parameter.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]