Search in sources :

Example 16 with AuthScope

use of org.apache.hc.client5.http.auth.AuthScope in project wildfly-clustering-spring-session by wildfly-clustering.

the class AuthSmokeITCase method createClient.

private static CloseableHttpClient createClient(URL url1, URL url2) {
    CredentialsStore provider = new BasicCredentialsProvider();
    Credentials credentials = new UsernamePasswordCredentials("admin", "password".toCharArray());
    provider.setCredentials(new AuthScope(url1.getHost(), url1.getPort()), credentials);
    provider.setCredentials(new AuthScope(url2.getHost(), url2.getPort()), credentials);
    return HttpClients.custom().setDefaultCredentialsProvider(provider).build();
}
Also used : BasicCredentialsProvider(org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider) CredentialsStore(org.apache.hc.client5.http.auth.CredentialsStore) AuthScope(org.apache.hc.client5.http.auth.AuthScope) Credentials(org.apache.hc.client5.http.auth.Credentials) UsernamePasswordCredentials(org.apache.hc.client5.http.auth.UsernamePasswordCredentials) UsernamePasswordCredentials(org.apache.hc.client5.http.auth.UsernamePasswordCredentials)

Example 17 with AuthScope

use of org.apache.hc.client5.http.auth.AuthScope in project wildfly-clustering-spring-session by wildfly-clustering.

the class AuthSmokeITCase method createClient.

private static CloseableHttpClient createClient(URL url1, URL url2) {
    CredentialsStore provider = new BasicCredentialsProvider();
    Credentials credentials = new UsernamePasswordCredentials("admin", "password".toCharArray());
    provider.setCredentials(new AuthScope(url1.getHost(), url1.getPort()), credentials);
    provider.setCredentials(new AuthScope(url2.getHost(), url2.getPort()), credentials);
    return HttpClients.custom().setDefaultCredentialsProvider(provider).build();
}
Also used : BasicCredentialsProvider(org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider) CredentialsStore(org.apache.hc.client5.http.auth.CredentialsStore) AuthScope(org.apache.hc.client5.http.auth.AuthScope) Credentials(org.apache.hc.client5.http.auth.Credentials) UsernamePasswordCredentials(org.apache.hc.client5.http.auth.UsernamePasswordCredentials) UsernamePasswordCredentials(org.apache.hc.client5.http.auth.UsernamePasswordCredentials)

Aggregations

AuthScope (org.apache.hc.client5.http.auth.AuthScope)16 UsernamePasswordCredentials (org.apache.hc.client5.http.auth.UsernamePasswordCredentials)14 BasicCredentialsProvider (org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider)13 Credentials (org.apache.hc.client5.http.auth.Credentials)6 CloseableHttpClient (org.apache.hc.client5.http.impl.classic.CloseableHttpClient)5 HttpHost (org.apache.hc.core5.http.HttpHost)5 CredentialsStore (org.apache.hc.client5.http.auth.CredentialsStore)3 HttpGet (org.apache.hc.client5.http.classic.methods.HttpGet)3 CloseableHttpResponse (org.apache.hc.client5.http.impl.classic.CloseableHttpResponse)3 AuthCache (org.apache.hc.client5.http.auth.AuthCache)2 NTCredentials (org.apache.hc.client5.http.auth.NTCredentials)2 RequestConfig (org.apache.hc.client5.http.config.RequestConfig)2 BasicAuthCache (org.apache.hc.client5.http.impl.auth.BasicAuthCache)2 Exceptions.throwUnchecked (com.github.tomakehurst.wiremock.common.Exceptions.throwUnchecked)1 LocalNotifier.notifier (com.github.tomakehurst.wiremock.common.LocalNotifier.notifier)1 ProxySettings (com.github.tomakehurst.wiremock.common.ProxySettings)1 NO_PROXY (com.github.tomakehurst.wiremock.common.ProxySettings.NO_PROXY)1 KeyStoreSettings (com.github.tomakehurst.wiremock.common.ssl.KeyStoreSettings)1 NO_STORE (com.github.tomakehurst.wiremock.common.ssl.KeyStoreSettings.NO_STORE)1 RequestMethod (com.github.tomakehurst.wiremock.http.RequestMethod)1