You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2019/01/05 08:52:16 UTC

[1/2] lucene-solr:branch_7x: SOLR-12514: FIxed the test and another bug

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x e8bfa6771 -> ecd4a3b49


SOLR-12514: FIxed the test and another bug


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e085fcd3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e085fcd3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e085fcd3

Branch: refs/heads/branch_7x
Commit: e085fcd3f5952018e6bf465e4a6274b560bdee22
Parents: e8bfa67
Author: Noble Paul <no...@apache.org>
Authored: Sat Jan 5 19:31:28 2019 +1100
Committer: Noble Paul <no...@apache.org>
Committed: Sat Jan 5 19:51:54 2019 +1100

----------------------------------------------------------------------
 .../java/org/apache/solr/request/SolrRequestInfo.java | 14 ++++++++++++++
 .../apache/solr/security/PKIAuthenticationPlugin.java |  2 +-
 .../java/org/apache/solr/servlet/HttpSolrCall.java    |  2 +-
 .../cloud/TestSolrCloudWithSecureImpersonation.java   |  1 -
 .../solr/security/BasicAuthIntegrationTest.java       |  9 ++++-----
 5 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e085fcd3/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java b/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
index 424f1a6..5995f2b 100644
--- a/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
+++ b/solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
@@ -16,8 +16,10 @@
  */
 package org.apache.solr.request;
 
+import javax.servlet.http.HttpServletRequest;
 import java.io.Closeable;
 import java.lang.invoke.MethodHandles;
+import java.security.Principal;
 import java.util.Date;
 import java.util.LinkedList;
 import java.util.List;
@@ -40,6 +42,7 @@ public class SolrRequestInfo {
   protected SolrQueryRequest req;
   protected SolrQueryResponse rsp;
   protected Date now;
+  protected HttpServletRequest httpRequest;
   protected TimeZone tz;
   protected ResponseBuilder rb;
   protected List<Closeable> closeHooks;
@@ -83,6 +86,17 @@ public class SolrRequestInfo {
     this.req = req;
     this.rsp = rsp;    
   }
+  public SolrRequestInfo(HttpServletRequest  httpReq, SolrQueryResponse rsp) {
+    this.httpRequest = httpReq;
+    this.rsp = rsp;
+  }
+
+  public Principal getUserPrincipal() {
+    if (req != null) return req.getUserPrincipal();
+    if (httpRequest != null) return httpRequest.getUserPrincipal();
+    return null;
+  }
+
 
   public Date getNOW() {    
     if (now != null) return now;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e085fcd3/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
index 54d09d8..c845b5d 100644
--- a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
@@ -248,7 +248,7 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin implements Htt
     SolrRequestInfo reqInfo = getRequestInfo();
     String usr;
     if (reqInfo != null) {
-      Principal principal = reqInfo.getReq().getUserPrincipal();
+      Principal principal = reqInfo.getUserPrincipal();
       if (principal == null) {
         //this had a request but not authenticated
         //so we don't not need to set a principal

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e085fcd3/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index caa54f6..ee5f950 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -496,7 +496,7 @@ public class HttpSolrCall {
           handleAdminRequest();
           return RETURN;
         case REMOTEQUERY:
-          SolrRequestInfo.setRequestInfo(new SolrRequestInfo(solrReq,  new SolrQueryResponse()));
+          SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, new SolrQueryResponse()));
           remoteQuery(coreUrl + path, resp);
           return RETURN;
         case PROCESS:

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e085fcd3/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
index 9e4d229..a82018f 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
@@ -335,7 +335,6 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {
   }
 
   @Test
-  @AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-13098")
   public void testForwarding() throws Exception {
     String collectionName = "forwardingCollection";
     miniCluster.uploadConfigSet(TEST_PATH().resolve("collection1/conf"), "conf1");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e085fcd3/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
index 214c417..66fd7d6 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -230,12 +230,11 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
       //Make a request to that jetty and it should fail
       JettySolrRunner aNewJetty = cluster.startJettySolrRunner();
       SolrClient aNewClient = aNewJetty.newClient();
+      UpdateRequest delQuery = null;
+      delQuery = new UpdateRequest().deleteByQuery("*:*");
+      delQuery.setBasicAuthCredentials("harry","HarryIsUberCool");
+      delQuery.process(aNewClient, COLLECTION);//this should succeed
       try {
-        UpdateRequest delQuery = null;
-        delQuery = new UpdateRequest().deleteByQuery("*:*");
-        delQuery.setBasicAuthCredentials("harry","HarryIsUberCool");
-        delQuery.process(aNewClient, COLLECTION);//this should succeed
-
         delQuery = new UpdateRequest().deleteByQuery("*:*");
         delQuery.process(aNewClient, COLLECTION);
         fail("This should not have succeeded without credentials");


[2/2] lucene-solr:branch_7x: SOLR-12514: FIxed the test and another bug

Posted by no...@apache.org.
SOLR-12514: FIxed the test and another bug


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ecd4a3b4
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ecd4a3b4
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ecd4a3b4

Branch: refs/heads/branch_7x
Commit: ecd4a3b49c0eb51b688997654f345efe0d92c85c
Parents: e085fcd
Author: Noble Paul <no...@apache.org>
Authored: Sat Jan 5 19:52:02 2019 +1100
Committer: Noble Paul <no...@apache.org>
Committed: Sat Jan 5 19:52:02 2019 +1100

----------------------------------------------------------------------
 .../org/apache/solr/security/HttpParamDelegationTokenPlugin.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ecd4a3b4/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java b/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java
index 7a4f69f..4ea07b4 100644
--- a/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java
+++ b/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java
@@ -76,7 +76,7 @@ public class HttpParamDelegationTokenPlugin extends KerberosPlugin {
       SolrRequestInfo reqInfo = SolrRequestInfo.getRequestInfo();
       String usr;
       if (reqInfo != null) {
-        Principal principal = reqInfo.getReq().getUserPrincipal();
+        Principal principal = reqInfo.getUserPrincipal();
         if (principal == null) {
           //this had a request but not authenticated
           //so we don't not need to set a principal