Browse Source

Merge pull request #12651 from thingsboard/fix/http-basic-auth

Fix Basic auth in REST API call node
pull/12662/head
Viacheslav Klimov 2 years ago
committed by GitHub
parent
commit
3eaa885f89
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java

2
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/rest/TbHttpClient.java

@ -343,7 +343,7 @@ public class TbHttpClient {
if (CredentialsType.BASIC == credentials.getType()) {
BasicCredentials basicCredentials = (BasicCredentials) credentials;
String authString = basicCredentials.getUsername() + ":" + basicCredentials.getPassword();
String encodedAuthString = new String(Base64.getDecoder().decode(authString.getBytes(StandardCharsets.UTF_8)));
String encodedAuthString = new String(Base64.getEncoder().encode(authString.getBytes(StandardCharsets.UTF_8)));
headers.add("Authorization", "Basic " + encodedAuthString);
}
}

Loading…
Cancel
Save