Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-14154 Add support for oAuth to GetWorkdayReport processor #9631

Closed
wants to merge 1 commit into from

Conversation

sfc-gh-mgemra
Copy link
Contributor

@sfc-gh-mgemra sfc-gh-mgemra commented Jan 14, 2025

Summary

NIFI-14154
Currently, the GetWorkdayReport processor supports only Basic Auth. Adding support for oAuth.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 21

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

@pvillard31
Copy link
Contributor

Reviewing

Copy link
Contributor

@pvillard31 pvillard31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sfc-gh-mgemra and thanks for the PR!

The code changes LGTM, will build and run some tests against a Workday instance. In the meantime, a couple of requests:

  • can you revert changes that are purely import ordering, whitespace, indentation, etc? I wish we had some checkstyle rules in place for this but that would require a lot of work across the whole codebase and it's better to keep the changes as limited as possible.
  • for the two new properties you added, please remove displayName and only use name. I know this is not consistent with the rest of the code for this processor but we are trying to go away from this displayName approach. We should probably mark it as deprecated in the API.

Copy link
Contributor

@exceptionfactory exceptionfactory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @sfc-gh-mgemra, I provided some initial feedback on property naming and dependencies.

In general, the formatting changes should be reverted so that the scope of this pull request is clear.

.build();

public static AllowableValue BASIC_AUTH_TYPE = new AllowableValue(
"basic_auth",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

);

public static AllowableValue OAUTH_TYPE = new AllowableValue(
"oauth",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"oauth",
"OAUTH",

Comment on lines 123 to 124
.name("auth-type")
.displayName("Authorization Type")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new properties, the displayName is not needed and the name can be a human-readable name.

Suggested change
.name("auth-type")
.displayName("Authorization Type")
.name("Authorization Type")

Comment on lines 161 to 162
.name("Access Token Provider")
.displayName("OAuth2 Access Token Provider")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The displayName should be removed as noted on other properties.

Suggested change
.name("Access Token Provider")
.displayName("OAuth2 Access Token Provider")
.name("Access Token Provider")

<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-oauth2-provider-api</artifactId>
<scope>compile</scope>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@pvillard31 pvillard31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played with the code changes against an existing instance of Workday. Things were working as expected to get data out. However, when I configured the controller service for OAuth and before it was enabled for the first time, I used the Verify feature and it returned an error:

Cannot invoke "String.equals(Object)" because "this.grantType" is null.

This is definitely not related to this code change and we can file a follow up JIRA and deal with it separately. It feels like something is missing in terms of initialization for the verify call to be working as expected when the controller service has not been used yet.

Copy link

@sfc-gh-dhandermann sfc-gh-dhandermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the adjustments @sfc-gh-mgemra, the latest version looks good! I will defer to @pvillard31 for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants