If you are using key vault and you want to secure solr basic authentication credential, it is good practice to fetch it from appsettings which will retrieve from key vault server for specific environment at runtime. In order to do that you may have to configure solr configuration programmatically. Below is the useful sitecore stackexchange link that can come handy.
http://sitecore.stackexchange.com/questions/5112/how-to-initialize-solr-end-point-connection-with-basic-authentication-programmat/5145#5145
http://sitecore.stackexchange.com/questions/5112/how-to-initialize-solr-end-point-connection-with-basic-authentication-programmat/5145#5145
namespace MyClassLibrary { public class MyBasicAuthHttpWebRequestFactory : IHttpWebRequestFactory { public MyBasicAuthHttpWebRequestFactory(string username, string password) { this.username = ConfigurationManager.AppSettings["username"]; this.password = ConfigurationManager.AppSettings["password"]; } public IHttpWebRequest Create(string url) { return this.Create(new Uri(url)); } public IHttpWebRequest Create(Uri url) { HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); string base64String = Convert.ToBase64String(Encoding.ASCII.GetBytes(this.username + ":" + this.password)); request.Headers.Add("Authorization", "Basic " + base64String); return (IHttpWebRequest) new HttpWebRequestAdapter(request); } } }
http://sitecore.stackexchange.com/questions/5062/update-the-sitecore-configs-at-runtime-possible/5076#5076
No comments :
Post a Comment