Java Code Examples for org.apache.solr.client.solrj.SolrRequest#setBasicAuthCredentials()
The following examples show how to use
org.apache.solr.client.solrj.SolrRequest#setBasicAuthCredentials() .
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: SolrUtil.java From scipio-erp with Apache License 2.0 | 5 votes |
/** * Sets basic Solr auth on the given request. * <p> * NOTE: 2018-04-17: This should largely not be needed now; it should be * already handled in ScipioHttpSolrClient returned by {@link #getQueryHttpSolrClient}, * although doing it in double here on the SolrRequest will not cause any problems. */ public void setSolrRequestAuth(SolrRequest<?> req, String solrUsername, String solrPassword) { if (solrUsername == null) { solrUsername = this.getSolrUsername(); solrPassword = this.getSolrPassword(); } if (solrUsername != null) { req.setBasicAuthCredentials(solrUsername, solrPassword); } }
Example 2
Source File: SolrUtil.java From scipio-erp with Apache License 2.0 | 5 votes |
public void setSolrRequestAuth(SolrRequest<?> req) { String solrUsername = this.getSolrUsername(); if (solrUsername != null) { String solrPassword = this.getSolrPassword(); req.setBasicAuthCredentials(solrUsername, solrPassword); } }
Example 3
Source File: BasicAuthIntegrationTest.java From lucene-solr with Apache License 2.0 | 5 votes |
private QueryResponse executeQuery(ModifiableSolrParams params, String user, String pass) throws IOException, SolrServerException { @SuppressWarnings({"rawtypes"}) SolrRequest req = new QueryRequest(params); req.setBasicAuthCredentials(user, pass); QueryResponse resp = (QueryResponse) req.process(cluster.getSolrClient(), COLLECTION); assertNull(resp.getException()); assertEquals(0, resp.getStatus()); return resp; }
Example 4
Source File: AuthorizedSolrClient.java From beam with Apache License 2.0 | 4 votes |
<ResponseT extends SolrResponse> ResponseT process( String collection, SolrRequest<ResponseT> request) throws IOException, SolrServerException { request.setBasicAuthCredentials(username, password); return request.process(solrClient, collection); }