use of org.jolokia.client.BasicAuthenticator in project camel by apache.
the class JolokiaClientFactory method createJolokiaClient.
public static J4pClient createJolokiaClient(String jolokiaUrl, String username, String password) {
J4pClientBuilder builder = J4pClientBuilderFactory.url(jolokiaUrl);
boolean auth = false;
if (isNotEmpty(username)) {
builder = builder.user(username);
auth = true;
}
if (isNotEmpty(password)) {
builder = builder.password(password);
auth = true;
}
if (auth) {
builder = builder.authenticator(new BasicAuthenticator(true));
}
return builder.build();
}
Aggregations