All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zipkin2.server.internal.elasticsearch.BasicCredentials Maven / Gradle / Ivy

There is a newer version: 3.4.2
Show newest version
/*
 * Copyright The OpenZipkin Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package zipkin2.server.internal.elasticsearch;

import java.util.Base64;
import zipkin2.internal.Nullable;

import static java.nio.charset.StandardCharsets.UTF_8;

/**
 * Generate Elasticsearch basic user credentials.
 *
 * 

Ref: How * Elasticsearch security works

*/ final class BasicCredentials { private volatile String basicCredentials; BasicCredentials() { } BasicCredentials(String username, String password) { updateCredentials(username, password); } void updateCredentials(String username, String password) { String token = username + ':' + password; basicCredentials = "Basic " + Base64.getEncoder().encodeToString(token.getBytes(UTF_8)); } @Nullable String getCredentials() { return basicCredentials; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy