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


##########
nifi-extension-bundles/nifi-workday-bundle/nifi-workday-processors/src/main/java/org/apache/nifi/processors/workday/GetWorkdayReport.java:
##########
@@ -90,77 +93,111 @@ public class GetWorkdayReport extends AbstractProcessor {
     protected static final String GET_WORKDAY_REPORT_JAVA_EXCEPTION_MESSAGE = 
"getworkdayreport.java.exception.message";
     protected static final String RECORD_COUNT = "record.count";
     protected static final String BASIC_PREFIX = "Basic ";
+    protected static final String BEARER_PREFIX = "Bearer ";
     protected static final String HEADER_AUTHORIZATION = "Authorization";
     protected static final String HEADER_CONTENT_TYPE = "Content-Type";
     protected static final String USERNAME_PASSWORD_SEPARATOR = ":";
 
     protected static final PropertyDescriptor REPORT_URL = new 
PropertyDescriptor.Builder()
-        .name("Workday Report URL")
-        .displayName("Workday Report URL")
-        .description("HTTP remote URL of Workday report including a scheme of 
http or https, as well as a hostname or IP address with optional port and path 
elements.")
-        .required(true)
-        .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
-        .addValidator(URL_VALIDATOR)
-        .build();
+            .name("Workday Report URL")
+            .displayName("Workday Report URL")
+            .description("HTTP remote URL of Workday report including a scheme 
of http or https, as well as a hostname or IP address with optional port and 
path elements.")
+            .required(true)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .addValidator(URL_VALIDATOR)
+            .build();
+
+    public static AllowableValue BASIC_AUTH_TYPE = new AllowableValue(
+            "basic_auth",

Review Comment:
   The `value` field should follow enum conventions, so all capitals with 
`BASIC_AUTH` would be best in this scenario.



##########
nifi-extension-bundles/nifi-workday-bundle/nifi-workday-processors/src/main/java/org/apache/nifi/processors/workday/GetWorkdayReport.java:
##########
@@ -90,77 +93,111 @@ public class GetWorkdayReport extends AbstractProcessor {
     protected static final String GET_WORKDAY_REPORT_JAVA_EXCEPTION_MESSAGE = 
"getworkdayreport.java.exception.message";
     protected static final String RECORD_COUNT = "record.count";
     protected static final String BASIC_PREFIX = "Basic ";
+    protected static final String BEARER_PREFIX = "Bearer ";
     protected static final String HEADER_AUTHORIZATION = "Authorization";
     protected static final String HEADER_CONTENT_TYPE = "Content-Type";
     protected static final String USERNAME_PASSWORD_SEPARATOR = ":";
 
     protected static final PropertyDescriptor REPORT_URL = new 
PropertyDescriptor.Builder()
-        .name("Workday Report URL")
-        .displayName("Workday Report URL")
-        .description("HTTP remote URL of Workday report including a scheme of 
http or https, as well as a hostname or IP address with optional port and path 
elements.")
-        .required(true)
-        .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
-        .addValidator(URL_VALIDATOR)
-        .build();
+            .name("Workday Report URL")
+            .displayName("Workday Report URL")
+            .description("HTTP remote URL of Workday report including a scheme 
of http or https, as well as a hostname or IP address with optional port and 
path elements.")
+            .required(true)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .addValidator(URL_VALIDATOR)
+            .build();
+
+    public static AllowableValue BASIC_AUTH_TYPE = new AllowableValue(
+            "basic_auth",
+            "Basic Auth",
+            "Used to access resources using Workday password and username."
+    );
+
+    public static AllowableValue OAUTH_TYPE = new AllowableValue(
+            "oauth",
+            "OAuth",
+            "Used to get fresh access tokens based on a previously acquired 
refresh token. Requires Client ID, Client Secret and Refresh Token."
+    );
+
+    public static final PropertyDescriptor AUTH_TYPE = new 
PropertyDescriptor.Builder()
+            .name("auth-type")
+            .displayName("Authorization Type")
+            .description("The type of authorization for retrieving data from 
Workday resources.")
+            .required(true)
+            .allowableValues(BASIC_AUTH_TYPE, OAUTH_TYPE)
+            .defaultValue(BASIC_AUTH_TYPE.getValue())
+            .build();
 
     protected static final PropertyDescriptor WORKDAY_USERNAME = new 
PropertyDescriptor.Builder()
-        .name("Workday Username")
-        .displayName("Workday Username")
-        .description("The username provided for authentication of Workday 
requests. Encoded using Base64 for HTTP Basic Authentication as described in 
RFC 7617.")
-        .required(true)
-        
.addValidator(StandardValidators.createRegexMatchingValidator(Pattern.compile("^[\\x20-\\x39\\x3b-\\x7e\\x80-\\xff]+$")))
-        .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
-        .build();
+            .name("Workday Username")
+            .displayName("Workday Username")
+            .description("The username provided for authentication of Workday 
requests. Encoded using Base64 for HTTP Basic Authentication as described in 
RFC 7617.")
+            .dependsOn(AUTH_TYPE, BASIC_AUTH_TYPE)
+            .required(true)
+            
.addValidator(StandardValidators.createRegexMatchingValidator(Pattern.compile("^[\\x20-\\x39\\x3b-\\x7e\\x80-\\xff]+$")))
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .build();
 
     protected static final PropertyDescriptor WORKDAY_PASSWORD = new 
PropertyDescriptor.Builder()
-        .name("Workday Password")
-        .displayName("Workday Password")
-        .description("The password provided for authentication of Workday 
requests. Encoded using Base64 for HTTP Basic Authentication as described in 
RFC 7617.")
-        .required(true)
-        .sensitive(true)
-        
.addValidator(StandardValidators.createRegexMatchingValidator(Pattern.compile("^[\\x20-\\x7e\\x80-\\xff]+$")))
-        .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
-        .build();
+            .name("Workday Password")
+            .displayName("Workday Password")
+            .description("The password provided for authentication of Workday 
requests. Encoded using Base64 for HTTP Basic Authentication as described in 
RFC 7617.")
+            .dependsOn(AUTH_TYPE, BASIC_AUTH_TYPE)
+            .required(true)
+            .sensitive(true)
+            
.addValidator(StandardValidators.createRegexMatchingValidator(Pattern.compile("^[\\x20-\\x7e\\x80-\\xff]+$")))
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .build();
 
     protected static final PropertyDescriptor WEB_CLIENT_SERVICE = new 
PropertyDescriptor.Builder()
-        .name("Web Client Service Provider")
-        .description("Web client which is used to communicate with the Workday 
API.")
-        .required(true)
-        .identifiesControllerService(WebClientServiceProvider.class)
-        .build();
+            .name("Web Client Service Provider")
+            .description("Web client which is used to communicate with the 
Workday API.")
+            .required(true)
+            .identifiesControllerService(WebClientServiceProvider.class)
+            .build();
+
+    public static final PropertyDescriptor OAUTH2_ACCESS_TOKEN_PROVIDER =
+            new PropertyDescriptor.Builder()
+                    .name("Access Token Provider")
+                    .displayName("OAuth2 Access Token Provider")

Review Comment:
   The `displayName` should be removed as noted on other properties.
   ```suggestion
                       .name("Access Token Provider")
   ```



##########
nifi-extension-bundles/nifi-workday-bundle/nifi-workday-processors/pom.xml:
##########
@@ -78,6 +78,11 @@
             <artifactId>nifi-schema-registry-service-api</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>nifi-oauth2-provider-api</artifactId>
+            <scope>compile</scope>

Review Comment:
   This scope should be changed to `provided` and declared before other test 
dependencies for consistency.



##########
nifi-extension-bundles/nifi-workday-bundle/nifi-workday-processors/src/main/java/org/apache/nifi/processors/workday/GetWorkdayReport.java:
##########
@@ -90,77 +93,111 @@ public class GetWorkdayReport extends AbstractProcessor {
     protected static final String GET_WORKDAY_REPORT_JAVA_EXCEPTION_MESSAGE = 
"getworkdayreport.java.exception.message";
     protected static final String RECORD_COUNT = "record.count";
     protected static final String BASIC_PREFIX = "Basic ";
+    protected static final String BEARER_PREFIX = "Bearer ";
     protected static final String HEADER_AUTHORIZATION = "Authorization";
     protected static final String HEADER_CONTENT_TYPE = "Content-Type";
     protected static final String USERNAME_PASSWORD_SEPARATOR = ":";
 
     protected static final PropertyDescriptor REPORT_URL = new 
PropertyDescriptor.Builder()
-        .name("Workday Report URL")
-        .displayName("Workday Report URL")
-        .description("HTTP remote URL of Workday report including a scheme of 
http or https, as well as a hostname or IP address with optional port and path 
elements.")
-        .required(true)
-        .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
-        .addValidator(URL_VALIDATOR)
-        .build();
+            .name("Workday Report URL")
+            .displayName("Workday Report URL")
+            .description("HTTP remote URL of Workday report including a scheme 
of http or https, as well as a hostname or IP address with optional port and 
path elements.")
+            .required(true)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .addValidator(URL_VALIDATOR)
+            .build();
+
+    public static AllowableValue BASIC_AUTH_TYPE = new AllowableValue(
+            "basic_auth",
+            "Basic Auth",
+            "Used to access resources using Workday password and username."
+    );
+
+    public static AllowableValue OAUTH_TYPE = new AllowableValue(
+            "oauth",
+            "OAuth",
+            "Used to get fresh access tokens based on a previously acquired 
refresh token. Requires Client ID, Client Secret and Refresh Token."
+    );
+
+    public static final PropertyDescriptor AUTH_TYPE = new 
PropertyDescriptor.Builder()
+            .name("auth-type")
+            .displayName("Authorization Type")

Review Comment:
   For new properties, the `displayName` is not needed and the `name` can be a 
human-readable name.
   ```suggestion
               .name("Authorization Type")
   ```



##########
nifi-extension-bundles/nifi-workday-bundle/nifi-workday-processors/src/main/java/org/apache/nifi/processors/workday/GetWorkdayReport.java:
##########
@@ -90,77 +93,111 @@ public class GetWorkdayReport extends AbstractProcessor {
     protected static final String GET_WORKDAY_REPORT_JAVA_EXCEPTION_MESSAGE = 
"getworkdayreport.java.exception.message";
     protected static final String RECORD_COUNT = "record.count";
     protected static final String BASIC_PREFIX = "Basic ";
+    protected static final String BEARER_PREFIX = "Bearer ";
     protected static final String HEADER_AUTHORIZATION = "Authorization";
     protected static final String HEADER_CONTENT_TYPE = "Content-Type";
     protected static final String USERNAME_PASSWORD_SEPARATOR = ":";
 
     protected static final PropertyDescriptor REPORT_URL = new 
PropertyDescriptor.Builder()
-        .name("Workday Report URL")
-        .displayName("Workday Report URL")
-        .description("HTTP remote URL of Workday report including a scheme of 
http or https, as well as a hostname or IP address with optional port and path 
elements.")
-        .required(true)
-        .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
-        .addValidator(URL_VALIDATOR)
-        .build();
+            .name("Workday Report URL")
+            .displayName("Workday Report URL")
+            .description("HTTP remote URL of Workday report including a scheme 
of http or https, as well as a hostname or IP address with optional port and 
path elements.")
+            .required(true)
+            .expressionLanguageSupported(FLOWFILE_ATTRIBUTES)
+            .addValidator(URL_VALIDATOR)
+            .build();
+
+    public static AllowableValue BASIC_AUTH_TYPE = new AllowableValue(
+            "basic_auth",
+            "Basic Auth",
+            "Used to access resources using Workday password and username."
+    );
+
+    public static AllowableValue OAUTH_TYPE = new AllowableValue(
+            "oauth",

Review Comment:
   ```suggestion
               "OAUTH",
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to