use of org.apache.druid.java.util.http.client.CredentialedHttpClient in project druid by druid-io.
the class ITTLSTest method testPlaintextAccess.
@Test
public void testPlaintextAccess() {
LOG.info("---------Testing resource access without TLS---------");
HttpClient adminClient = new CredentialedHttpClient(new BasicCredentials("admin", "priest"), httpClient);
makeRequest(adminClient, HttpMethod.GET, config.getCoordinatorUrl() + "/status", null);
makeRequest(adminClient, HttpMethod.GET, config.getOverlordUrl() + "/status", null);
makeRequest(adminClient, HttpMethod.GET, config.getBrokerUrl() + "/status", null);
makeRequest(adminClient, HttpMethod.GET, config.getHistoricalUrl() + "/status", null);
makeRequest(adminClient, HttpMethod.GET, config.getRouterUrl() + "/status", null);
makeRequest(adminClient, HttpMethod.GET, config.getPermissiveRouterUrl() + "/status", null);
makeRequest(adminClient, HttpMethod.GET, config.getNoClientAuthRouterUrl() + "/status", null);
}
use of org.apache.druid.java.util.http.client.CredentialedHttpClient in project druid by druid-io.
the class ITBasicAuthConfigurationTest method setupTestSpecificHttpClients.
@Override
protected void setupTestSpecificHttpClients() throws Exception {
// create a new user+role that can read /status
createUserAndRoleWithPermissions(adminClient, "druid", "helloworld", "druidrole", STATE_ONLY_PERMISSIONS);
// create 100 users
for (int i = 0; i < 100; i++) {
HttpUtil.makeRequest(adminClient, HttpMethod.POST, config.getCoordinatorUrl() + "/druid-ext/basic-security/authentication/db/basic/users/druid" + i, null);
HttpUtil.makeRequest(adminClient, HttpMethod.POST, config.getCoordinatorUrl() + "/druid-ext/basic-security/authorization/db/basic/users/druid" + i, null);
LOG.info("Finished creating user druid" + i);
}
// setup the last of 100 users and check that it works
HttpUtil.makeRequest(adminClient, HttpMethod.POST, config.getCoordinatorUrl() + "/druid-ext/basic-security/authentication/db/basic/users/druid99/credentials", jsonMapper.writeValueAsBytes(new BasicAuthenticatorCredentialUpdate("helloworld", 5000)));
HttpUtil.makeRequest(adminClient, HttpMethod.POST, config.getCoordinatorUrl() + "/druid-ext/basic-security/authorization/db/basic/users/druid99/roles/druidrole", null);
druid99 = new CredentialedHttpClient(new BasicCredentials("druid99", "helloworld"), httpClient);
}
use of org.apache.druid.java.util.http.client.CredentialedHttpClient in project druid by druid-io.
the class AbstractAuthConfigurationTest method verifyInvalidAuthNameFails.
protected void verifyInvalidAuthNameFails(String endpoint) {
HttpClient adminClient = new CredentialedHttpClient(new BasicCredentials("admin", "priest"), httpClient);
HttpUtil.makeRequestWithExpectedStatus(adminClient, HttpMethod.POST, endpoint, "SERIALIZED_DATA".getBytes(StandardCharsets.UTF_8), HttpResponseStatus.INTERNAL_SERVER_ERROR);
}
use of org.apache.druid.java.util.http.client.CredentialedHttpClient in project druid by druid-io.
the class AbstractAuthConfigurationTest method setupCommonHttpClients.
protected void setupCommonHttpClients() {
adminClient = new CredentialedHttpClient(new BasicCredentials("admin", "priest"), httpClient);
datasourceOnlyUserClient = new CredentialedHttpClient(new BasicCredentials("datasourceOnlyUser", "helloworld"), httpClient);
datasourceAndSysUserClient = new CredentialedHttpClient(new BasicCredentials("datasourceAndSysUser", "helloworld"), httpClient);
datasourceWithStateUserClient = new CredentialedHttpClient(new BasicCredentials("datasourceWithStateUser", "helloworld"), httpClient);
stateOnlyUserClient = new CredentialedHttpClient(new BasicCredentials("stateOnlyUser", "helloworld"), httpClient);
internalSystemClient = new CredentialedHttpClient(new BasicCredentials("druid_system", "warlock"), httpClient);
}
use of org.apache.druid.java.util.http.client.CredentialedHttpClient in project druid by druid-io.
the class AbstractAuthConfigurationTest method verifyAdminOptionsRequest.
protected void verifyAdminOptionsRequest() {
HttpClient adminClient = new CredentialedHttpClient(new BasicCredentials("admin", "priest"), httpClient);
testOptionsRequests(adminClient);
}
Aggregations