You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2018/10/03 14:18:48 UTC

[1/6] lucene-solr:solr12799-auth-forward: SOLR-12799: Allow Authentication Plugins to easily intercept internode requests

Repository: lucene-solr
Updated Branches:
  refs/heads/solr12799-auth-forward [created] c1851096f


SOLR-12799: Allow Authentication Plugins to easily intercept internode requests


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

Branch: refs/heads/solr12799-auth-forward
Commit: 2323d03efb93853dd6b285999f1b898f38433a99
Parents: baf40d5
Author: Jan Høydahl <ja...@apache.org>
Authored: Mon Sep 24 11:34:47 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Mon Sep 24 11:34:47 2018 +0200

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../org/apache/solr/core/CoreContainer.java     | 14 +++++-------
 .../solr/security/AuthenticationPlugin.java     | 23 +++++++++++++++++++-
 .../solr/security/PKIAuthenticationPlugin.java  | 22 +++++++++----------
 ...uthentication-and-authorization-plugins.adoc |  8 ++++---
 5 files changed, 45 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2323d03e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2c4903b..82eb96e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -62,6 +62,8 @@ SOLR-12591: Expand the set of recognized date format patterns of schemaless mode
   locale was changed from ROOT to en_US since well-known patterns assume this locale.
   (David Smiley, Bar Rotstein)
 
+* SOLR-12799: Allow Authentication Plugins to intercept internode requests on a per-request basis (janhoy) 
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2323d03e/solr/core/src/java/org/apache/solr/core/CoreContainer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 83384fb..8ab8908 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -426,15 +426,11 @@ public class CoreContainer {
       }
 
       HttpClientUtil.setHttpClientRequestContextBuilder(httpClientBuilder);
-
-    } else {
-      if (pkiAuthenticationPlugin != null) {
-        //this happened due to an authc plugin reload. no need to register the pkiAuthc plugin again
-        if(pkiAuthenticationPlugin.isInterceptorRegistered()) return;
-        log.info("PKIAuthenticationPlugin is managing internode requests");
-        setupHttpClientForAuthPlugin(pkiAuthenticationPlugin);
-        pkiAuthenticationPlugin.setInterceptorRegistered();
-      }
+    }
+    // Always register PKI auth interceptor, which will then delegate the decision of who should secure
+    // each request to the configured authentication plugin.
+    if (pkiAuthenticationPlugin != null && !pkiAuthenticationPlugin.isInterceptorRegistered()) {
+      pkiAuthenticationPlugin.getHttpClientBuilder(HttpClientUtil.getHttpClientBuilder());
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2323d03e/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java b/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
index a9d112a..f56821d 100644
--- a/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/AuthenticationPlugin.java
@@ -22,6 +22,9 @@ import javax.servlet.ServletResponse;
 import java.io.Closeable;
 import java.util.Map;
 
+import org.apache.http.HttpRequest;
+import org.apache.http.protocol.HttpContext;
+
 /**
  * 
  * @lucene.experimental
@@ -52,7 +55,25 @@ public abstract class AuthenticationPlugin implements Closeable {
   public abstract boolean doAuthenticate(ServletRequest request, ServletResponse response,
       FilterChain filterChain) throws Exception;
 
-
+  /**
+   * Override this method to intercept internode requests. This allows your authentication
+   * plugin to decide on per-request basis whether it should handle inter-node requests or
+   * delegate to {@link PKIAuthenticationPlugin}. Return true to indicate that your plugin
+   * did handle the request, or false to signal that PKI plugin should handle it. This method
+   * will be called by {@link PKIAuthenticationPlugin}'s interceptor.
+   * 
+   * <p>
+   *   If not overridden, this method will return true for plugins implementing {@link HttpClientBuilderPlugin}.
+   *   This method can be overridden by subclasses e.g. to set HTTP headers, even if you don't use a clientBuilder. 
+   * </p>
+   * @param httpRequest the httpRequest that is about to be sent to another internal Solr node
+   * @param httpContext the context of that request.
+   * @return true if this plugin handled authentication for the request, else false
+   */
+  protected boolean interceptInternodeRequest(HttpRequest httpRequest, HttpContext httpContext) {
+    return this instanceof HttpClientBuilderPlugin;
+  }
+  
   /**
    * Cleanup any per request  data
    */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2323d03e/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 43dac48..2a8e216 100644
--- a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
@@ -65,10 +65,6 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin implements Htt
   private final HttpHeaderClientInterceptor interceptor = new HttpHeaderClientInterceptor();
   private boolean interceptorRegistered = false;
 
-  public void setInterceptorRegistered(){
-    this.interceptorRegistered = true;
-  }
-
   public boolean isInterceptorRegistered(){
     return interceptorRegistered;
   }
@@ -224,6 +220,7 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin implements Htt
   @Override
   public SolrHttpClientBuilder getHttpClientBuilder(SolrHttpClientBuilder builder) {
     HttpClientUtil.addRequestInterceptor(interceptor);
+    interceptorRegistered = true;
     return builder;
   }
 
@@ -238,8 +235,15 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin implements Htt
 
     @Override
     public void process(HttpRequest httpRequest, HttpContext httpContext) throws HttpException, IOException {
-      if (disabled()) return;
-      setHeader(httpRequest);
+      if (cores.getAuthenticationPlugin() == null) {
+        return;
+      }
+      if (!cores.getAuthenticationPlugin().interceptInternodeRequest(httpRequest, httpContext)) {
+        log.debug("PKIAuthenticationPlugin secures this internode request");
+        setHeader(httpRequest);
+      } else {
+        log.debug("{} secures this internode request", cores.getAuthenticationPlugin().getClass().getName());
+      }
     }
   }
 
