This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new c548d27 CAMEL-15865: camel-github - Authentication with
username/password removed as its no longer possible on github.
c548d27 is described below
commit c548d27660551d3d9c172397aa19a16633de57f5
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Dec 7 17:10:01 2020 +0100
CAMEL-15865: camel-github - Authentication with username/password removed
as its no longer possible on github.
---
.../camel/catalog/docs/github-component.adoc | 9 +-
.../github/GitHubComponentConfigurer.java | 6 +
.../component/github/GitHubEndpointConfigurer.java | 6 -
.../component/github/GitHubEndpointUriFactory.java | 10 +-
.../org/apache/camel/component/github/github.json | 9 +-
.../src/main/docs/github-component.adoc | 22 ++--
.../camel/component/github/GitHubComponent.java | 19 +++-
.../camel/component/github/GitHubEndpoint.java | 42 ++-----
.../github/consumer/AbstractGitHubConsumer.java | 6 +-
.../github/producer/AbstractGitHubProducer.java | 6 +-
.../component/github/GitHubComponentTestBase.java | 9 ++
.../github/consumer/CommitConsumerTest.java | 4 +-
.../github/consumer/EventConsumerTest.java | 2 +-
.../consumer/EventConsumerWithStrategyTest.java | 2 +-
.../consumer/PullRequestCommentConsumerTest.java | 4 +-
.../github/consumer/PullRequestConsumerTest.java | 4 +-
.../SchedulerConfigurationConsumerTest.java | 4 +-
.../component/github/consumer/TagConsumerTest.java | 4 +-
.../producer/ClosePullRequestProducerTest.java | 4 +-
.../github/producer/CreateIssueProducerTest.java | 4 +-
.../producer/PullRequestCommentProducerTest.java | 4 +-
.../producer/PullRequestFilesProducerTest.java | 4 +-
.../producer/PullRequestStateProducerTest.java | 4 +-
.../dsl/GithubComponentBuilderFactory.java | 13 +++
.../endpoint/dsl/GitHubEndpointBuilderFactory.java | 121 +++++----------------
.../modules/ROOT/pages/github-component.adoc | 9 +-
.../ROOT/pages/camel-3x-upgrade-guide-3_7.adoc | 8 ++
27 files changed, 137 insertions(+), 202 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github-component.adoc
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github-component.adoc
index df75f8e..ba7671a 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github-component.adoc
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/github-component.adoc
@@ -55,7 +55,7 @@ Note that these can be configured directly through the
endpoint.
// component options: START
-The GitHub component supports 3 options, which are listed below.
+The GitHub component supports 4 options, which are listed below.
@@ -65,6 +65,7 @@ The GitHub component supports 3 options, which are listed
below.
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. By default the
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with
exceptions, that will be logged at WARN or ERROR level and ignored. | false |
boolean
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
+| *oauthToken* (security) | GitHub OAuth token. Must be configured on either
component or endpoint. | | String
|===
// component options: END
@@ -90,17 +91,14 @@ with the following path and query parameters:
|===
-=== Query Parameters (30 parameters):
+=== Query Parameters (28 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *oauthToken* (common) | GitHub OAuth token, required unless username &
password are provided | | String
-| *password* (common) | GitHub password, required unless oauthToken is
provided | | String
| *repoName* (common) | *Required* GitHub repository name | | String
| *repoOwner* (common) | *Required* GitHub repository owner (organization) |
| String
-| *username* (common) | GitHub username, required unless oauthToken is
provided | | String
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. By default the
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with
exceptions, that will be logged at WARN or ERROR level and ignored. | false |
boolean
| *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll
any files, you can enable this option to send an empty message (no body)
instead. | false | boolean
| *eventFetchStrategy* (consumer) | To specify a custom strategy that
configures how the EventsConsumer fetches events. | | GitHubEventFetchStrategy
@@ -126,6 +124,7 @@ with the following path and query parameters:
| *startScheduler* (scheduler) | Whether the scheduler should be auto started.
| true | boolean
| *timeUnit* (scheduler) | Time unit for initialDelay and delay options. There
are 7 enums and the value can be one of: NANOSECONDS, MICROSECONDS,
MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS | MILLISECONDS | TimeUnit
| *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used.
See ScheduledExecutorService in JDK for details. | true | boolean
+| *oauthToken* (security) | GitHub OAuth token. Must be configured on either
component or endpoint. | | String
|===
// endpoint options: END
diff --git
a/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubComponentConfigurer.java
b/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubComponentConfigurer.java
index 67cdf86..fc24e64 100644
---
a/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubComponentConfigurer.java
+++
b/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubComponentConfigurer.java
@@ -27,6 +27,8 @@ public class GitHubComponentConfigurer extends
PropertyConfigurerSupport impleme
case "bridgeErrorHandler":
target.setBridgeErrorHandler(property(camelContext, boolean.class, value));
return true;
case "lazystartproducer":
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
+ case "oauthtoken":
+ case "oauthToken": target.setOauthToken(property(camelContext,
java.lang.String.class, value)); return true;
default: return false;
}
}
@@ -40,6 +42,8 @@ public class GitHubComponentConfigurer extends
PropertyConfigurerSupport impleme
case "bridgeErrorHandler": return boolean.class;
case "lazystartproducer":
case "lazyStartProducer": return boolean.class;
+ case "oauthtoken":
+ case "oauthToken": return java.lang.String.class;
default: return null;
}
}
@@ -54,6 +58,8 @@ public class GitHubComponentConfigurer extends
PropertyConfigurerSupport impleme
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
+ case "oauthtoken":
+ case "oauthToken": return target.getOauthToken();
default: return null;
}
}
diff --git
a/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointConfigurer.java
b/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointConfigurer.java
index 7236a0e..92208e0 100644
---
a/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointConfigurer.java
+++
b/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointConfigurer.java
@@ -44,7 +44,6 @@ public class GitHubEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "lazyStartProducer":
target.setLazyStartProducer(property(camelContext, boolean.class, value));
return true;
case "oauthtoken":
case "oauthToken": target.setOauthToken(property(camelContext,
java.lang.String.class, value)); return true;
- case "password": target.setPassword(property(camelContext,
java.lang.String.class, value)); return true;
case "pollstrategy":
case "pollStrategy": target.setPollStrategy(property(camelContext,
org.apache.camel.spi.PollingConsumerPollStrategy.class, value)); return true;
case "repeatcount":
@@ -72,7 +71,6 @@ public class GitHubEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "timeUnit": target.setTimeUnit(property(camelContext,
java.util.concurrent.TimeUnit.class, value)); return true;
case "usefixeddelay":
case "useFixedDelay": target.setUseFixedDelay(property(camelContext,
boolean.class, value)); return true;
- case "username": target.setUsername(property(camelContext,
java.lang.String.class, value)); return true;
default: return false;
}
}
@@ -103,7 +101,6 @@ public class GitHubEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "lazyStartProducer": return boolean.class;
case "oauthtoken":
case "oauthToken": return java.lang.String.class;
- case "password": return java.lang.String.class;
case "pollstrategy":
case "pollStrategy": return
org.apache.camel.spi.PollingConsumerPollStrategy.class;
case "repeatcount":
@@ -131,7 +128,6 @@ public class GitHubEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "timeUnit": return java.util.concurrent.TimeUnit.class;
case "usefixeddelay":
case "useFixedDelay": return boolean.class;
- case "username": return java.lang.String.class;
default: return null;
}
}
@@ -163,7 +159,6 @@ public class GitHubEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "lazyStartProducer": return target.isLazyStartProducer();
case "oauthtoken":
case "oauthToken": return target.getOauthToken();
- case "password": return target.getPassword();
case "pollstrategy":
case "pollStrategy": return target.getPollStrategy();
case "repeatcount":
@@ -191,7 +186,6 @@ public class GitHubEndpointConfigurer extends
PropertyConfigurerSupport implemen
case "timeUnit": return target.getTimeUnit();
case "usefixeddelay":
case "useFixedDelay": return target.isUseFixedDelay();
- case "username": return target.getUsername();
default: return null;
}
}
diff --git
a/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointUriFactory.java
b/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointUriFactory.java
index e456861..6b64317 100644
---
a/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointUriFactory.java
+++
b/components/camel-github/src/generated/java/org/apache/camel/component/github/GitHubEndpointUriFactory.java
@@ -20,14 +20,13 @@ public class GitHubEndpointUriFactory extends
org.apache.camel.support.component
private static final Set<String> PROPERTY_NAMES;
private static final Set<String> SECRET_PROPERTY_NAMES;
static {
- Set<String> props = new HashSet<>(32);
+ Set<String> props = new HashSet<>(30);
props.add("backoffMultiplier");
props.add("eventFetchStrategy");
props.add("synchronous");
props.add("initialDelay");
props.add("type");
props.add("scheduler");
- props.add("password");
props.add("bridgeErrorHandler");
props.add("useFixedDelay");
props.add("runLoggingLevel");
@@ -43,8 +42,8 @@ public class GitHubEndpointUriFactory extends
org.apache.camel.support.component
props.add("schedulerProperties");
props.add("exchangePattern");
props.add("branchName");
- props.add("oauthToken");
props.add("encoding");
+ props.add("oauthToken");
props.add("backoffIdleThreshold");
props.add("lazyStartProducer");
props.add("delay");
@@ -52,9 +51,10 @@ public class GitHubEndpointUriFactory extends
org.apache.camel.support.component
props.add("startScheduler");
props.add("exceptionHandler");
props.add("targetUrl");
- props.add("username");
PROPERTY_NAMES = Collections.unmodifiableSet(props);
- SECRET_PROPERTY_NAMES = Collections.emptySet();
+ Set<String> secretProps = new HashSet<>(1);
+ secretProps.add("oauthToken");
+ SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps);
}
@Override
diff --git
a/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
b/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
index 2072e87..b8f8eee 100644
---
a/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
+++
b/components/camel-github/src/generated/resources/org/apache/camel/component/github/github.json
@@ -24,16 +24,14 @@
"componentProperties": {
"bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Allows for bridging the
consumer to the Camel routing Error Handler, which mean any exceptions occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a me [...]
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start
Producer", "group": "producer", "label": "producer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Whether the producer
should be started lazy (on the first message). By starting lazy you can use
this to allow CamelContext and routes to startup in situations where a producer
may otherwise fail during star [...]
- "autowiredEnabled": { "kind": "property", "displayName": "Autowired
Enabled", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether autowiring is
enabled. This is used for automatic autowiring options (the option must be
marked as autowired) by looking up in the registry to find if there is a single
instance of matching type, which t [...]
+ "autowiredEnabled": { "kind": "property", "displayName": "Autowired
Enabled", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether autowiring is
enabled. This is used for automatic autowiring options (the option must be
marked as autowired) by looking up in the registry to find if there is a single
instance of matching type, which t [...]
+ "oauthToken": { "kind": "property", "displayName": "Oauth Token", "group":
"security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "description": "GitHub OAuth token. Must be configured on
either component or endpoint." }
},
"properties": {
"type": { "kind": "path", "displayName": "Type", "group": "common",
"label": "", "required": true, "type": "object", "javaType":
"org.apache.camel.component.github.GitHubType", "enum": [ "CLOSEPULLREQUEST",
"PULLREQUESTCOMMENT", "COMMIT", "PULLREQUEST", "TAG", "PULLREQUESTSTATE",
"PULLREQUESTFILES", "GETCOMMITFILE", "CREATEISSUE", "EVENT" ], "deprecated":
false, "deprecationNote": "", "autowired": false, "secret": false,
"description": "What git operation to execute" },
"branchName": { "kind": "path", "displayName": "Branch Name", "group":
"consumer", "label": "consumer", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "Name of branch" },
- "oauthToken": { "kind": "parameter", "displayName": "Oauth Token",
"group": "common", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "GitHub OAuth token, required unless username &
password are provided" },
- "password": { "kind": "parameter", "displayName": "Password", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "GitHub password, required unless oauthToken is provided" },
"repoName": { "kind": "parameter", "displayName": "Repo Name", "group":
"common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "GitHub repository name" },
"repoOwner": { "kind": "parameter", "displayName": "Repo Owner", "group":
"common", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "deprecationNote": "", "autowired":
false, "secret": false, "description": "GitHub repository owner (organization)"
},
- "username": { "kind": "parameter", "displayName": "Username", "group":
"common", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "GitHub username, required unless oauthToken is provided" },
"bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error
Handler", "group": "consumer", "label": "consumer", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "description": "Allows for bridging the
consumer to the Camel routing Error Handler, which mean any exceptions occurred
while the consumer is trying to pickup incoming messages, or the likes, will
now be processed as a m [...]
"sendEmptyMessageWhenIdle": { "kind": "parameter", "displayName": "Send
Empty Message When Idle", "group": "consumer", "label": "consumer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description": "If
the polling consumer did not poll any files, you can enable this option to send
an empty message (no body) instead." },
"eventFetchStrategy": { "kind": "parameter", "displayName": "Event Fetch
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.component.github.event.GitHubEventFetchStrategy",
"deprecated": false, "autowired": false, "secret": false, "description": "To
specify a custom strategy that configures how the EventsConsumer fetches
events." },
@@ -58,6 +56,7 @@
"schedulerProperties": { "kind": "parameter", "displayName": "Scheduler
Properties", "group": "scheduler", "label": "consumer,scheduler", "required":
false, "type": "object", "javaType": "java.util.Map<java.lang.String,
java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated":
false, "autowired": false, "secret": false, "description": "To configure
additional properties when using a custom scheduler or any of the Quartz,
Spring based scheduler." },
"startScheduler": { "kind": "parameter", "displayName": "Start Scheduler",
"group": "scheduler", "label": "consumer,scheduler", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the scheduler
should be auto started." },
"timeUnit": { "kind": "parameter", "displayName": "Time Unit", "group":
"scheduler", "label": "consumer,scheduler", "required": false, "type":
"object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS",
"MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"MILLISECONDS", "description": "Time unit for initialDelay and delay options."
},
- "useFixedDelay": { "kind": "parameter", "displayName": "Use Fixed Delay",
"group": "scheduler", "label": "consumer,scheduler", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Controls if fixed delay
or fixed rate is used. See ScheduledExecutorService in JDK for details." }
+ "useFixedDelay": { "kind": "parameter", "displayName": "Use Fixed Delay",
"group": "scheduler", "label": "consumer,scheduler", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Controls if fixed delay
or fixed rate is used. See ScheduledExecutorService in JDK for details." },
+ "oauthToken": { "kind": "parameter", "displayName": "Oauth Token",
"group": "security", "label": "security", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": true, "description": "GitHub OAuth token. Must be configured on
either component or endpoint." }
}
}
diff --git a/components/camel-github/src/main/docs/github-component.adoc
b/components/camel-github/src/main/docs/github-component.adoc
index df75f8e..ca8aec1 100644
--- a/components/camel-github/src/main/docs/github-component.adoc
+++ b/components/camel-github/src/main/docs/github-component.adoc
@@ -49,13 +49,9 @@ for this component:
github://endpoint[?options]
---------------------------
-== Mandatory Options:
-
-Note that these can be configured directly through the endpoint.
-
// component options: START
-The GitHub component supports 3 options, which are listed below.
+The GitHub component supports 4 options, which are listed below.
@@ -65,6 +61,7 @@ The GitHub component supports 3 options, which are listed
below.
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. By default the
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with
exceptions, that will be logged at WARN or ERROR level and ignored. | false |
boolean
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
+| *oauthToken* (security) | GitHub OAuth token. Must be configured on either
component or endpoint. | | String
|===
// component options: END
@@ -90,17 +87,14 @@ with the following path and query parameters:
|===
-=== Query Parameters (30 parameters):
+=== Query Parameters (28 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *oauthToken* (common) | GitHub OAuth token, required unless username &
password are provided | | String
-| *password* (common) | GitHub password, required unless oauthToken is
provided | | String
| *repoName* (common) | *Required* GitHub repository name | | String
| *repoOwner* (common) | *Required* GitHub repository owner (organization) |
| String
-| *username* (common) | GitHub username, required unless oauthToken is
provided | | String
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. By default the
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with
exceptions, that will be logged at WARN or ERROR level and ignored. | false |
boolean
| *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll
any files, you can enable this option to send an empty message (no body)
instead. | false | boolean
| *eventFetchStrategy* (consumer) | To specify a custom strategy that
configures how the EventsConsumer fetches events. | | GitHubEventFetchStrategy
@@ -126,11 +120,21 @@ with the following path and query parameters:
| *startScheduler* (scheduler) | Whether the scheduler should be auto started.
| true | boolean
| *timeUnit* (scheduler) | Time unit for initialDelay and delay options. There
are 7 enums and the value can be one of: NANOSECONDS, MICROSECONDS,
MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS | MILLISECONDS | TimeUnit
| *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used.
See ScheduledExecutorService in JDK for details. | true | boolean
+| *oauthToken* (security) | GitHub OAuth token. Must be configured on either
component or endpoint. | | String
|===
// endpoint options: END
+== Configuring authentication
+
+The github component requires to be configured with an authentication token on
either the component or endpoint level.
+For example to set it on the component:
+[source,java]
+----
+GitHubComponent ghc = context.getComponent("github", GitHubComponent.class);
+ghc.setOauthToken("mytoken");
+----
== Consumer Endpoints:
diff --git
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
index 44dc535..e4f1abf 100644
---
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
+++
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubComponent.java
@@ -19,6 +19,7 @@ package org.apache.camel.component.github;
import java.util.Map;
import org.apache.camel.Endpoint;
+import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;
@@ -28,9 +29,14 @@ import org.apache.camel.support.DefaultComponent;
@Component("github")
public class GitHubComponent extends DefaultComponent {
+ @Metadata(label = "security", secret = true)
+ private String oauthToken;
+
@Override
protected Endpoint createEndpoint(String uri, String remaining,
Map<String, Object> parameters) throws Exception {
GitHubEndpoint endpoint = new GitHubEndpoint(uri, this);
+ endpoint.setOauthToken(oauthToken);
+
setProperties(endpoint, parameters);
String[] parts = remaining.split("/");
@@ -43,7 +49,18 @@ public class GitHubComponent extends DefaultComponent {
endpoint.setBranchName(s);
}
}
-
return endpoint;
}
+
+ public String getOauthToken() {
+ return oauthToken;
+ }
+
+ /**
+ * GitHub OAuth token. Must be configured on either component or endpoint.
+ */
+ public void setOauthToken(String oauthToken) {
+ this.oauthToken = oauthToken;
+ }
+
}
diff --git
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
index ea1ddb9..e8558b4 100644
---
a/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
+++
b/components/camel-github/src/main/java/org/apache/camel/component/github/GitHubEndpoint.java
@@ -37,6 +37,7 @@ import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import org.apache.camel.support.ScheduledPollEndpoint;
+import org.apache.camel.util.ObjectHelper;
import org.apache.camel.util.StringHelper;
/**
@@ -68,11 +69,7 @@ public class GitHubEndpoint extends ScheduledPollEndpoint {
private GitHubType type;
@UriPath(label = "consumer")
private String branchName;
- @UriParam
- private String username;
- @UriParam
- private String password;
- @UriParam
+ @UriParam(label = "security", secret = true)
private String oauthToken;
@UriParam
@Metadata(required = true)
@@ -157,43 +154,17 @@ public class GitHubEndpoint extends ScheduledPollEndpoint
{
this.branchName = branchName;
}
- public String getUsername() {
- return username;
- }
-
- /**
- * GitHub username, required unless oauthToken is provided
- */
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- /**
- * GitHub password, required unless oauthToken is provided
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
public String getOauthToken() {
return oauthToken;
}
/**
- * GitHub OAuth token, required unless username & password are provided
+ * GitHub OAuth token. Must be configured on either component or endpoint.
*/
public void setOauthToken(String oauthToken) {
this.oauthToken = oauthToken;
}
- public boolean hasOauth() {
- return oauthToken != null && oauthToken.length() > 0;
- }
-
public String getRepoOwner() {
return repoOwner;
}
@@ -259,4 +230,11 @@ public class GitHubEndpoint extends ScheduledPollEndpoint {
public void setEventFetchStrategy(GitHubEventFetchStrategy
eventFetchStrategy) {
this.eventFetchStrategy = eventFetchStrategy;
}
+
+ @Override
+ protected void doInit() throws Exception {
+ super.doInit();
+
+ ObjectHelper.notNull(oauthToken, "oauthToken");
+ }
}
diff --git
a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
index 8bcd63e..c2cfc11 100644
---
a/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
+++
b/components/camel-github/src/main/java/org/apache/camel/component/github/consumer/AbstractGitHubConsumer.java
@@ -54,11 +54,7 @@ public abstract class AbstractGitHubConsumer extends
ScheduledPollConsumer {
}
protected void initService(GitHubService service) {
- if (endpoint.hasOauth()) {
- service.getClient().setOAuth2Token(endpoint.getOauthToken());
- } else {
- service.getClient().setCredentials(endpoint.getUsername(),
endpoint.getPassword());
- }
+ service.getClient().setOAuth2Token(endpoint.getOauthToken());
}
protected RepositoryService getRepositoryService() {
diff --git
a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
index 7234efe..d7d7ca2 100644
---
a/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
+++
b/components/camel-github/src/main/java/org/apache/camel/component/github/producer/AbstractGitHubProducer.java
@@ -49,11 +49,7 @@ public abstract class AbstractGitHubProducer extends
DefaultProducer {
}
protected void initService(GitHubService service) {
- if (endpoint.hasOauth()) {
- service.getClient().setOAuth2Token(endpoint.getOauthToken());
- } else {
- service.getClient().setCredentials(endpoint.getUsername(),
endpoint.getPassword());
- }
+ service.getClient().setOAuth2Token(endpoint.getOauthToken());
}
protected RepositoryService getRepositoryService() {
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
index b983796..5b8b6e9 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/GitHubComponentTestBase.java
@@ -17,6 +17,7 @@
package org.apache.camel.component.github;
import org.apache.camel.BindToRegistry;
+import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
import org.apache.camel.component.github.services.MockCommitService;
import org.apache.camel.component.github.services.MockEventService;
@@ -47,6 +48,14 @@ public abstract class GitHubComponentTestBase extends
CamelTestSupport {
@EndpointInject("mock:result")
protected MockEndpoint mockResultEndpoint;
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ CamelContext context = super.createCamelContext();
+ GitHubComponent ghc = context.getComponent("github",
GitHubComponent.class);
+ ghc.setOauthToken("mytoken");
+ return context;
+ }
+
@Test
public void emptyAtStartupTest() throws Exception {
mockResultEndpoint.expectedMessageCount(0);
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerTest.java
index 20985aa..98170d8 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/CommitConsumerTest.java
@@ -20,7 +20,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.eclipse.egit.github.core.RepositoryCommit;
import org.eclipse.egit.github.core.User;
@@ -33,8 +32,7 @@ public class CommitConsumerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
-
from("github://commit/master?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo")
+
from("github://commit/master?repoOwner=anotherguy&repoName=somerepo")
.process(new GitHubCommitProcessor())
.to(mockResultEndpoint);
}
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerTest.java
index 17094f9..3732371 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerTest.java
@@ -53,7 +53,7 @@ public class EventConsumerTest extends
GitHubComponentTestBase {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
-
from("github:event?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo")
+ from("github:event?repoOwner=anotherguy&repoName=somerepo")
.to(mockResultEndpoint);
}
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerWithStrategyTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerWithStrategyTest.java
index bb7e67c..edc72e1 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerWithStrategyTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/EventConsumerWithStrategyTest.java
@@ -74,7 +74,7 @@ public class EventConsumerWithStrategyTest extends
GitHubComponentTestBase {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
-
from("github:event?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo&eventFetchStrategy=#strategy")
+
from("github:event?repoOwner=anotherguy&repoName=somerepo&eventFetchStrategy=#strategy")
.to(mockResultEndpoint);
}
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumerTest.java
index 2e848b7..8a95e8d 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestCommentConsumerTest.java
@@ -20,7 +20,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.eclipse.egit.github.core.Comment;
import org.eclipse.egit.github.core.CommitComment;
@@ -38,8 +37,7 @@ public class PullRequestCommentConsumerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
-
from("github://pullRequestComment?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo")
+
from("github://pullRequestComment?repoOwner=anotherguy&repoName=somerepo")
.process(new PullRequestCommentProcessor())
.to(mockResultEndpoint);
}
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestConsumerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestConsumerTest.java
index fc9e8f5..bf75495 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestConsumerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/PullRequestConsumerTest.java
@@ -20,7 +20,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.eclipse.egit.github.core.PullRequest;
import org.eclipse.egit.github.core.User;
@@ -37,8 +36,7 @@ public class PullRequestConsumerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
-
from("github://pullRequest?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo")
+
from("github://pullRequest?repoOwner=anotherguy&repoName=somerepo")
.process(new MockPullRequestProcessor())
.to(mockResultEndpoint);
}
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/SchedulerConfigurationConsumerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/SchedulerConfigurationConsumerTest.java
index 56d47ef..59ff1d5 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/SchedulerConfigurationConsumerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/SchedulerConfigurationConsumerTest.java
@@ -18,7 +18,6 @@ package org.apache.camel.component.github.consumer;
import org.apache.camel.EndpointInject;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.apache.camel.component.mock.MockEndpoint;
import org.junit.jupiter.api.Test;
@@ -39,8 +38,7 @@ public class SchedulerConfigurationConsumerTest extends
GitHubComponentTestBase
return new RouteBuilder() {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
-
from("github://commit/master?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo&repeatCount=5&sendEmptyMessageWhenIdle=true&delay=1")
+
from("github://commit/master?repoOwner=anotherguy&repoName=somerepo&repeatCount=5&sendEmptyMessageWhenIdle=true&delay=1")
.to(mockCommitsEndpoint);
}
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/TagConsumerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/TagConsumerTest.java
index 0e8747d..b45c0a1 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/TagConsumerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/consumer/TagConsumerTest.java
@@ -20,7 +20,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.eclipse.egit.github.core.RepositoryTag;
import org.junit.jupiter.api.Test;
@@ -33,8 +32,7 @@ public class TagConsumerTest extends GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
-
from("github://tag?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo")
+ from("github://tag?repoOwner=anotherguy&repoName=somerepo")
.process(new RepositoryTagProcessor())
.to(mockResultEndpoint);
}
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
index 1386a7e..b58b74f 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/ClosePullRequestProducerTest.java
@@ -24,7 +24,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.apache.camel.component.github.GitHubConstants;
import org.eclipse.egit.github.core.PullRequest;
@@ -46,10 +45,9 @@ public class ClosePullRequestProducerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
from(PULL_REQUEST_PRODUCER_ENDPOINT)
.process(new ClosePullRequestProducerProcessor())
-
.to("github://closePullRequest?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo");
+
.to("github://closePullRequest?repoOwner=anotherguy&repoName=somerepo");
} // end of configure
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
index 57fa266..bc2ad37 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/CreateIssueProducerTest.java
@@ -23,7 +23,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.apache.camel.component.github.GitHubConstants;
import org.eclipse.egit.github.core.Issue;
@@ -40,10 +39,9 @@ public class CreateIssueProducerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
from("direct:createIssue")
.process(new MockIssueCreateProducerProcessor())
-
.to("github://createissue?state=success&username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo");
+
.to("github://createissue?state=success&repoOwner=anotherguy&repoName=somerepo");
} // end of configure
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
index 556e906..ae23bde 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestCommentProducerTest.java
@@ -25,7 +25,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.apache.camel.component.github.GitHubConstants;
import org.eclipse.egit.github.core.CommitComment;
@@ -46,10 +45,9 @@ public class PullRequestCommentProducerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
from("direct:validPullRequest")
.process(new MockPullRequestCommentProducerProcessor())
-
.to("github://pullRequestComment?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo");
+
.to("github://pullRequestComment?repoOwner=anotherguy&repoName=somerepo");
} // end of configure
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
index 203dd14..4bad3be 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestFilesProducerTest.java
@@ -25,7 +25,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.apache.camel.component.github.GitHubConstants;
import org.eclipse.egit.github.core.CommitFile;
@@ -46,10 +45,9 @@ public class PullRequestFilesProducerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
from("direct:validPullRequest")
.process(new MockPullFilesProducerProcessor())
-
.to("github://pullRequestFiles?username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo");
+
.to("github://pullRequestFiles?repoOwner=anotherguy&repoName=somerepo");
} // end of configure
};
diff --git
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
index 62e7aa0..37a8ec4 100644
---
a/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
+++
b/components/camel-github/src/test/java/org/apache/camel/component/github/producer/PullRequestStateProducerTest.java
@@ -24,7 +24,6 @@ import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.github.GitHubComponent;
import org.apache.camel.component.github.GitHubComponentTestBase;
import org.apache.camel.component.github.GitHubConstants;
import org.eclipse.egit.github.core.CommitStatus;
@@ -43,10 +42,9 @@ public class PullRequestStateProducerTest extends
GitHubComponentTestBase {
@Override
public void configure() throws Exception {
- context.addComponent("github", new GitHubComponent());
from("direct:validPullRequest")
.process(new MockPullRequestStateProducerProcessor())
-
.to("github://pullRequestState?state=success&username=someguy&password=apassword&repoOwner=anotherguy&repoName=somerepo");
+
.to("github://pullRequestState?state=success&repoOwner=anotherguy&repoName=somerepo");
} // end of configure
};
diff --git
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GithubComponentBuilderFactory.java
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GithubComponentBuilderFactory.java
index e16d9da..cbb64e0 100644
---
a/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GithubComponentBuilderFactory.java
+++
b/core/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/GithubComponentBuilderFactory.java
@@ -105,6 +105,18 @@ public interface GithubComponentBuilderFactory {
doSetProperty("autowiredEnabled", autowiredEnabled);
return this;
}
+ /**
+ * GitHub OAuth token. Must be configured on either component or
+ * endpoint.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: security
+ */
+ default GithubComponentBuilder oauthToken(java.lang.String oauthToken)
{
+ doSetProperty("oauthToken", oauthToken);
+ return this;
+ }
}
class GithubComponentBuilderImpl
@@ -125,6 +137,7 @@ public interface GithubComponentBuilderFactory {
case "bridgeErrorHandler": ((GitHubComponent)
component).setBridgeErrorHandler((boolean) value); return true;
case "lazyStartProducer": ((GitHubComponent)
component).setLazyStartProducer((boolean) value); return true;
case "autowiredEnabled": ((GitHubComponent)
component).setAutowiredEnabled((boolean) value); return true;
+ case "oauthToken": ((GitHubComponent)
component).setOauthToken((java.lang.String) value); return true;
default: return false;
}
}
diff --git
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GitHubEndpointBuilderFactory.java
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GitHubEndpointBuilderFactory.java
index 0436073..9c41ab2 100644
---
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GitHubEndpointBuilderFactory.java
+++
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/GitHubEndpointBuilderFactory.java
@@ -47,28 +47,6 @@ public interface GitHubEndpointBuilderFactory {
return (AdvancedGitHubEndpointConsumerBuilder) this;
}
/**
- * GitHub OAuth token, required unless username & password are
provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointConsumerBuilder oauthToken(String oauthToken) {
- doSetProperty("oauthToken", oauthToken);
- return this;
- }
- /**
- * GitHub password, required unless oauthToken is provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointConsumerBuilder password(String password) {
- doSetProperty("password", password);
- return this;
- }
- /**
* GitHub repository name.
*
* The option is a: <code>java.lang.String</code> type.
@@ -93,17 +71,6 @@ public interface GitHubEndpointBuilderFactory {
return this;
}
/**
- * GitHub username, required unless oauthToken is provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointConsumerBuilder username(String username) {
- doSetProperty("username", username);
- return this;
- }
- /**
* Allows for bridging the consumer to the Camel routing Error Handler,
* which mean any exceptions occurred while the consumer is trying to
* pickup incoming messages, or the likes, will now be processed as a
@@ -554,6 +521,18 @@ public interface GitHubEndpointBuilderFactory {
doSetProperty("useFixedDelay", useFixedDelay);
return this;
}
+ /**
+ * GitHub OAuth token. Must be configured on either component or
+ * endpoint.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: security
+ */
+ default GitHubEndpointConsumerBuilder oauthToken(String oauthToken) {
+ doSetProperty("oauthToken", oauthToken);
+ return this;
+ }
}
/**
@@ -722,28 +701,6 @@ public interface GitHubEndpointBuilderFactory {
return (AdvancedGitHubEndpointProducerBuilder) this;
}
/**
- * GitHub OAuth token, required unless username & password are
provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointProducerBuilder oauthToken(String oauthToken) {
- doSetProperty("oauthToken", oauthToken);
- return this;
- }
- /**
- * GitHub password, required unless oauthToken is provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointProducerBuilder password(String password) {
- doSetProperty("password", password);
- return this;
- }
- /**
* GitHub repository name.
*
* The option is a: <code>java.lang.String</code> type.
@@ -768,17 +725,6 @@ public interface GitHubEndpointBuilderFactory {
return this;
}
/**
- * GitHub username, required unless oauthToken is provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointProducerBuilder username(String username) {
- doSetProperty("username", username);
- return this;
- }
- /**
* To use the given encoding when getting a git commit file.
*
* The option is a: <code>java.lang.String</code> type.
@@ -853,6 +799,18 @@ public interface GitHubEndpointBuilderFactory {
doSetProperty("targetUrl", targetUrl);
return this;
}
+ /**
+ * GitHub OAuth token. Must be configured on either component or
+ * endpoint.
+ *
+ * The option is a: <code>java.lang.String</code> type.
+ *
+ * Group: security
+ */
+ default GitHubEndpointProducerBuilder oauthToken(String oauthToken) {
+ doSetProperty("oauthToken", oauthToken);
+ return this;
+ }
}
/**
@@ -905,28 +863,6 @@ public interface GitHubEndpointBuilderFactory {
return (AdvancedGitHubEndpointBuilder) this;
}
/**
- * GitHub OAuth token, required unless username & password are
provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointBuilder oauthToken(String oauthToken) {
- doSetProperty("oauthToken", oauthToken);
- return this;
- }
- /**
- * GitHub password, required unless oauthToken is provided.
- *
- * The option is a: <code>java.lang.String</code> type.
- *
- * Group: common
- */
- default GitHubEndpointBuilder password(String password) {
- doSetProperty("password", password);
- return this;
- }
- /**
* GitHub repository name.
*
* The option is a: <code>java.lang.String</code> type.
@@ -951,14 +887,15 @@ public interface GitHubEndpointBuilderFactory {
return this;
}
/**
- * GitHub username, required unless oauthToken is provided.
+ * GitHub OAuth token. Must be configured on either component or
+ * endpoint.
*
* The option is a: <code>java.lang.String</code> type.
*
- * Group: common
+ * Group: security
*/
- default GitHubEndpointBuilder username(String username) {
- doSetProperty("username", username);
+ default GitHubEndpointBuilder oauthToken(String oauthToken) {
+ doSetProperty("oauthToken", oauthToken);
return this;
}
}
diff --git a/docs/components/modules/ROOT/pages/github-component.adoc
b/docs/components/modules/ROOT/pages/github-component.adoc
index da4ac62..8b92578 100644
--- a/docs/components/modules/ROOT/pages/github-component.adoc
+++ b/docs/components/modules/ROOT/pages/github-component.adoc
@@ -57,7 +57,7 @@ Note that these can be configured directly through the
endpoint.
// component options: START
-The GitHub component supports 3 options, which are listed below.
+The GitHub component supports 4 options, which are listed below.
@@ -67,6 +67,7 @@ The GitHub component supports 3 options, which are listed
below.
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. By default the
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with
exceptions, that will be logged at WARN or ERROR level and ignored. | false |
boolean
| *lazyStartProducer* (producer) | Whether the producer should be started lazy
(on the first message). By starting lazy you can use this to allow CamelContext
and routes to startup in situations where a producer may otherwise fail during
starting and cause the route to fail being started. By deferring this startup
to be lazy then the startup failure can be handled during routing messages via
Camel's routing error handlers. Beware that when the first message is processed
then creating and [...]
| *autowiredEnabled* (advanced) | Whether autowiring is enabled. This is used
for automatic autowiring options (the option must be marked as autowired) by
looking up in the registry to find if there is a single instance of matching
type, which then gets configured on the component. This can be used for
automatic configuring JDBC data sources, JMS connection factories, AWS Clients,
etc. | true | boolean
+| *oauthToken* (security) | GitHub OAuth token. Must be configured on either
component or endpoint. | | String
|===
// component options: END
@@ -92,17 +93,14 @@ with the following path and query parameters:
|===
-=== Query Parameters (30 parameters):
+=== Query Parameters (28 parameters):
[width="100%",cols="2,5,^1,2",options="header"]
|===
| Name | Description | Default | Type
-| *oauthToken* (common) | GitHub OAuth token, required unless username &
password are provided | | String
-| *password* (common) | GitHub password, required unless oauthToken is
provided | | String
| *repoName* (common) | *Required* GitHub repository name | | String
| *repoOwner* (common) | *Required* GitHub repository owner (organization) |
| String
-| *username* (common) | GitHub username, required unless oauthToken is
provided | | String
| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the
Camel routing Error Handler, which mean any exceptions occurred while the
consumer is trying to pickup incoming messages, or the likes, will now be
processed as a message and handled by the routing Error Handler. By default the
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with
exceptions, that will be logged at WARN or ERROR level and ignored. | false |
boolean
| *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll
any files, you can enable this option to send an empty message (no body)
instead. | false | boolean
| *eventFetchStrategy* (consumer) | To specify a custom strategy that
configures how the EventsConsumer fetches events. | | GitHubEventFetchStrategy
@@ -128,6 +126,7 @@ with the following path and query parameters:
| *startScheduler* (scheduler) | Whether the scheduler should be auto started.
| true | boolean
| *timeUnit* (scheduler) | Time unit for initialDelay and delay options. There
are 7 enums and the value can be one of: NANOSECONDS, MICROSECONDS,
MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS | MILLISECONDS | TimeUnit
| *useFixedDelay* (scheduler) | Controls if fixed delay or fixed rate is used.
See ScheduledExecutorService in JDK for details. | true | boolean
+| *oauthToken* (security) | GitHub OAuth token. Must be configured on either
component or endpoint. | | String
|===
// endpoint options: END
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
index 9587bfd..f01ffbf 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_7.adoc
@@ -158,6 +158,14 @@ Other information have been stored in headers declared in
GitConstants class
- GIT_TAG_LEAF - "CamelGitTagLeaf" - Leaf
- GIT_TAG_OBJECT_ID - "CamelGitTagObjectId" - Object Id
+=== camel-github
+
+Login using username and password is no longer supported by github and these
options has been removed
+(https://developer.github.com/changes/2020-02-14-deprecating-password-auth/)
+
+Login must be done using the `oauthToken` option.
+
+
=== Camel-AWS2-S3 Autowire support
The camel-aws2-s3 has now support for autowiring the amazonS3Client option
with S3Client instance coming from the registry.