Java Code Examples for org.apache.solr.client.solrj.SolrRequest#getBasicAuthUser()
The following examples show how to use
org.apache.solr.client.solrj.SolrRequest#getBasicAuthUser() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScipioHttpSolrClient.java From scipio-erp with Apache License 2.0 | 5 votes |
/** * Sets basic auth header to either the one in the SolrRequest or the one stored in this client. * <p> * DEV NOTE: Derived from <code>HttpSolrClient#setBasicAuthHeader</code>, which is private in superclass. */ @SuppressWarnings("rawtypes") protected void setBasicAuthHeaderScipio(SolrRequest request, HttpRequestBase method) throws UnsupportedEncodingException { if (request.getBasicAuthUser() != null && request.getBasicAuthPassword() != null) { setBasicAuthHeader(method, request.getBasicAuthUser(), request.getBasicAuthPassword()); } else if (this.solrUsername != null && this.solrPassword != null) { setBasicAuthHeader(method, this.solrUsername, this.solrPassword); } }
Example 2
Source File: Http2SolrClient.java From lucene-solr with Apache License 2.0 | 5 votes |
private void setBasicAuthHeader(@SuppressWarnings({"rawtypes"})SolrRequest solrRequest, Request req) { if (solrRequest.getBasicAuthUser() != null && solrRequest.getBasicAuthPassword() != null) { String userPass = solrRequest.getBasicAuthUser() + ":" + solrRequest.getBasicAuthPassword(); String encoded = Base64.byteArrayToBase64(userPass.getBytes(FALLBACK_CHARSET)); req.header("Authorization", "Basic " + encoded); } }
Example 3
Source File: HttpSolrClient.java From lucene-solr with Apache License 2.0 | 5 votes |
private void setBasicAuthHeader(@SuppressWarnings({"rawtypes"})SolrRequest request, HttpRequestBase method) throws UnsupportedEncodingException { if (request.getBasicAuthUser() != null && request.getBasicAuthPassword() != null) { String userPass = request.getBasicAuthUser() + ":" + request.getBasicAuthPassword(); String encoded = Base64.byteArrayToBase64(userPass.getBytes(FALLBACK_CHARSET)); method.setHeader(new BasicHeader("Authorization", "Basic " + encoded)); } }