@@ -282,14 +286,10 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin implements Htt
     return SolrRequestInfo.getRequestInfo();
   }
 
-  boolean disabled() {
-    return cores.getAuthenticationPlugin() == null ||
-        cores.getAuthenticationPlugin() instanceof HttpClientBuilderPlugin;
-  }
-
   @Override
   public void close() throws IOException {
     HttpClientUtil.removeRequestInterceptor(interceptor);
+    interceptorRegistered = false;
   }
 
   public String getPublicKey() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2323d03e/solr/solr-ref-guide/src/authentication-and-authorization-plugins.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/authentication-and-authorization-plugins.adoc b/solr/solr-ref-guide/src/authentication-and-authorization-plugins.adoc
index 971dbcd..a1085eb 100644
--- a/solr/solr-ref-guide/src/authentication-and-authorization-plugins.adoc
+++ b/solr/solr-ref-guide/src/authentication-and-authorization-plugins.adoc
@@ -159,12 +159,14 @@ Solr has one implementation of an authorization plugin:
 
 == Securing Inter-Node Requests
 
-There are a lot of requests that originate from the Solr nodes itself. For example, requests from overseer to nodes, recovery threads, etc. Each Authentication plugin declares whether it is capable of securing inter-node requests or not. If not, Solr will fall back to using a special internode authentication mechanism where each Solr node is a super user and is fully trusted by other Solr nodes, described below.
+There are a lot of requests that originate from the Solr nodes itself. For example, requests from overseer to nodes, recovery threads, etc. We call these 'inter-node' request. Solr has a special built-in `PKIAuthenticationPlugin` (see below) that will always be available to secure inter-node traffic. 
+
+Each Authentication plugin may also decide to secure inter-node requests on its own. They may do this through the so-called `HttpClientBuilder` mechanism, or they may alternatively choose on a per-request basis whether to delegate to PKI or not by overriding a `interceptInternodeRequest()` method from the base class, where any HTTP headers can be set. 
 
 === PKIAuthenticationPlugin
 
-The PKIAuthenticationPlugin is used when there is any request going on between two Solr nodes, and the configured Authentication plugin does not wish to handle inter-node security.
+The `PKIAuthenticationPlugin` provides a built-in authentication mechanism where each Solr node is a super user and is fully trusted by other Solr nodes through the use of Public Key Infrastructure (PKI). Each Authentication plugn may choose to delegate all or some inter-node traffic to this framework.
 
-For each outgoing request `PKIAuthenticationPlugin` adds a special header `'SolrAuth'` which carries the timestamp and principal encrypted using the private key of that node. The public key is exposed through an API so that any node can read it whenever it needs it. Any node who gets the request with that header, would get the public key from the sender and decrypt the information. If it is able to decrypt the data, the request trusted. It is invalid if the timestamp is more than 5 secs old. This assumes that the clocks of different nodes in the cluster are synchronized.
+For each outgoing request `PKIAuthenticationPlugin` adds a special header `'SolrAuth'` which carries the timestamp and principal encrypted using the private key of that node. The public key is exposed through an API so that any node can read it whenever it needs it. Any node who gets the request with that header, would get the public key from the sender and decrypt the information. If it is able to decrypt the data, the request trusted. It is invalid if the timestamp is more than 5 secs old. This assumes that the clocks of different nodes in the cluster are synchronized. Only traffic from other Solr nodes registered with Zookeeper is trusted.
 
 The timeout is configurable through a system property called `pkiauth.ttl`. For example, if you wish to bump up the time-to-live to 10 seconds (10000 milliseconds), start each node with a property `'-Dpkiauth.ttl=10000'`.


[2/6] lucene-solr:solr12799-auth-forward: Remove mock method not in use

Posted by ja...@apache.org.
Remove mock method not in use


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

Branch: refs/heads/solr12799-auth-forward
Commit: 133b773a8f75522e020b33fb843c14aa3908fe03
Parents: 2323d03
Author: Jan Høydahl <ja...@apache.org>
Authored: Mon Sep 24 11:47:56 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Mon Sep 24 11:47:56 2018 +0200

----------------------------------------------------------------------
 .../org/apache/solr/security/TestPKIAuthenticationPlugin.java   | 5 -----
 1 file changed, 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/133b773a/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java b/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
index 2d324cb..ce527c6 100644
--- a/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
+++ b/solr/core/src/test/org/apache/solr/security/TestPKIAuthenticationPlugin.java
@@ -52,11 +52,6 @@ public class TestPKIAuthenticationPlugin extends SolrTestCaseJ4 {
     }
 
     @Override
-    boolean disabled() {
-      return false;
-    }
-
-    @Override
     SolrRequestInfo getRequestInfo() {
       return solrRequestInfo;
     }


[5/6] lucene-solr:solr12799-auth-forward: Forward credentials for BasicAUth

