mirror of https://github.com/apache/lucene.git
SOLR-9481: Clearing existing global interceptors on HttpClientUtil to avoid user/pass leaks from other tests
This commit is contained in:
parent
22aa34e017
commit
4383bec84c
|
@ -119,6 +119,7 @@ public class BasicAuthPlugin extends AuthenticationPlugin implements ConfigEdita
|
||||||
final String username = credentials.substring(0, p).trim();
|
final String username = credentials.substring(0, p).trim();
|
||||||
String pwd = credentials.substring(p + 1).trim();
|
String pwd = credentials.substring(p + 1).trim();
|
||||||
if (!authenticate(username, pwd)) {
|
if (!authenticate(username, pwd)) {
|
||||||
|
log.debug("Bad auth credentials supplied in Authorization header");
|
||||||
authenticationFailure(response, "Bad credentials");
|
authenticationFailure(response, "Bad credentials");
|
||||||
} else {
|
} else {
|
||||||
HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(request) {
|
HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(request) {
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class BasicAuthStandaloneTest extends AbstractSolrTestCase {
|
||||||
instance.setUp();
|
instance.setUp();
|
||||||
jetty = createJetty(instance);
|
jetty = createJetty(instance);
|
||||||
securityConfHandler = new SecurityConfHandlerLocalForTesting(jetty.getCoreContainer());
|
securityConfHandler = new SecurityConfHandlerLocalForTesting(jetty.getCoreContainer());
|
||||||
|
HttpClientUtil.clearRequestInterceptors(); // Clear out any old Authorization headers
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,8 +102,6 @@ public class BasicAuthStandaloneTest extends AbstractSolrTestCase {
|
||||||
securityConfHandler.persistConf(new SecurityConfHandler.SecurityConfig()
|
securityConfHandler.persistConf(new SecurityConfHandler.SecurityConfig()
|
||||||
.setData(Utils.fromJSONString(STD_CONF.replaceAll("'", "\""))));
|
.setData(Utils.fromJSONString(STD_CONF.replaceAll("'", "\""))));
|
||||||
securityConfHandler.securityConfEdited();
|
securityConfHandler.securityConfEdited();
|
||||||
log.debug("Newly written security.json is " + securityConfHandler.getSecurityConfig(false) +
|
|
||||||
" and baseUrl is " + baseUrl);
|
|
||||||
verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/class", "solr.BasicAuthPlugin", 20);
|
verifySecurityStatus(cl, baseUrl + authcPrefix, "authentication/class", "solr.BasicAuthPlugin", 20);
|
||||||
|
|
||||||
String command = "{\n" +
|
String command = "{\n" +
|
||||||
|
|
Loading…
Reference in New Issue