vert-x3/vertx-config

[Git config store] Username & password authentication config is overridden by idRsa

Closed this issue · 6 comments

I'm using the config component with git config store. My config files are stored in a private git repo and I'm authentic by using username and password, which is set via:

new ConfigStoreOptions()
                        .setType("git")
                        .setConfig(new JsonObject()
                                .put("url", ...)
                                .put("path", "local")
                                .put("filesets", ...)
                                .put("user", "user")
                                .put("password", "password");

But I'm not speified a idRsaKeyPath attribute, it always says I don't provide a CredentialsProvider:

org.eclipse.jgit.api.errors.TransportException: https://github.com/xxx/xxx.git: Authentication is required but no CredentialsProvider has been registered
	at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:135)
	at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:267)
	at io.vertx.config.git.GitConfigStore.lambda$update$4(GitConfigStore.java:205)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:272)
	at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)

I've checked the source code, these lines may overrides the pervious CredentialsProvider which is set by username and password:

if(Objects.nonNull(configuration.getString("idRsaKeyPath"))){

Is it a bug? I'm looking for your response, thanks.

These lines do not override the CredentialProvider.
I'm more worried by

.setTransportConfigCallback(transportConfigCallback)
. We should check for null before setting them.

Can you check and open a PR?

@cescoffier Sorry, I'm currently not understanding these codes enough...

@cescoffier @Trumeet let me take a look at this issue. If anyone is already working on this let me know here.

Thanks @SINGS079 !

the issue is with this line where CredentialProvider is missing in case of Username and password authenticated Repo
(

call = git.pull().setRemote(remote).setRemoteBranchName(branch).call();
)

I'm creating a pull request with this fix. Tested with my personal repo.

Can we close this issue as this is already resolved?