Posted by ja...@apache.org.
Forward credentials for BasicAUth


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

Branch: refs/heads/solr12799-auth-forward
Commit: 4c32559c90fdcb684ea7d53773288169b6a2c7f3
Parents: 89bb707
Author: Jan Høydahl <ja...@apache.org>
Authored: Wed Oct 3 14:45:58 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Wed Oct 3 14:45:58 2018 +0200

----------------------------------------------------------------------
 .../apache/solr/security/BasicAuthPlugin.java   | 94 ++++++++++++++++++--
 .../solr/security/BasicAuthIntegrationTest.java | 42 +++++++--
 2 files changed, 122 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4c32559c/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java b/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
index eab89e3..dc97828 100644
--- a/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
@@ -16,6 +16,7 @@
  */
 package org.apache.solr.security;
 
+import javax.security.auth.Subject;
 import javax.servlet.FilterChain;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
@@ -23,20 +24,30 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.lang.invoke.MethodHandles;
+import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.StringTokenizer;
 
 import com.google.common.collect.ImmutableSet;
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.http.Header;
-import org.apache.http.auth.BasicUserPrincipal;
+import org.apache.http.HttpHeaders;
+import org.apache.http.HttpRequest;
+import org.apache.http.annotation.Contract;
+import org.apache.http.annotation.ThreadingBehavior;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.message.BasicHeader;
+import org.apache.http.protocol.HttpContext;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.util.ValidatingJsonMap;
 import org.apache.solr.common.util.CommandOperation;
 import org.apache.solr.common.SpecProvider;
@@ -48,6 +59,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
   private AuthenticationProvider authenticationProvider;
   private final static ThreadLocal<Header> authHeader = new ThreadLocal<>();
   private boolean blockUnknown = false;
+  private boolean forwardCredentials = false;
 
   public boolean authenticate(String username, String pwd) {
     return authenticationProvider.authenticate(username, pwd);
@@ -60,7 +72,15 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
       try {
         blockUnknown = Boolean.parseBoolean(o.toString());
       } catch (Exception e) {
-        log.error(e.getMessage());
+        throw new SolrException(ErrorCode.BAD_REQUEST, "Invalid value for parameter " + BLOCK_UNKNOWN);
+      }
+    }
+    o = pluginConfig.get(FORWARD_CREDENTIALS);
+    if (o != null) {
+      try {
+        forwardCredentials = Boolean.parseBoolean(o.toString());
+      } catch (Exception e) {
+        throw new SolrException(ErrorCode.BAD_REQUEST, "Invalid value for parameter " + FORWARD_CREDENTIALS);
       }
     }
     authenticationProvider = getAuthenticationProvider(pluginConfig);
@@ -85,7 +105,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
       ConfigEditablePlugin editablePlugin = (ConfigEditablePlugin) authenticationProvider;
       return editablePlugin.edit(latestConf, commands);
     }
-    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "This cannot be edited");
+    throw new SolrException(ErrorCode.BAD_REQUEST, "This cannot be edited");
   }
 
   protected AuthenticationProvider getAuthenticationProvider(Map<String, Object> pluginConfig) {
@@ -127,7 +147,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
                 HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(request) {
                   @Override
                   public Principal getUserPrincipal() {
-                    return new BasicUserPrincipal(username);
+                    return new BasicAuthUserPrincipal(username, pwd);
                   }
                 };
                 filterChain.doFilter(wrapper, response);
@@ -173,6 +193,23 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
   }
 
   @Override
