mirror of
https://github.com/dromara/hertzbeat.git
synced 2026-09-17 09:40:58 +00:00
[MINOR UPDATE] Use Encode to string when possible (Base64) (#3016)
Co-authored-by: aias00 <rokkki@163.com> Co-authored-by: tomsun28 <tomsun28@outlook.com>
This commit is contained in:
co-authored by
aias00
tomsun28
parent
2f3abfbad4
commit
12ba2faa19
@@ -90,7 +90,7 @@ public final class AesUtil {
|
||||
// encode content to byte array
|
||||
byte[] byteAes = cipher.doFinal(byteEncode);
|
||||
// base64 encode content
|
||||
return new String(Base64.getEncoder().encode(byteAes), StandardCharsets.UTF_8);
|
||||
return Base64.getEncoder().encodeToString(byteAes);
|
||||
} catch (Exception e) {
|
||||
log.error("aes encode content error: {}", e.getMessage(), e);
|
||||
return content;
|
||||
|
||||
+2
-2
@@ -194,9 +194,9 @@ public class ServiceAccountService {
|
||||
|
||||
private HttpHeaders createHeaders() {
|
||||
String auth = username + SignConstants.DOUBLE_MARK + password;
|
||||
byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes(StandardCharsets.UTF_8));
|
||||
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
|
||||
String authHeader = NetworkConstants.BASIC
|
||||
+ SignConstants.BLANK + new String(encodedAuth);
|
||||
+ SignConstants.BLANK + encodedAuth;
|
||||
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||
|
||||
Reference in New Issue
Block a user