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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
0 deletions
-
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); |
|
|
|
|