public static String encodeBasicAuth(final String username, final String password) {
        requireNonNull(username, "username");
        requireNonNull(password, "password");
        final String auth = username + ':' + password;
        byte[] encoded;
        try {
            encoded = Base64.getEncoder().encode(auth.getBytes(UTF_8));
        } catch (final IllegalArgumentException e) {
            throw new IllegalArgumentException("Failed to encode basic authentication token", e);
        }
        return BASIC_AUTH_PREFIX + new String(encoded, UTF_8);
    }
Encodes the given username and password as basic auth. The header value will be encoded with
{@link StandardCharsets#UTF_8 UTF_8}.

@param username The username to use.
@param password The password to use.
@return The encoded basic auth header value.
@see SecurityConstants#BASIC_AUTH_PREFIX
grpc-client-spring-boot-starter/src/main/java/net/devh/boot/grpc/client/security/CallCredentialsHelper.java