You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Suneel Pandey <pa...@gmail.com> on 2012/09/12 18:40:19 UTC
Authentication Not working in solrnet getting 401 error
Hi,
I am trying to connect with authenticated solr instance. I have added latest
solrnet .dll but getting authentication issue. Please Suggest me where i
did wrong.
ISolrOperations<SolrProductCorecl> oSolrOperations = null;
const string core0url = "http://localhost:8080/solr/products";
const string core1url = "http://localhost:8080/solr/products";
var solrFacility = new SolrNetFacility(core0url);
var container = new WindsorContainer();
container.AddFacility("solr", solrFacility);
BasicAuthHttpWebRequestFactory OAuth = new
BasicAuthHttpWebRequestFactory("djsrNPvHsUnBSETg", "x");
// override core1 components
const string core1Connection = "core1.connection";
container.Register(Component.For<ISolrConnection>().ImplementedBy<SolrConnection>().Named(core1Connection).Parameters(Castle.MicroKernel.Registration.Parameter.ForKey("serverURL").Eq(core1url)));
container.Register(Component.For(typeof(ISolrBasicOperations<SolrProductCorecl>),
typeof(ISolrBasicReadOnlyOperations<SolrProductCorecl>))
.ImplementedBy<SolrBasicServer<SolrProductCorecl>>()
.ServiceOverrides(ServiceOverride.ForKey("connection").Eq(core1Connection)));
container.Register(Component.For(typeof(ISolrOperations<SolrProductCorecl>),
typeof(ISolrReadOnlyOperations<SolrProductCorecl>))
.ImplementedBy<SolrServer<SolrProductCorecl>>()
.ServiceOverrides(ServiceOverride.ForKey("connection").Eq(core1Connection)));
container.Register(Component.For<ISolrQueryExecuter<SolrProductCorecl>>().ImplementedBy<SolrQueryExecuter<SolrProductCorecl>>()
.ServiceOverrides(ServiceOverride.ForKey("connection").Eq(core1Connection)));
//Authentication//
container.Register(Component.For<IHttpWebRequestFactory>().ImplementedBy<BasicAuthHttpWebRequestFactory>().ServiceOverrides(ServiceOverride.ForKey("connection").Eq("")));
oSolrOperations =
container.Resolve<ISolrOperations<SolrProductCorecl>>();
oSolrOperations.Ping();
-----
Regards,
Suneel Pandey
Sr. Software Developer
--
View this message in context: http://lucene.472066.n3.nabble.com/Authentication-Not-working-in-solrnet-getting-401-error-tp4007254.html
Sent from the Solr - User mailing list archive at Nabble.com.