mirror of https://github.com/apache/lucene.git
SOLR-7274: Stop forwarding Authorization, Host, and Accept headers for SPNego to work. Also fixed an exception forwarding from SDF and reconfigure SDF's httpClient after authentication has been initialized.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1680931 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10dd568c8e
commit
38876c2209
|
@ -194,9 +194,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
|
|||
*/
|
||||
public void reconfigureHttpClient(HttpClientConfigurer configurer) {
|
||||
log.info("Reconfiguring the default client with: " + configurer);
|
||||
synchronized (this.defaultClient) {
|
||||
configurer.configure((DefaultHttpClient)this.defaultClient, getClientParams());
|
||||
}
|
||||
configurer.configure((DefaultHttpClient)this.defaultClient, getClientParams());
|
||||
}
|
||||
|
||||
protected ThreadPoolExecutor getThreadPoolExecutor(){
|
||||
|
|
|
@ -511,7 +511,11 @@ public class HttpSolrCall {
|
|||
|
||||
for (Enumeration<String> e = req.getHeaderNames(); e.hasMoreElements(); ) {
|
||||
String headerName = e.nextElement();
|
||||
method.addHeader(headerName, req.getHeader(headerName));
|
||||
if (!"host".equalsIgnoreCase(headerName)
|
||||
&& !"authorization".equalsIgnoreCase(headerName)
|
||||
&& !"accept".equalsIgnoreCase(headerName)) {
|
||||
method.addHeader(headerName, req.getHeader(headerName));
|
||||
}
|
||||
}
|
||||
// These headers not supported for HttpEntityEnclosingRequests
|
||||
if (method instanceof HttpEntityEnclosingRequest) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import javax.servlet.ServletRequest;
|
|||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -36,6 +37,8 @@ import java.util.regex.Pattern;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpClientConfigurer;
|
||||
import org.apache.solr.client.solrj.impl.HttpClientUtil;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.SolrException.ErrorCode;
|
||||
|
@ -106,6 +109,13 @@ public class SolrDispatchFilter extends BaseSolrFilter {
|
|||
|
||||
this.cores = createCoreContainer(solrHome, extraProperties);
|
||||
|
||||
if (this.cores.getAuthenticationPlugin() != null) {
|
||||
HttpClientConfigurer configurer = this.cores.getAuthenticationPlugin().getDefaultConfigurer();
|
||||
if (configurer != null) {
|
||||
configurer.configure((DefaultHttpClient)httpClient, new ModifiableSolrParams());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("user.dir=" + System.getProperty("user.dir"));
|
||||
}
|
||||
catch( Throwable t ) {
|
||||
|
@ -248,7 +258,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
|
|||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, "Error during request authentication, "+e);
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, "Error during request authentication, ", e);
|
||||
}
|
||||
}
|
||||
// failed authentication?
|
||||
|
|
|
@ -90,9 +90,7 @@ public class UpdateShardHandler {
|
|||
|
||||
public void reconfigureHttpClient(HttpClientConfigurer configurer) {
|
||||
log.info("Reconfiguring the default client with: " + configurer);
|
||||
synchronized (client) {
|
||||
configurer.configure((DefaultHttpClient)client, getClientParams());
|
||||
}
|
||||
configurer.configure((DefaultHttpClient)client, getClientParams());
|
||||
}
|
||||
|
||||
public ClientConnectionManager getConnectionManager() {
|
||||
|
|
Loading…
Reference in New Issue