SOLR-7468: Enabling debug logging for kerberos connections during tests and trying to fix # of jettys (shards)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1681597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anshum Gupta 2015-05-25 15:45:08 +00:00
parent a545b66008
commit 9caddd385e
2 changed files with 27 additions and 6 deletions

View File

@ -56,17 +56,24 @@ public class KerberosPlugin extends AuthenticationPlugin {
HttpClientConfigurer kerberosConfigurer = new Krb5HttpClientConfigurer();
Filter kerberosFilter = new KerberosFilter();
final String NAME_RULES_PARAM = "solr.kerberos.name.rules";
final String COOKIE_DOMAIN_PARAM = "solr.kerberos.cookie.domain";
final String COOKIE_PATH_PARAM = "solr.kerberos.cookie.path";
final String PRINCIPAL_PARAM = "solr.kerberos.principal";
final String KEYTAB_PARAM = "solr.kerberos.keytab";
final String TOKEN_VALID_PARAM = "solr.kerberos.token.valid";
@Override
public void init(Map<String, Object> pluginConfig) {
try {
Map<String, String> params = new HashMap();
params.put("type", "kerberos");
params.put("kerberos.name.rules", System.getProperty("solr.kerberos.name.rules", "DEFAULT"));
params.put("token.valid", System.getProperty("solr.kerberos.token.valid", "30"));
params.put("cookie.domain", System.getProperty("solr.kerberos.cookie.domain"));
params.put("cookie.path", System.getProperty("solr.kerberos.cookie.path", "/"));
params.put("kerberos.principal", System.getProperty("solr.kerberos.principal"));
params.put("kerberos.keytab", System.getProperty("solr.kerberos.keytab"));
putParam(params, "kerberos.name.rules", NAME_RULES_PARAM, "DEFAULT");
putParam(params, "token.valid", TOKEN_VALID_PARAM, "30");
putParam(params, "cookie.domain", COOKIE_DOMAIN_PARAM, null);
putParam(params, "cookie.path", COOKIE_PATH_PARAM, "/");
putParam(params, "kerberos.principal", PRINCIPAL_PARAM, null);
putParam(params, "kerberos.keytab", KEYTAB_PARAM, null);
log.info("Params: "+params);
@ -98,6 +105,14 @@ public class KerberosPlugin extends AuthenticationPlugin {
}
}
private void putParam(Map<String, String> params, String internalParamName, String externalParamName, String defaultValue) {
String value = System.getProperty(externalParamName, defaultValue);
if (value==null) {
throw new SolrException(ErrorCode.SERVER_ERROR, "Missing required parameter '"+externalParamName+"'.");
}
params.put(internalParamName, value);
}
@Override
public void doAuthenticate(ServletRequest req, ServletResponse rsp,
FilterChain chain) throws Exception {

View File

@ -61,6 +61,10 @@ public class TestSolrCloudWithKerberos extends AbstractFullDistribZkTestBase {
if (brokenLocales.contains(Locale.getDefault().toString())) {
Locale.setDefault(Locale.US);
}
// Use just one jetty
this.sliceCount = 0;
this.fixShardCount(1);
setupMiniKdc();
super.distribSetUp();
//useExternalKdc();
@ -72,6 +76,8 @@ public class TestSolrCloudWithKerberos extends AbstractFullDistribZkTestBase {
}
private void setupMiniKdc() throws Exception {
System.setProperty("solr.jaas.debug", "true");
String kdcDir = createTempDir()+File.separator+"minikdc";
kdc = KerberosTestUtil.getKdc(new File(kdcDir));
File keytabFile = new File(kdcDir, "keytabs");