+  protected boolean interceptInternodeRequest(HttpRequest httpRequest, HttpContext httpContext) {
+    if (forwardCredentials) {
+      if (httpContext instanceof HttpClientContext) {
+        HttpClientContext httpClientContext = (HttpClientContext) httpContext;
+        log.info("*** HttpClientContext token={}", httpClientContext.getUserToken());
+        if (httpClientContext.getUserToken() instanceof BasicAuthUserPrincipal) {
+          BasicAuthUserPrincipal principal = (BasicAuthUserPrincipal) httpClientContext.getUserToken();
+          String userPassBase64 = Base64.encodeBase64String((principal.getName() + ":" + principal.getPassword()).getBytes(StandardCharsets.UTF_8));
+          httpRequest.setHeader(HttpHeaders.AUTHORIZATION, "Basic " + userPassBase64);
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  @Override
   public ValidatingJsonMap getSpec() {
     return authenticationProvider.getSpec();
   }
@@ -181,7 +218,54 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
   }
 
   public static final String BLOCK_UNKNOWN = "blockUnknown";
-  private static final Set<String> PROPS = ImmutableSet.of(BLOCK_UNKNOWN);
+  public static final String FORWARD_CREDENTIALS = "forwardCredentials";
+  private static final Set<String> PROPS = ImmutableSet.of(BLOCK_UNKNOWN, FORWARD_CREDENTIALS);
+
+  
+  @Contract(threading = ThreadingBehavior.IMMUTABLE)
+  private class BasicAuthUserPrincipal implements Principal, Serializable {
+    private String username;
+    private final String password;
 
+    public BasicAuthUserPrincipal(String username, String pwd) {
+      this.username = username;
+      this.password = pwd;
+    }
+
+    @Override
+    public String getName() {
+        return this.username;
+    }
+
+    public String getPassword() {
+      return password;
+    }
+
+    @Override
+    public boolean implies(Subject subject) {
+      return false;
+    }
 
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) return true;
+      if (o == null || getClass() != o.getClass()) return false;
+      BasicAuthUserPrincipal that = (BasicAuthUserPrincipal) o;
+      return Objects.equals(username, that.username) &&
+          Objects.equals(password, that.password);
+    }
+
+    @Override
+    public int hashCode() {
+      return Objects.hash(username, password);
+    }
+
+    @Override
+    public String toString() {
+      return new ToStringBuilder(this)
+          .append("username", username)
+          .append("pwd", password)
+          .toString();
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4c32559c/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 95d243d..581f4cf 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -30,6 +30,7 @@ import java.util.Objects;
 import java.util.Random;
 import java.util.function.Predicate;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
@@ -39,6 +40,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.SolrServerException;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
@@ -58,6 +60,7 @@ import org.apache.solr.common.util.Base64;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.common.util.Utils;
+import org.apache.solr.util.LogLevel;
 import org.apache.solr.util.SolrCLI;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -83,6 +86,7 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
   }
 
   @Test
+  @LogLevel("org.apache.solr.security=DEBUG")
   //commented 9-Aug-2018 @BadApple(bugUrl="https://issues.apache.org/jira/browse/SOLR-12028") // 21-May-2018
   public void testBasicAuth() throws Exception {
     boolean isUseV2Api = random().nextBoolean();
@@ -194,14 +198,7 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
 
       executeCommand(baseUrl + authzPrefix, cl,"{set-permission : { name : update , role : admin}}", "harry", "HarryIsUberCool");
 
-      SolrInputDocument doc = new SolrInputDocument();
-      doc.setField("id","4");
-      UpdateRequest update = new UpdateRequest();
-      update.setBasicAuthCredentials("harry","HarryIsUberCool");
-      update.add(doc);
-      update.setCommitWithin(100);
-      cluster.getSolrClient().request(update, COLLECTION);
-
+      addDocument("harry","HarryIsUberCool","id", "4");
 
       executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: true}}", "harry", "HarryIsUberCool");
       verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/blockUnknown", "true", 20, "harry", "HarryIsUberCool");
@@ -225,6 +222,12 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
             "; stdout from tool prior to failure: " + baos.toString(StandardCharsets.UTF_8.name()));
       }
       executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
+      
+      addDocument("harry","HarryIsUberCool","id", "5");
+
+      executeCommand(baseUrl + authcPrefix, cl, "{set-property : { forwardCredentials: true}}", "harry", "HarryIsUberCool");
+      verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/forwardCredentials", "true", 20, "harry", "HarryIsUberCool");
+      assertEquals(1, cluster.getSolrClient().query(COLLECTION, params("q", "id:5")).getResults().getNumFound());
     } finally {
       if (cl != null) {
         HttpClientUtil.close(cl);
@@ -232,6 +235,25 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
     }
   }
 
+  private void addDocument(String user, String pass, String... fields) throws IOException, SolrServerException {
+    SolrInputDocument doc = new SolrInputDocument();
+    boolean isKey = true;
+    String key = null;
+    for (String field : fields) {
+      if (isKey) {
+        key = field;
+        isKey = false;
+      } else {
+        doc.setField(key, field);
+      }
+    }
+    UpdateRequest update = new UpdateRequest();
+    update.setBasicAuthCredentials(user, pass);
+    update.add(doc);
+    cluster.getSolrClient().request(update, COLLECTION);
+    update.commit(cluster.getSolrClient(), COLLECTION);
+  }
+
   public static void executeCommand(String url, HttpClient cl, String payload, String user, String pwd)
       throws IOException {
     HttpPost httpPost;
@@ -241,7 +263,9 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
     httpPost.setEntity(new ByteArrayEntity(payload.getBytes(UTF_8)));
     httpPost.addHeader("Content-Type", "application/json; charset=UTF-8");
     r = cl.execute(httpPost);
-    assertEquals(200, r.getStatusLine().getStatusCode());
+    String response = IOUtils.toString(r.getEntity().getContent(), StandardCharsets.UTF_8);
+    assertEquals("Non-200 response code. Response was " + response, 200, r.getStatusLine().getStatusCode());
+    assertFalse("Response contained errors: " + response, response.contains("errorMessages"));
     Utils.consumeFully(r.getEntity());
   }
 


[6/6] lucene-solr:solr12799-auth-forward: Forward the user principal on inter-node requests

Posted by ja...@apache.org.
Forward the user principal on inter-node requests


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

Branch: refs/heads/solr12799-auth-forward
Commit: c1851096f67c1722ed92439d38d62149d4827b9d
Parents: 4c32559
Author: Jan Høydahl <ja...@apache.org>
Authored: Wed Oct 3 15:57:16 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Wed Oct 3 15:57:16 2018 +0200

