Skip to content

Commit

Permalink
HTTPCLIENT-1625 Completely overhaul GSS-API-based authentication backend
Browse files Browse the repository at this point in the history
  • Loading branch information
stoty committed Sep 6, 2024
1 parent 25f080f commit 7e9f619
Show file tree
Hide file tree
Showing 23 changed files with 1,032 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
import org.apache.hc.client5.http.UserTokenHandler;
import org.apache.hc.client5.http.auth.AuthSchemeFactory;
import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.config.TlsConfig;
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
Expand Down Expand Up @@ -153,6 +154,12 @@ public TestAsyncClientBuilder setDefaultAuthSchemeRegistry(final Lookup<AuthSche
return this;
}

@Override
public TestAsyncClientBuilder setDefaultCredentialsProvider(final CredentialsProvider credentialsProvider) {
this.clientBuilder.setDefaultCredentialsProvider(credentialsProvider);
return this;
}

@Override
public TestAsyncClient build() throws Exception {
final PoolingAsyncClientConnectionManager connectionManager = connectionManagerBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
import org.apache.hc.client5.http.UserTokenHandler;
import org.apache.hc.client5.http.auth.AuthSchemeFactory;
import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.config.TlsConfig;
import org.apache.hc.core5.http.Header;
import org.apache.hc.core5.http.HttpRequestInterceptor;
Expand Down Expand Up @@ -101,6 +102,10 @@ default TestAsyncClientBuilder setDefaultAuthSchemeRegistry(Lookup<AuthSchemeFac
throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
}

default TestAsyncClientBuilder setDefaultCredentialsProvider(CredentialsProvider credentialsProvider) {
throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
}

TestAsyncClient build() throws Exception;

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
import org.apache.hc.client5.http.UserTokenHandler;
import org.apache.hc.client5.http.auth.AuthSchemeFactory;
import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.classic.ExecChainHandler;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
Expand Down Expand Up @@ -150,6 +151,12 @@ public TestClientBuilder addExecInterceptorLast(final String name, final ExecCha
return this;
}

@Override
public TestClientBuilder setDefaultCredentialsProvider(final CredentialsProvider credentialsProvider) {
this.clientBuilder.setDefaultCredentialsProvider(credentialsProvider);
return this;
}

@Override
public TestClient build() throws Exception {
final HttpClientConnectionManager connectionManagerCopy = connectionManager != null ? connectionManager :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
import org.apache.hc.client5.http.UserTokenHandler;
import org.apache.hc.client5.http.auth.AuthSchemeFactory;
import org.apache.hc.client5.http.auth.CredentialsProvider;
import org.apache.hc.client5.http.classic.ExecChainHandler;
import org.apache.hc.client5.http.io.HttpClientConnectionManager;
import org.apache.hc.core5.http.Header;
Expand Down Expand Up @@ -94,7 +95,11 @@ default TestClientBuilder addExecInterceptorFirst(String name, ExecChainHandler
throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
}

default TestClientBuilder addExecInterceptorLast(String name, ExecChainHandler interceptor) {
default TestClientBuilder addExecInterceptorLast(String name, ExecChainHandler interceptor) {
throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
}

default TestClientBuilder setDefaultCredentialsProvider(CredentialsProvider credentialsProvider) {
throw new UnsupportedOperationException("Operation not supported by " + getProtocolLevel());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,17 @@ public void afterEach(final ExtensionContext extensionContext) {

if (client != null) {
client.close(CloseMode.GRACEFUL);
// client = null;
}

if (connManager != null) {
connManager.close(CloseMode.IMMEDIATE);
// connManager = null;
}

if (server != null) {
server.shutdown(CloseMode.IMMEDIATE);
// server = null;
}
}

Expand Down
Loading

0 comments on commit 7e9f619

Please sign in to comment.