List of usage examples for org.apache.http.impl.client AbstractHttpClient getCredentialsProvider
public synchronized final CredentialsProvider getCredentialsProvider()
From source file:org.springframework.data.solr.server.support.HttpSolrClientFactory.java
private void appendAuthentication(Credentials credentials, String authPolicy, SolrClient solrClient) { if (isHttpSolrClient(solrClient)) { HttpSolrClient httpSolrClient = (HttpSolrClient) solrClient; if (credentials != null && StringUtils.isNotBlank(authPolicy) && assertHttpClientInstance(httpSolrClient.getHttpClient())) { AbstractHttpClient httpClient = (AbstractHttpClient) httpSolrClient.getHttpClient(); httpClient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY), credentials); httpClient.getParams().setParameter(AuthPNames.TARGET_AUTH_PREF, Collections.singletonList(authPolicy)); }/* w w w. j a v a 2s . c o m*/ } }