This is an automated email from the ASF dual-hosted git repository.
exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new f5ecb18fef NIFI-13357 Removed APP_INSTALLATION_TOKEN from
GitHubFlowRegistryClient (#8923)
f5ecb18fef is described below
commit f5ecb18fef271852b389350a17d16b18940115a7
Author: David Handermann <[email protected]>
AuthorDate: Tue Jun 4 10:51:37 2024 -0500
NIFI-13357 Removed APP_INSTALLATION_TOKEN from GitHubFlowRegistryClient
(#8923)
Signed-off-by: David Handermann <[email protected]>
---
.../nifi/github/GitHubAuthenticationType.java | 37 +++++++++++++++++++---
.../nifi/github/GitHubFlowRegistryClient.java | 13 +-------
.../apache/nifi/github/GitHubRepositoryClient.java | 7 ----
3 files changed, 33 insertions(+), 24 deletions(-)
diff --git
a/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubAuthenticationType.java
b/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubAuthenticationType.java
index 8cb7c4be7c..adb74ebef4 100644
---
a/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubAuthenticationType.java
+++
b/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubAuthenticationType.java
@@ -17,13 +17,40 @@
package org.apache.nifi.github;
+import org.apache.nifi.components.DescribedValue;
+
/**
* Enumeration of authentication types for the GitHub client.
*/
-public enum GitHubAuthenticationType {
+public enum GitHubAuthenticationType implements DescribedValue {
+
+ NONE("None", "Authentication disabled"),
+
+ PERSONAL_ACCESS_TOKEN("Personal Access Token", "User-based Personal Access
Token"),
+
+ APP_INSTALLATION("App Installation", "App-based Installation Token
provisioning from a Private Key");
+
+ private final String displayName;
+
+ private final String description;
+
+ GitHubAuthenticationType(final String displayName, final String
description) {
+ this.displayName = displayName;
+ this.description = description;
+ }
+
+ @Override
+ public String getValue() {
+ return name();
+ }
+
+ @Override
+ public String getDisplayName() {
+ return displayName;
+ }
- NONE,
- PERSONAL_ACCESS_TOKEN,
- APP_INSTALLATION_TOKEN,
- APP_INSTALLATION
+ @Override
+ public String getDescription() {
+ return description;
+ }
}
diff --git
a/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java
b/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java
index e17fc33050..da94bddc17 100644
---
a/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java
+++
b/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubFlowRegistryClient.java
@@ -106,7 +106,7 @@ public class GitHubFlowRegistryClient extends
AbstractFlowRegistryClient {
static final PropertyDescriptor AUTHENTICATION_TYPE = new
PropertyDescriptor.Builder()
.name("Authentication Type")
.description("The type of authentication to use for accessing
GitHub")
- .allowableValues(GitHubAuthenticationType.values())
+ .allowableValues(GitHubAuthenticationType.class)
.defaultValue(GitHubAuthenticationType.NONE.name())
.required(true)
.build();
@@ -120,15 +120,6 @@ public class GitHubFlowRegistryClient extends
AbstractFlowRegistryClient {
.dependsOn(AUTHENTICATION_TYPE,
GitHubAuthenticationType.PERSONAL_ACCESS_TOKEN.name())
.build();
- static final PropertyDescriptor APP_INSTALLATION_TOKEN = new
PropertyDescriptor.Builder()
- .name("App Installation Token")
- .description("The app installation token to use for
authentication")
- .addValidator(StandardValidators.NON_BLANK_VALIDATOR)
- .required(true)
- .sensitive(true)
- .dependsOn(AUTHENTICATION_TYPE,
GitHubAuthenticationType.APP_INSTALLATION_TOKEN.name())
- .build();
-
static final PropertyDescriptor APP_ID = new PropertyDescriptor.Builder()
.name("App ID")
.description("Identifier of GitHub App to use for authentication")
@@ -155,7 +146,6 @@ public class GitHubFlowRegistryClient extends
AbstractFlowRegistryClient {
REPOSITORY_PATH,
AUTHENTICATION_TYPE,
PERSONAL_ACCESS_TOKEN,
- APP_INSTALLATION_TOKEN,
APP_ID,
APP_PRIVATE_KEY
);
@@ -660,7 +650,6 @@ public class GitHubFlowRegistryClient extends
AbstractFlowRegistryClient {
.apiUrl(context.getProperty(GITHUB_API_URL).getValue())
.authenticationType(GitHubAuthenticationType.valueOf(context.getProperty(AUTHENTICATION_TYPE).getValue()))
.personalAccessToken(context.getProperty(PERSONAL_ACCESS_TOKEN).getValue())
-
.appInstallationToken(context.getProperty(APP_INSTALLATION_TOKEN).getValue())
.appId(context.getProperty(APP_ID).getValue())
.appPrivateKey(context.getProperty(APP_PRIVATE_KEY).getValue())
.repoOwner(context.getProperty(REPOSITORY_OWNER).getValue())
diff --git
a/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java
b/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java
index 32ec2cff8a..3b4805d52f 100644
---
a/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java
+++
b/nifi-extension-bundles/nifi-github-bundle/nifi-github-extensions/src/main/java/org/apache/nifi/github/GitHubRepositoryClient.java
@@ -86,7 +86,6 @@ public class GitHubRepositoryClient {
switch (authenticationType) {
case PERSONAL_ACCESS_TOKEN ->
gitHubBuilder.withOAuthToken(builder.personalAccessToken);
- case APP_INSTALLATION_TOKEN ->
gitHubBuilder.withAppInstallationToken(builder.appInstallationToken);
case APP_INSTALLATION ->
gitHubBuilder.withAuthorizationProvider(getAppInstallationAuthorizationProvider(builder,
appPermissions));
}
@@ -462,7 +461,6 @@ public class GitHubRepositoryClient {
private String apiUrl;
private GitHubAuthenticationType authenticationType;
private String personalAccessToken;
- private String appInstallationToken;
private String repoOwner;
private String repoName;
private String repoPath;
@@ -484,11 +482,6 @@ public class GitHubRepositoryClient {
return this;
}
- public Builder appInstallationToken(final String appInstallationToken)
{
- this.appInstallationToken = appInstallationToken;
- return this;
- }
-
public Builder repoOwner(final String repoOwner) {
this.repoOwner = repoOwner;
return this;