Skip to content

Commit

Permalink
Remove Kerberos specific functions from HttpSolrClient
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Nov 22, 2024
1 parent 9f8f9c5 commit fd24abc
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 353 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.Base64;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -870,17 +869,6 @@ public Builder allowCompression(boolean compression) {
return this;
}

/** Use a delegation token for authenticating via the KerberosPlugin */
public Builder withKerberosDelegationToken(String delegationToken) {
if (this.invariantParams.get(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM) != null) {
throw new IllegalStateException(
DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM + " is already defined!");
}
this.invariantParams.add(
DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM, delegationToken);
return this;
}

/**
* Adds to the set of params that the created {@link HttpSolrClient} will add on all requests
*
Expand All @@ -907,20 +895,7 @@ public HttpSolrClient build() {
"Cannot create HttpSolrClient without a valid baseSolrUrl!");
}

if (this.invariantParams.get(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM) == null) {
return new HttpSolrClient(this);
} else {
urlParamNames =
urlParamNames == null
? Set.of(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM)
: urlParamNames;
if (!urlParamNames.contains(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM)) {
urlParamNames = new HashSet<>(urlParamNames);
urlParamNames.add(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM);
}
urlParamNames = Set.copyOf(urlParamNames);
return new DelegationTokenHttpSolrClient(this);
}
return new HttpSolrClient(this);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -890,23 +890,5 @@ public void testInvariantParams() throws IOException {
.build()) {
assertEquals(2, createdClient.getInvariantParams().getParams("fq").length);
}

try (SolrClient createdClient =
new HttpSolrClient.Builder()
.withBaseSolrUrl(getBaseUrl())
.withKerberosDelegationToken("mydt")
.withInvariantParams(
SolrTestCaseJ4.params(DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM, "mydt"))
.build()) {
fail();
} catch (Exception ex) {
if (!ex.getMessage()
.equals(
"parameter "
+ DelegationTokenHttpSolrClient.DELEGATION_TOKEN_PARAM
+ " is redefined.")) {
throw ex;
}
}
}
}

0 comments on commit fd24abc

Please sign in to comment.