Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private BulkStreamWriter bulkStreamWriteTo(
ctx.entrySet().forEach(e -> headers.insert(e.getKey(), String.valueOf(e.getValue())));
headers.insert(Keys.Headers.GREPTIMEDB_DBNAME, database);
if (authInfo != null) {
headers.insert(Keys.Headers.GREPTIMEDB_AUTH, authInfo.toBase64());
headers.insert(Keys.Headers.GREPTIMEDB_AUTH, authInfo.base64HeaderValue());
}
HeaderCallOption headerOption = new HeaderCallOption(headers);
AsyncExecCallOption execOption = new AsyncExecCallOption(this.asyncPool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ public static AuthInfo noAuthorization() {
*
* @return the base64 encoded string
*/
public String toBase64() {
String authInfoStr = String.format("%s:%s", this.username, this.password);
return Base64.getEncoder().encodeToString(authInfoStr.getBytes(StandardCharsets.UTF_8));
public String base64HeaderValue() {
String encoded = Base64.getEncoder()
.encodeToString(
String.format("%s:%s", this.username, this.password).getBytes(StandardCharsets.UTF_8));
return String.format("Basic %s", encoded);
}

@Override
Expand Down