lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr:master: SOLR-12514: FIxed the test and another bug
Date Sat, 05 Jan 2019 08:31:48 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 73797f60a -> 000d0c136


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/000d0c13
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/000d0c13
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/000d0c13

Branch: refs/heads/master
Commit: 000d0c1364b4c39d53095b37f263f75880d432db
Parents: 73797f6
Author: Noble Paul <noble@apache.org>
Authored: Sat Jan 5 19:31:28 2019 +1100
Committer: Noble Paul <noble@apache.org>
Committed: Sat Jan 5 19:31:28 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 ++++-----
 .../solr/security/HttpParamDelegationTokenPlugin.java |  2 +-
 6 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/000d0c13/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/000d0c13/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 a60e700..b14068c 100644
--- a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
@@ -280,7 +280,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) {
         log.debug("principal is null");
         //this had a request but not authenticated

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/000d0c13/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 b833244..f10481d 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/000d0c13/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 1f73799..a149b33 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
@@ -312,7 +312,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/000d0c13/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 c643d29..39389b6 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -244,12 +244,11 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase
{
       //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");

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/000d0c13/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 a8f0355..bd1818e 100644
--- a/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java
+++ b/solr/core/src/test/org/apache/solr/security/HttpParamDelegationTokenPlugin.java
@@ -127,7 +127,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


Mime
View raw message