SOLR-8000: security.json is not loaded on server start

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1700751 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2015-09-02 10:15:18 +00:00
parent f515227898
commit 51510e2274
3 changed files with 17 additions and 2 deletions

View File

@ -186,6 +186,9 @@ Bug Fixes
* SOLR-7844: Zookeeper session expiry during shard leader election can cause multiple leaders.
(Mike Roberts, Mark Miller, Jessica Cheng)
* SOLR-8000: security.json is not loaded on server start (noble)
Optimizations
----------------------

View File

@ -35,6 +35,7 @@ import org.apache.http.message.AbstractHttpMessage;
import org.apache.http.message.BasicHeader;
import org.apache.http.util.EntityUtils;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.request.GenericSolrRequest;
@ -64,7 +65,6 @@ public class BasicAuthIntegrationTest extends TestMiniSolrCloudCluster {
private static final Logger log = LoggerFactory.getLogger(BasicAuthIntegrationTest.class);
@Override
protected void doExtraTests(MiniSolrCloudCluster miniCluster, SolrZkClient zkClient, ZkStateReader zkStateReader,
CloudSolrClient cloudSolrClient, String defaultCollName) throws Exception {
@ -73,10 +73,21 @@ public class BasicAuthIntegrationTest extends TestMiniSolrCloudCluster {
assertNotNull(rsp.get(CommandOperation.ERR_MSGS));
zkClient.setData("/security.json", STD_CONF.replaceAll("'", "\"").getBytes(UTF_8), true);
String baseUrl = getRandomReplica(zkStateReader.getClusterState().getCollection(defaultCollName), random()).getStr(BASE_URL_PROP);
HttpClient cl = cloudSolrClient.getLbClient().getHttpClient();
verifySecurityStatus(cl, baseUrl + "/admin/authentication", "authentication/class", "solr.BasicAuthPlugin", 20);
boolean found = false;
for (JettySolrRunner jettySolrRunner : miniCluster.getJettySolrRunners()) {
if(baseUrl.contains(String.valueOf(jettySolrRunner.getLocalPort()))){
found = true;
jettySolrRunner.stop();
jettySolrRunner.start();
verifySecurityStatus(cl, baseUrl + "/admin/authentication", "authentication/class", "solr.BasicAuthPlugin", 20);
break;
}
}
assertTrue("No server found to restart , looking for : "+baseUrl , found);
String command = "{\n" +
"'set-user': {'harry':'HarryIsCool'}\n" +
"}";

View File

@ -374,6 +374,7 @@ public class ZkStateReader implements Closeable {
securityNodeListener.run();
}
});
securityData = getSecurityProps(true);
}
}