lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gregor Kaczor <gkac...@gmx.de>
Subject Re: Basic authentication for stream.url
Date Wed, 17 Nov 2010 18:50:59 GMT
  Hello Jayendra,

i did not quiet understand what you are aiming for. Usually you would 
pass basic authentification credentials along with the url. In Solr+Java 
you might use the following piece of code:

         int port = 80;
         String url = "http://localhost:" + port
                 + "/solr/select";
         String user = "someuser";
         String password = "somepassword";
         CommonsHttpSolrServer commonsHttpSolrServer = null;
         HttpClient httpclient = new HttpClient(
                 new MultiThreadedHttpConnectionManager());
         try {
             commonsHttpSolrServer = new CommonsHttpSolrServer(url, 
httpclient);
             commonsHttpSolrServer.setParser(new XMLResponseParser());
         } catch (MalformedURLException e) {
             e.printStackTrace();
             return;
         }

         if (user != null && password != null) {
             commonsHttpSolrServer.getHttpClient().getParams()
                     .setAuthenticationPreemptive(true);
             Credentials defaultcreds = new 
UsernamePasswordCredentials(user,
                     password);
             
commonsHttpSolrServer.getHttpClient().getState().setCredentials(
                     new AuthScope("localhost", port, AuthScope.ANY_REALM),
                     defaultcreds);
         }

Hope I could help a little.

Kind Regards,
Gregor

On 11/17/2010 02:57 AM, Jayendra Patil wrote:
> We intend to use schema.url for indexing documents. However, the 
> remote urls are secured and would need basic authentication to be able 
> access the document.
>
> The implementation with stream.file would mean to download the files 
> and would cause duplicity, whereas stream.body would have indexing 
> performance issues with the hugh data being transferred over the network.
>
> The current implementation for stream.url in 
> ContentStreamBase.URLStream does not support authentication.
> But can be easily supported by :-
> 1. Passing additional authentication parameter e.g. stream.url.auth 
> with the encoded authentication value - SolrRequestParsers
> 2. Setting Authorization request property for the Connection - 
> ContentStreamBase.URLStream
>     this.conn.setRequestProperty("Authorization", "Basic " + 
> encodedauthentication);
>
> Any suggestions ???
>
> Regards,
> Jayendra
>


-- 
How to find files on the Internet? FindFiles.net <http://findfiles.net>!

Mime
View raw message