Skip to content

NIFI-16367 - Add Azure Entra Database Password Provider - #11693

Open
pvillard31 wants to merge 2 commits into
apache:mainfrom
pvillard31:NIFI-16367
Open

pvillard31 wants to merge 2 commits into
apache:mainfrom
pvillard31:NIFI-16367

Conversation

@pvillard31

Copy link
Copy Markdown
Contributor

Summary

NIFI-16367 - Add Azure Entra Database Password Provider

Screenshots of the live testing I did can be provided if needed to help with the review.

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 contains commits signed with a registered key indicating Verified status

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 ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

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

@exceptionfactory exceptionfactory left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for putting this together @pvillard31, the implementation looks good in general, just noted a couple minor recommendations.

| Setting | Value |
|---|---|
| Driver Class Name | `org.postgresql.Driver` |
| JDBC URL | `jdbc:postgresql://<SERVER>.postgres.database.azure.com:5432/<DATABASE>?sslmode=require` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Recommend using verify-full in the example to provide an example of the stronger option as the default.

Suggested change
| JDBC URL | `jdbc:postgresql://<SERVER>.postgres.database.azure.com:5432/<DATABASE>?sslmode=require` |
| JDBC URL | `jdbc:postgresql://<SERVER>.postgres.database.azure.com:5432/<DATABASE>?sslmode=verify-full` |

Comment on lines +92 to +117
final AzureCredentialsService configuredCredentialsService = azureCredentialsService;
if (configuredCredentialsService == null) {
throw new ProcessException(FAILED_PASSWORD_MESSAGE);
}

final TokenCredential credential;
try {
credential = configuredCredentialsService.getCredentials();
} catch (final RuntimeException e) {
throw new ProcessException(FAILED_PASSWORD_MESSAGE);
}

if (credential == null) {
throw new ProcessException(FAILED_PASSWORD_MESSAGE);
}

final AccessToken accessToken;
try {
accessToken = credential.getToken(createTokenRequestContext()).block();
} catch (final RuntimeException e) {
throw new ProcessException(FAILED_PASSWORD_MESSAGE);
}

if (!isValidAccessToken(accessToken)) {
throw new ProcessException(FAILED_PASSWORD_MESSAGE);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All of these failures result in the same message, at minimum, it would be helpful to distinguish between credentials retrieval issues and Access Token issues.


final AccessToken accessToken;
try {
accessToken = credential.getToken(createTokenRequestContext()).block();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like this block() call can hang, is that possible, or should a timeout be added?

return new TokenRequestContext().addScopes(OSS_RDBMS_SCOPE);
}

private boolean isValidAccessToken(final AccessToken accessToken) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this method necessary? It seems very unlikely that that the Access Token would come back blank. On the other hand, a Controller Service implementation could do something wrong. I recommend keeping the null and blank checks, but skipping the expiration check, since that would be handled on the remote side.

@pvillard31

Copy link
Copy Markdown
Contributor Author

Thanks @exceptionfactory - pushed a commit to address your comments

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.

2 participants