----------------------------------------------------------------------
 .../handler/component/HttpShardHandler.java     |  7 +++++++
 .../apache/solr/security/BasicAuthPlugin.java   |  1 -
 .../solr/security/PKIAuthenticationPlugin.java  |  4 ++--
 .../apache/solr/update/SolrCmdDistributor.java  |  4 ++++
 .../solr/security/BasicAuthIntegrationTest.java | 20 ++++++++++++++++++--
 .../apache/solr/client/solrj/SolrRequest.java   | 11 +++++++++++
 .../solr/client/solrj/impl/HttpSolrClient.java  | 13 ++++++++++---
 7 files changed, 52 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
index a548031..3068a36 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandler.java
@@ -18,6 +18,7 @@ package org.apache.solr.handler.component;
 
 import java.lang.invoke.MethodHandles;
 import java.net.ConnectException;
+import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -56,6 +57,7 @@ import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.core.CoreDescriptor;
 import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.request.SolrRequestInfo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.MDC;
@@ -136,6 +138,10 @@ public class HttpShardHandler extends ShardHandler {
     // do this outside of the callable for thread safety reasons
     final List<String> urls = getURLs(shard);
 
+    // If request has a Principal (authenticated user), extract it for passing on to the new shard request
+    SolrRequestInfo requestInfo = SolrRequestInfo.getRequestInfo();
+    final Principal userPrincipal = requestInfo == null ? null : requestInfo.getReq().getUserPrincipal();
+
     Callable<ShardResponse> task = () -> {
 
       ShardResponse srsp = new ShardResponse();
@@ -154,6 +160,7 @@ public class HttpShardHandler extends ShardHandler {
 
         QueryRequest req = makeQueryRequest(sreq, params, shard);
         req.setMethod(SolrRequest.METHOD.POST);
+        req.setUserPrincipal(userPrincipal);
 
         // no need to set the response parser as binary is the default
         // req.setResponseParser(new BinaryResponseParser());

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java b/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
index dc97828..4087600 100644
--- a/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/BasicAuthPlugin.java
@@ -197,7 +197,6 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
     if (forwardCredentials) {
       if (httpContext instanceof HttpClientContext) {
         HttpClientContext httpClientContext = (HttpClientContext) httpContext;
-        log.info("*** HttpClientContext token={}", httpClientContext.getUserToken());
         if (httpClientContext.getUserToken() instanceof BasicAuthUserPrincipal) {
           BasicAuthUserPrincipal principal = (BasicAuthUserPrincipal) httpClientContext.getUserToken();
           String userPassBase64 = Base64.encodeBase64String((principal.getName() + ":" + principal.getPassword()).getBytes(StandardCharsets.UTF_8));

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/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 2a8e216..5245afc 100644
--- a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
@@ -239,10 +239,10 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin implements Htt
         return;
       }
       if (!cores.getAuthenticationPlugin().interceptInternodeRequest(httpRequest, httpContext)) {
-        log.debug("PKIAuthenticationPlugin secures this internode request");
+        log.debug("{} secures this internode request", this.getClass().getSimpleName());
         setHeader(httpRequest);
       } else {
-        log.debug("{} secures this internode request", cores.getAuthenticationPlugin().getClass().getName());
+        log.debug("{} secures this internode request", cores.getAuthenticationPlugin().getClass().getSimpleName());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index cb7f9cb..af2b5aa 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -47,6 +47,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.Diagnostics;
+import org.apache.solr.request.SolrRequestInfo;
 import org.apache.solr.update.processor.DistributedUpdateProcessor;
 import org.apache.solr.update.processor.DistributedUpdateProcessor.LeaderRequestReplicationTracker;
 import org.apache.solr.update.processor.DistributedUpdateProcessor.RollupRequestReplicationTracker;
@@ -282,6 +283,9 @@ public class SolrCmdDistributor implements Closeable {
   }
 
   private void submit(final Req req, boolean isCommit) {
+    // Copy user principal from the original request to the new update request, for later authentication interceptor use
+    req.uReq.setUserPrincipal(SolrRequestInfo.getRequestInfo().getReq().getUserPrincipal());
+
     if (req.synchronous) {
       blockAndDoRetries();
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/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 581f4cf..0066914 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java
@@ -46,9 +46,11 @@ import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
 import org.apache.solr.client.solrj.request.GenericSolrRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.client.solrj.request.RequestWriter.StringPayloadContentWriter;
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.request.V2Request;
+import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.SolrCloudTestCase;
 import org.apache.solr.common.SolrInputDocument;
 import org.apache.solr.common.cloud.DocCollection;
@@ -221,13 +223,18 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
         log.error("RunExampleTool failed due to: " + e +
             "; stdout from tool prior to failure: " + baos.toString(StandardCharsets.UTF_8.name()));
       }
-      executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
       
       addDocument("harry","HarryIsUberCool","id", "5");
 
+      // Validate forwardCredentials
+      assertEquals(1, executeQuery(params("q", "id:5"), "harry", "HarryIsUberCool").getResults().getNumFound());
+      // TODO: Validate that this requests were handled by PKI plugin
       executeCommand(baseUrl + authcPrefix, cl, "{set-property : { forwardCredentials: true}}", "harry", "HarryIsUberCool");
       verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/forwardCredentials", "true", 20, "harry", "HarryIsUberCool");
-      assertEquals(1, cluster.getSolrClient().query(COLLECTION, params("q", "id:5")).getResults().getNumFound());
+      assertEquals(1, executeQuery(params("q", "id:5"), "harry", "HarryIsUberCool").getResults().getNumFound());
+      // NOCOMMIT: Validate that sub requests were handled by BasicAuth plugin
+      
+      executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool");
     } finally {
       if (cl != null) {
         HttpClientUtil.close(cl);
@@ -235,6 +242,15 @@ public class BasicAuthIntegrationTest extends SolrCloudTestCase {
     }
   }
 
+  private QueryResponse executeQuery(ModifiableSolrParams params, String user, String pass) throws IOException, SolrServerException {
+    SolrRequest req = new QueryRequest(params);
+    req.setBasicAuthCredentials(user, pass);
+    QueryResponse resp = (QueryResponse) req.process(cluster.getSolrClient(), COLLECTION);
+    assertNull(resp.getException());
+    assertEquals(0, resp.getStatus());
+    return resp;
+  }
+
   private void addDocument(String user, String pass, String... fields) throws IOException, SolrServerException {
     SolrInputDocument doc = new SolrInputDocument();
     boolean isKey = true;

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
index 7dbaab9..04b94f7 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java
@@ -18,6 +18,7 @@ package org.apache.solr.client.solrj;
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.security.Principal;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
@@ -36,6 +37,16 @@ import static java.util.Collections.unmodifiableSet;
  * @since solr 1.3
  */
 public abstract class SolrRequest<T extends SolrResponse> implements Serializable {
+  // This user principal is typically used by Auth plugins during distributed/sharded search
+  private Principal userPrincipal;
+
+  public void setUserPrincipal(Principal userPrincipal) {
+    this.userPrincipal = userPrincipal;
+  }
+
+  public Principal getUserPrincipal() {
+    return userPrincipal;
+  }
 
   public enum METHOD {
     GET,

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c1851096/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
index 2b60e33..057122e 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrClient.java
@@ -24,6 +24,7 @@ import java.lang.invoke.MethodHandles;
 import java.net.ConnectException;
 import java.net.SocketTimeoutException;
 import java.nio.charset.StandardCharsets;
+import java.security.Principal;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -252,7 +253,7 @@ public class HttpSolrClient extends SolrClient {
       throws SolrServerException, IOException {
     HttpRequestBase method = createMethod(request, collection);
     setBasicAuthHeader(request, method);
-    return executeMethod(method, processor, isV2ApiRequest(request));
+    return executeMethod(method, request.getUserPrincipal(), processor, isV2ApiRequest(request));
   }
 
   private boolean isV2ApiRequest(final SolrRequest request) {
@@ -296,7 +297,7 @@ public class HttpSolrClient extends SolrClient {
     ExecutorService pool = ExecutorUtil.newMDCAwareFixedThreadPool(1, new SolrjNamedThreadFactory("httpUriRequest"));
     try {
       MDC.put("HttpSolrClient.url", baseUrl);
-      mrr.future = pool.submit(() -> executeMethod(method, processor, isV2ApiRequest(request)));
+      mrr.future = pool.submit(() -> executeMethod(method, request.getUserPrincipal(), processor, isV2ApiRequest(request)));
  
     } finally {
       pool.shutdown();
@@ -517,7 +518,7 @@ public class HttpSolrClient extends SolrClient {
 
   private static final List<String> errPath = Arrays.asList("metadata", "error-class");//Utils.getObjectByPath(err, false,"metadata/error-class")
 
-  protected NamedList<Object> executeMethod(HttpRequestBase method, final ResponseParser processor, final boolean isV2Api) throws SolrServerException {
+  protected NamedList<Object> executeMethod(HttpRequestBase method, Principal userPrincipal, final ResponseParser processor, final boolean isV2Api) throws SolrServerException {
     method.addHeader("User-Agent", AGENT);
  
     org.apache.http.client.config.RequestConfig.Builder requestConfigBuilder = HttpClientUtil.createDefaultRequestConfigBuilder();
@@ -539,6 +540,12 @@ public class HttpSolrClient extends SolrClient {
     try {
       // Execute the method.
       HttpClientContext httpClientRequestContext = HttpClientUtil.createNewHttpClientRequestContext();
+      if (userPrincipal != null) {
+        // Normally the context contains a static userToken to enable reuse resources.
+        // However, if a personal Principal object exists, we use that instead, also as a means
+        // to transfer authentication information to Auth plugins that wish to intercept the request later
+        httpClientRequestContext.setUserToken(userPrincipal);
+      }
       final HttpResponse response = httpClient.execute(method, httpClientRequestContext);
 
       int httpStatus = response.getStatusLine().getStatusCode();


[4/6] lucene-solr:solr12799-auth-forward: Merge branch 'master' into solr12799-auth-interceptInternode

Posted by ja...@apache.org.
Merge branch 'master' into solr12799-auth-interceptInternode


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

Branch: refs/heads/solr12799-auth-forward
Commit: 89bb707e2e6b9913eb8395e8acaeb937ad6e3d33
Parents: 2e0e9ad 2201b65
Author: Jan Høydahl <ja...@apache.org>
Authored: Wed Oct 3 13:52:50 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Wed Oct 3 13:52:50 2018 +0200

----------------------------------------------------------------------
 lucene/CHANGES.txt                              |   3 +
 .../benchmark/byTask/TestPerfTasksLogic.java    |   9 +-
 .../codecs/perfield/PerFieldPostingsFormat.java |  14 ++-
 .../org/apache/lucene/index/MultiFields.java    |  68 +----------
 .../lucene/index/TestDirectoryReader.java       |  11 +-
 .../org/apache/lucene/index/TestDocCount.java   |   6 +-
 .../index/TestParallelCompositeReader.java      |  27 ++---
 .../apache/lucene/index/TestSegmentReader.java  |   4 +-
 .../lucene/index/TestStressIndexing2.java       |  26 ++---
 .../org/apache/lucene/index/TestSumDocFreq.java |   7 +-
 .../memory/TestMemoryIndexAgainstRAMDir.java    |   2 +-
 .../org/apache/lucene/misc/HighFreqTerms.java   |  20 ++--
 .../index/BaseIndexFileFormatTestCase.java      |  22 +++-
 .../org/apache/lucene/util/LuceneTestCase.java  |  67 +++++------
 solr/CHANGES.txt                                |   2 +
 .../solr/index/SlowCompositeReaderWrapper.java  |  46 +++++---
 .../org/apache/solr/cloud/CloudTestUtils.java   |   4 +-
 .../solr/cloud/CollectionsAPISolrJTest.java     |  11 +-
 .../solr/cloud/autoscaling/CapturedEvent.java   |   2 +-
 .../SearchRateTriggerIntegrationTest.java       |  19 +++-
 .../cloud/autoscaling/sim/SimCloudManager.java  |   3 +-
 .../sim/SimClusterStateProvider.java            | 112 +++++++++++--------
 .../autoscaling/sim/SimSolrCloudTestCase.java   |   6 +-
 .../autoscaling/sim/TestSimLargeCluster.java    |   2 +-
 .../sim/TestSimTriggerIntegration.java          |  25 +++--
 .../index/TestSlowCompositeReaderWrapper.java   |  29 ++++-
 .../test/org/apache/solr/util/TestUtils.java    |  67 +++++++++--
 .../client/solrj/response/SolrResponseBase.java |  12 +-
 .../java/org/apache/solr/common/MapWriter.java  |   7 +-
 .../org/apache/solr/common/MapWriterMap.java    |  39 +++++++
 .../java/org/apache/solr/common/util/Utils.java |  49 ++++++--
 31 files changed, 437 insertions(+), 284 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/89bb707e/solr/CHANGES.txt
----------------------------------------------------------------------


[3/6] lucene-solr:solr12799-auth-forward: Merge branch 'master' into solr12799-auth-interceptInternode

Posted by ja...@apache.org.
Merge branch 'master' into solr12799-auth-interceptInternode

# Conflicts:
#	solr/CHANGES.txt


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

Branch: refs/heads/solr12799-auth-forward
Commit: 2e0e9ad2da5bc9386ed9569b62724b284c227044
Parents: 133b773 86e0040
Author: Jan Høydahl <ja...@apache.org>
Authored: Mon Oct 1 15:21:11 2018 +0200
Committer: Jan Høydahl <ja...@apache.org>
Committed: Mon Oct 1 15:21:11 2018 +0200

----------------------------------------------------------------------
 dev-tools/scripts/prep-solr-ref-guide-rc.sh     |   4 +-
 dev-tools/scripts/smokeTestRelease.py           |  13 +-
 lucene/CHANGES.txt                              |   5 +
 lucene/common-build.xml                         |   1 -
 .../org/apache/lucene/index/IndexWriter.java    |  27 +-
 .../org/apache/lucene/index/MergeState.java     |  44 +-
 .../apache/lucene/search/TermInSetQuery.java    |   2 +-
 .../apache/lucene/index/TestIndexSorting.java   |  49 +-
 .../document/BaseLatLonShapeTestCase.java       |   2 +-
 .../document/TestLatLonPolygonShapeQueries.java |   8 +-
 solr/CHANGES.txt                                |  17 +
 .../extraction/ExtractingRequestHandler.java    |  33 +-
 .../handler/extraction/ExtractionDateUtil.java  | 178 -----
 .../handler/extraction/SolrContentHandler.java  |  41 +-
 .../extraction/SolrContentHandlerFactory.java   |  10 +-
 .../ExtractingRequestHandlerTest.java           |   6 +-
 .../extraction/TestExtractionDateUtil.java      |  62 --
 .../org/apache/solr/cloud/RecoveryStrategy.java | 206 +++---
 .../org/apache/solr/cloud/ZkShardTerms.java     |   8 +-
 .../cloud/api/collections/AddReplicaCmd.java    |  45 +-
 .../solr/cloud/api/collections/Assign.java      | 362 ++++++----
 .../api/collections/CreateCollectionCmd.java    |  34 +-
 .../cloud/api/collections/ReplaceNodeCmd.java   |  33 +-
 .../solr/cloud/api/collections/RestoreCmd.java  |  16 +-
 .../cloud/api/collections/SplitShardCmd.java    |  17 +-
 .../cloud/autoscaling/ComputePlanAction.java    |   8 +-
 .../cloud/autoscaling/IndexSizeTrigger.java     |  12 +-
 .../solr/cloud/overseer/ReplicaMutator.java     |   4 +-
 .../java/org/apache/solr/core/SolrConfig.java   |   2 +-
 .../solr/handler/admin/MetricsHandler.java      |   4 +-
 .../handler/admin/MetricsHistoryHandler.java    |   4 +-
 .../apache/solr/metrics/SolrMetricManager.java  |  67 +-
 .../metrics/reporters/SolrSlf4jReporter.java    |   4 +-
 .../reporters/solr/SolrClusterReporter.java     |   8 +-
 .../solr/search/ExtendedDismaxQParser.java      |  89 ++-
 .../configsets/_default/conf/managed-schema     |   8 +-
 .../configsets/_default/conf/solrconfig.xml     |   1 -
 .../org/apache/solr/cloud/AddReplicaTest.java   |  10 +-
 .../org/apache/solr/cloud/CloudTestUtils.java   |   6 +-
 .../solr/cloud/CollectionsAPISolrJTest.java     |  13 +-
 .../org/apache/solr/cloud/ZkShardTermsTest.java |  14 +-
 .../CollectionTooManyReplicasTest.java          |   8 +-
 .../cloud/autoscaling/IndexSizeTriggerTest.java |  10 +-
 .../solr/cloud/autoscaling/TestPolicyCloud.java |   1 +
 .../cloud/autoscaling/sim/SimCloudManager.java  |  66 +-
 .../sim/SimClusterStateProvider.java            | 706 ++++++++++++++-----
 .../autoscaling/sim/SimDistribStateManager.java |   7 +
 .../autoscaling/sim/SimNodeStateProvider.java   |  21 +-
 .../sim/TestSimExecutePlanAction.java           |   4 +-
 .../autoscaling/sim/TestSimExtremeIndexing.java | 163 +++++
 .../autoscaling/sim/TestSimNodeLostTrigger.java |   2 +-
 .../autoscaling/sim/TestSimPolicyCloud.java     |  11 +-
 .../sim/TestSimTriggerIntegration.java          |   8 +-
 .../solr/metrics/SolrMetricManagerTest.java     |  14 -
 .../solr/search/TestExtendedDismaxParser.java   |  33 +-
 .../configsets/_default/conf/managed-schema     |   8 +-
 .../configsets/_default/conf/solrconfig.xml     |   1 -
 solr/solr-ref-guide/src/meta-docs/publish.adoc  |   7 +-
 ...g-data-with-solr-cell-using-apache-tika.adoc | 111 +--
 .../cloud/autoscaling/FreeDiskVariable.java     |  12 +-
 .../client/solrj/cloud/autoscaling/Policy.java  |  35 +-
 .../solrj/cloud/autoscaling/PolicyHelper.java   |  91 ++-
 .../solrj/cloud/autoscaling/ReplicaInfo.java    |   4 +-
 .../client/solrj/cloud/autoscaling/Row.java     |   2 +-
 .../solrj/cloud/autoscaling/Suggester.java      |   2 +-
 .../solrj/cloud/autoscaling/Suggestion.java     |   5 +
 .../org/apache/solr/client/solrj/io/Lang.java   |   5 +
 .../solrj/io/eval/ConvexHullEvaluator.java      |  62 ++
 .../client/solrj/io/eval/GetAreaEvaluator.java  |  43 ++
 .../solrj/io/eval/GetBaryCenterEvaluator.java   |  50 ++
 .../solrj/io/eval/GetBoundarySizeEvaluator.java |  43 ++
 .../solrj/io/eval/GetVerticesEvaluator.java     |  51 ++
 .../solr/common/ConditionalMapWriter.java       |   2 +-
 .../org/apache/solr/common/IteratorWriter.java  |   9 +
 .../java/org/apache/solr/common/MapWriter.java  |  30 +
 .../solr/common/cloud/ReplicaPosition.java      |   2 +-
 .../org/apache/solr/common/util/NamedList.java  |  10 +-
 .../java/org/apache/solr/common/util/Utils.java |  78 +-
 .../collections.collection.Commands.json        |   3 +-
 .../testMoveReplicasInMultipleCollections.json  |  88 +++
 .../autoscaling/testSuggestionsRebalance2.json  | 130 ++++
 .../testSuggestionsRebalanceOnly.json           | 105 +++
 .../solrj/cloud/autoscaling/TestPolicy.java     | 206 ++----
 .../solrj/cloud/autoscaling/TestPolicy2.java    |  45 +-
 .../apache/solr/client/solrj/io/TestLang.java   |   3 +-
 .../solrj/io/stream/MathExpressionTest.java     |  71 ++
 86 files changed, 2549 insertions(+), 1296 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2e0e9ad2/solr/CHANGES.txt
----------------------------------------------------------------------
diff --cc solr/CHANGES.txt
index 82eb96e,490bcf2..5ee68f7
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@@ -62,8 -65,8 +65,10 @@@ SOLR-12591: Expand the set of recognize
    locale was changed from ROOT to en_US since well-known patterns assume this locale.
    (David Smiley, Bar Rotstein)
  
 +* SOLR-12799: Allow Authentication Plugins to intercept internode requests on a per-request basis (janhoy) 
 +
+ SOLR-12593: The default configSet now includes an "ignored_*" dynamic field.  (David Smiley)
+ 
  Other Changes
  ----------------------