You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/11/04 14:39:21 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6619: NIFI-10760 Add Api key authentication option to ElasticSearchClientServiceImpl

exceptionfactory commented on code in PR #6619:
URL: https://github.com/apache/nifi/pull/6619#discussion_r1014086673


##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)
+            .defaultValue(ALLOWABLE_VALUE_BASIC_AUTH.getValue())
+            .required(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
     PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
             .name("el-cs-username")
             .displayName("Username")
             .description("The username to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
     PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
             .name("el-cs-password")
             .displayName("Password")
             .description("The password to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .sensitive(true)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
+    PropertyDescriptor API_KEY_ID = new PropertyDescriptor.Builder()
+            .name("api-key-id")
+            .displayName("API key id")

Review Comment:
   Property Display Names should capitalize all words:
   ```suggestion
               .displayName("API Key ID")
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)
+            .defaultValue(ALLOWABLE_VALUE_BASIC_AUTH.getValue())
+            .required(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
     PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
             .name("el-cs-username")
             .displayName("Username")
             .description("The username to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
     PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
             .name("el-cs-password")
             .displayName("Password")
             .description("The password to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .sensitive(true)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
+    PropertyDescriptor API_KEY_ID = new PropertyDescriptor.Builder()
+            .name("api-key-id")
+            .displayName("API key id")
+            .description("Unique id of the API key")

Review Comment:
   ```suggestion
               .description("Unique identifier of the API key")
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)
+            .defaultValue(ALLOWABLE_VALUE_BASIC_AUTH.getValue())
+            .required(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
     PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
             .name("el-cs-username")
             .displayName("Username")
             .description("The username to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
     PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
             .name("el-cs-password")
             .displayName("Password")
             .description("The password to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .sensitive(true)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
+    PropertyDescriptor API_KEY_ID = new PropertyDescriptor.Builder()
+            .name("api-key-id")
+            .displayName("API key id")
+            .description("Unique id of the API key")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_API_KEY)
+            .required(false)
+            .sensitive(false)
+            .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
+    PropertyDescriptor API_KEY = new PropertyDescriptor.Builder()
+            .name("api-key")
+            .displayName("API key")

Review Comment:
   ```suggestion
               .displayName("API Key")
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());

Review Comment:
   The `AllowableValue` definitions are not necessary, the `AuthorizationScheme` enum can be used directly.



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java:
##########
@@ -97,6 +105,31 @@ protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
         return properties;
     }
 
+    @Override
+    protected Collection<ValidationResult> customValidate(ValidationContext validationContext) {
+        final List<ValidationResult> results = new ArrayList<>(1);
+
+        final boolean usernameSet = validationContext.getProperty(USERNAME).isSet();
+        final boolean passwordSet = validationContext.getProperty(PASSWORD).isSet();
+
+        if ((usernameSet && !passwordSet) || (!usernameSet && passwordSet)) {
+            results.add(new ValidationResult.Builder().subject("Username and Password").valid(false).explanation("if Username or Password is set, both must be set.").build());
+        }
+
+        final boolean apiKeyIdSet = validationContext.getProperty(API_KEY_ID).isSet();
+        final boolean apiKeySet = validationContext.getProperty(API_KEY).isSet();
+
+        if ((apiKeyIdSet && !apiKeySet) || (!apiKeyIdSet && apiKeySet)) {
+            results.add(new ValidationResult.Builder().subject("API key and API key id").valid(false).explanation("if 'API key id' or 'API key' is set, both must be set.").build());

Review Comment:
   Recommend replacing the property display names with references to the Property Descriptor and using `String.format()` to keep the message synchronized with the Property Display Name.



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java:
##########
@@ -161,6 +197,11 @@ private void setupClient(final ConfigurationContext context) throws MalformedURL
                         credentialsProvider = addCredentials(null, AuthScope.ANY, username, password);
                     }
 
+                    if (apiKeyId != null && apiKey != null) {
+                        final String apiKeyAuth = Base64.getEncoder().encodeToString((apiKeyId + ":" + apiKey).getBytes(StandardCharsets.UTF_8));

Review Comment:
   Recommend separating the string formatting and encoding to separate lines for better readability.



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)
+            .defaultValue(ALLOWABLE_VALUE_BASIC_AUTH.getValue())
+            .required(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
     PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
             .name("el-cs-username")
             .displayName("Username")
             .description("The username to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
     PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
             .name("el-cs-password")
             .displayName("Password")
             .description("The password to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .sensitive(true)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
+    PropertyDescriptor API_KEY_ID = new PropertyDescriptor.Builder()
+            .name("api-key-id")
+            .displayName("API key id")
+            .description("Unique id of the API key")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_API_KEY)
+            .required(false)
+            .sensitive(false)
+            .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)

Review Comment:
   Recommend removing expression language support since Parameters are preferred.



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java:
##########
@@ -130,6 +163,9 @@ private void setupClient(final ConfigurationContext context) throws MalformedURL
         final String username = context.getProperty(USERNAME).evaluateAttributeExpressions().getValue();
         final String password = context.getProperty(PASSWORD).evaluateAttributeExpressions().getValue();
 
+        final String apiKeyId = context.getProperty(API_KEY_ID).evaluateAttributeExpressions().getValue();
+        final String apiKey = context.getProperty(API_KEY).evaluateAttributeExpressions().getValue();

Review Comment:
   ```suggestion
           final String apiKeyId = context.getProperty(API_KEY_ID).getValue();
           final String apiKey = context.getProperty(API_KEY).getValue();
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)
+            .defaultValue(ALLOWABLE_VALUE_BASIC_AUTH.getValue())
+            .required(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
     PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
             .name("el-cs-username")
             .displayName("Username")
             .description("The username to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
     PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
             .name("el-cs-password")
             .displayName("Password")
             .description("The password to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .sensitive(true)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
+    PropertyDescriptor API_KEY_ID = new PropertyDescriptor.Builder()
+            .name("api-key-id")
+            .displayName("API key id")
+            .description("Unique id of the API key")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_API_KEY)
+            .required(false)
+            .sensitive(false)
+            .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
+    PropertyDescriptor API_KEY = new PropertyDescriptor.Builder()
+            .name("api-key")
+            .displayName("API key")
+            .description("API key")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_API_KEY)
+            .required(false)
+            .sensitive(true)
+            .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)

Review Comment:
   Sensitive values should not support expression language, so this should be removed.



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)
+            .defaultValue(ALLOWABLE_VALUE_BASIC_AUTH.getValue())
+            .required(true)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
     PropertyDescriptor USERNAME = new PropertyDescriptor.Builder()
             .name("el-cs-username")
             .displayName("Username")
             .description("The username to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
     PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder()
             .name("el-cs-password")
             .displayName("Password")
             .description("The password to use with XPack security.")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_BASIC_AUTH)
             .required(false)
             .sensitive(true)
             .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
             .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
             .build();
+
+    PropertyDescriptor API_KEY_ID = new PropertyDescriptor.Builder()
+            .name("api-key-id")
+            .displayName("API key id")
+            .description("Unique id of the API key")
+            .dependsOn(AUTHORIZATION_SCHEME, ALLOWABLE_VALUE_API_KEY)
+            .required(false)
+            .sensitive(false)
+            .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
+            .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+            .build();
+
+    PropertyDescriptor API_KEY = new PropertyDescriptor.Builder()
+            .name("api-key")
+            .displayName("API key")
+            .description("API key")

Review Comment:
   ```suggestion
               .description("Encoded API key")
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")

Review Comment:
   ```suggestion
               .description("Authorization Scheme used for authenticating to Elasticsearch using the HTTP Authorization header")
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientService.java:
##########
@@ -52,23 +54,63 @@ public interface ElasticSearchClientService extends ControllerService {
             .addValidator(Validator.VALID)
             .build();
     PropertyDescriptor PROXY_CONFIGURATION_SERVICE = ProxyConfiguration.createProxyConfigPropertyDescriptor(false, ProxySpec.HTTP);
+
+    AllowableValue ALLOWABLE_VALUE_BASIC_AUTH = new AllowableValue(AuthorizationScheme.BASIC.name(), AuthorizationScheme.BASIC.getDisplayName());
+    AllowableValue ALLOWABLE_VALUE_API_KEY = new AllowableValue(AuthorizationScheme.API_KEY.name(), AuthorizationScheme.API_KEY.getDisplayName());
+
+    PropertyDescriptor AUTHORIZATION_SCHEME = new PropertyDescriptor.Builder()
+            .name("authorization-scheme")
+            .displayName("Authorization Scheme")
+            .description("Authorization Scheme used for the authorization.")
+            .allowableValues(ALLOWABLE_VALUE_BASIC_AUTH, ALLOWABLE_VALUE_API_KEY)

Review Comment:
   ```suggestion
               .allowableValues(AuthorizationScheme.class)
   ```



##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service-api/src/main/java/org/apache/nifi/elasticsearch/AuthorizationScheme.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.elasticsearch;
+
+public enum AuthorizationScheme {

Review Comment:
   This enum should implement `DescribedValue` from `nifi-api` and include a description.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org