Merge pull request #11468 from thingsboard/fix/vc-ssh-error
VC: fix error message when using https url with private key authentication
This commit is contained in:
commit
efabd86ad6
@ -467,6 +467,9 @@ public class GitRepository {
|
|||||||
if (RepositoryAuthMethod.USERNAME_PASSWORD.equals(settings.getAuthMethod())) {
|
if (RepositoryAuthMethod.USERNAME_PASSWORD.equals(settings.getAuthMethod())) {
|
||||||
credentialsProvider = newCredentialsProvider(settings.getUsername(), settings.getPassword());
|
credentialsProvider = newCredentialsProvider(settings.getUsername(), settings.getPassword());
|
||||||
} else if (RepositoryAuthMethod.PRIVATE_KEY.equals(settings.getAuthMethod())) {
|
} else if (RepositoryAuthMethod.PRIVATE_KEY.equals(settings.getAuthMethod())) {
|
||||||
|
if (StringUtils.startsWith(settings.getRepositoryUri(), "https://")) {
|
||||||
|
throw new IllegalArgumentException("Invalid URI format for private key authentication");
|
||||||
|
}
|
||||||
sshSessionFactory = newSshdSessionFactory(settings.getPrivateKey(), settings.getPrivateKeyPassword(), directory);
|
sshSessionFactory = newSshdSessionFactory(settings.getPrivateKey(), settings.getPrivateKeyPassword(), directory);
|
||||||
}
|
}
|
||||||
return new AuthHandler(credentialsProvider, sshSessionFactory);
|
return new AuthHandler(credentialsProvider, sshSessionFactory);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user