Browse Source

Merge pull request #11468 from thingsboard/fix/vc-ssh-error

VC: fix error message when using https url with private key authentication
pull/11469/head
Viacheslav Klimov 2 years ago
committed by GitHub
parent
commit
efabd86ad6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/GitRepository.java

3
common/version-control/src/main/java/org/thingsboard/server/service/sync/vc/GitRepository.java

@ -467,6 +467,9 @@ public class GitRepository {
if (RepositoryAuthMethod.USERNAME_PASSWORD.equals(settings.getAuthMethod())) {
credentialsProvider = newCredentialsProvider(settings.getUsername(), settings.getPassword());
} 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);
}
return new AuthHandler(credentialsProvider, sshSessionFactory);

Loading…
Cancel
Save