0

Working on setting up basic authentication for our Solr instance to help put some form of security for people internally who might accidentally drop an index in production. We're able to pass the authentication to the CM and CD servers with the following patch:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:search="http://www.sitecore.net/xmlconfig/search/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
  <sitecore role:require="Standalone or ContentManagement or ContentDelivery" search:require="solr">
    <contentSearch>
      <!-- Configuration sections for indexes -->
      <indexConfigurations>
        <solrHttpWebRequestFactory type="HttpWebAdapters.BasicAuthHttpWebRequestFactory, SolrNet" patch:instead="solrHttpWebRequestFactory[@type='HttpWebAdapters.HttpWebRequestFactory, SolrNet']">
          <param hint="username">USERNAME</param>
          <param hint="password">PASSWORD</param>
        </solrHttpWebRequestFactory>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

When attempting to setup a similar override for the xConnect analytics side of our setup this override doesn't work. When referencing Sitecore Docs they only mention the Sitecore.ContentSearch.DefaultSolrConfiguration.config file which is not in the App_data/Sitecore folder or in its jobs/continuous/IndexWorker/App_data/Config folder for an xConnect site.

Is there a way to patch into these sitecore settings for xConnect to have basic auth enabled. My guess would be to edit the sc.Xdb.Collection.WebClient.SOLR.xml manually but the Sitecore.Xdb.Collection.Search.Solr.xml seems to reference a credentials parameter to override.

<member name="M:Sitecore.Xdb.Collection.Search.Solr.WebClientProperties.#ctor(System.Text.Encoding,System.Net.ICredentials)">
            <summary>
            Initializes a new instance of <see cref="T:Sitecore.Xdb.Collection.Search.Solr.WebClientProperties"/>.
            </summary>
            <param name="encoding">The encoding.</param>
            <param name="credentials">The Solr credentials.</param>
</member>

Thanks,

Ty

1

From my Sitecore Ticket...

In order to configure xConnect to use basic authentication you will need to modify the connection string: https://myusername:mypassword@localhost:8983/solr/xdb

For more information please consider reading https://docs.microsoft.com/en-us/dotnet/api/system.uri.userinfo?redirectedfrom=MSDN&view=netframework-4.7.2#System_Uri_UserInfo

So it looks like the only way to use basic auth on xConnect is through the connection string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.