You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2024/02/02 16:45:53 UTC
(solr) branch branch_9x updated: SolrCLI only supports basic auth in 10x line, not in 9x. Fix backport of SOLR-17068
This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new dc741862977 SolrCLI only supports basic auth in 10x line, not in 9x. Fix backport of SOLR-17068
dc741862977 is described below
commit dc74186297774de80c9cc84ee3fa0755c338ac92
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Fri Feb 2 11:45:43 2024 -0500
SolrCLI only supports basic auth in 10x line, not in 9x. Fix backport of SOLR-17068
---
.../src/test/org/apache/solr/cli/PostToolTest.java | 46 +++++++---------------
1 file changed, 14 insertions(+), 32 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
index 7ada453aa65..c217c82f26e 100644
--- a/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
+++ b/solr/core/src/test/org/apache/solr/cli/PostToolTest.java
@@ -20,51 +20,35 @@ package org.apache.solr.cli;
import static org.apache.solr.cli.SolrCLI.findTool;
import static org.apache.solr.cli.SolrCLI.parseCmdLine;
+import java.io.File;
+import java.io.FileWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
import org.apache.commons.cli.CommandLine;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.cloud.SolrCloudTestCase;
import org.apache.solr.common.util.EnvUtils;
import org.apache.solr.common.util.Utils;
-import org.apache.solr.security.BasicAuthPlugin;
-import org.apache.solr.security.RuleBasedAuthorizationPlugin;
+
import org.junit.BeforeClass;
import org.junit.Test;
public class PostToolTest extends SolrCloudTestCase {
+
@BeforeClass
- public static void setupClusterWithSecurityEnabled() throws Exception {
- final String SECURITY_JSON =
- Utils.toJSONString(
- Map.of(
- "authorization",
- Map.of(
- "class",
- RuleBasedAuthorizationPlugin.class.getName(),
- "user-role",
- singletonMap(USER, "admin"),
- "permissions",
- singletonList(Map.of("name", "all", "role", "admin"))),
- "authentication",
- Map.of(
- "class",
- BasicAuthPlugin.class.getName(),
- "blockUnknown",
- true,
- "credentials",
- singletonMap(USER, getSaltedHashedValue(PASS)))));
-
- configureCluster(2)
- .addConfig("conf1", configset("cloud-minimal"))
- .withSecurityJson(SECURITY_JSON)
- .configure();
+ public static void setupCluster() throws Exception {
+ configureCluster(1)
+ .addConfig(
+ "config", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf"))
+ .configure();
}
@Test
public void testBasicRun() throws Exception {
final String collection = "testBasicRun";
- withBasicAuth(CollectionAdminRequest.createCollection(collection, "conf1", 1, 1, 0, 0))
+ CollectionAdminRequest.createCollection(collection, "conf1", 1, 1, 0, 0)
.processAndWait(cluster.getSolrClient(), 10);
File jsonDoc = File.createTempFile("temp", ".json");
@@ -76,8 +60,6 @@ public class PostToolTest extends SolrCloudTestCase {
"post",
"-url",
cluster.getJettySolrRunner(0).getBaseUrl() + "/" + collection + "/update",
- "-credentials",
- USER + ":" + PASS,
jsonDoc.getAbsolutePath()
};
assertEquals(0, runTool(args));
@@ -90,7 +72,7 @@ public class PostToolTest extends SolrCloudTestCase {
// Provide the port as an environment variable for the PostTool to look up.
EnvUtils.setEnv("SOLR_PORT", cluster.getJettySolrRunner(0).getLocalPort() + "");
- withBasicAuth(CollectionAdminRequest.createCollection(collection, "conf1", 1, 1, 0, 0))
+ CollectionAdminRequest.createCollection(collection, "conf1", 1, 1, 0, 0)
.processAndWait(cluster.getSolrClient(), 10);
File jsonDoc = File.createTempFile("temp", "json");
@@ -99,7 +81,7 @@ public class PostToolTest extends SolrCloudTestCase {
Utils.writeJson(Utils.toJSONString(Map.of("id", "1", "title", "mytitle")), fw, true);
String[] args = {
- "post", "-c", collection, "-credentials", USER + ":" + PASS, jsonDoc.getAbsolutePath()
+ "post", "-c", collection, jsonDoc.getAbsolutePath()
};
assertEquals(0, runTool(args));
}