Skip to content

Commit 8167ccd

Browse files
committed
Rename and move around classes
1 parent 5dcd56b commit 8167ccd

File tree

14 files changed

+88
-83
lines changed

14 files changed

+88
-83
lines changed

httpclient5-testing/src/test/java/org/apache/hc/client5/testing/compatibility/spnego/SpnegoTestUtil.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
import org.apache.hc.client5.http.SystemDefaultDnsResolver;
5050
import org.apache.hc.client5.http.auth.AuthSchemeFactory;
5151
import org.apache.hc.client5.http.auth.KerberosCredentials;
52-
import org.apache.hc.client5.http.auth.MutualKerberosConfig;
5352
import org.apache.hc.client5.http.auth.StandardAuthScheme;
53+
import org.apache.hc.client5.http.auth.gss.GssConfig;
5454
import org.apache.hc.client5.http.impl.auth.BasicSchemeFactory;
5555
import org.apache.hc.client5.http.impl.auth.BearerSchemeFactory;
5656
import org.apache.hc.client5.http.impl.auth.DigestSchemeFactory;
57-
import org.apache.hc.client5.http.impl.auth.MutualSpnegoSchemeFactory;
57+
import org.apache.hc.client5.http.impl.auth.gss.SpnegoSchemeFactory;
5858
import org.apache.hc.client5.testing.compatibility.ContainerImages;
5959
import org.apache.hc.client5.testing.util.SecurityUtils;
6060
import org.apache.hc.core5.http.config.Registry;
@@ -65,10 +65,10 @@
6565

6666
public class SpnegoTestUtil {
6767

68-
static private final MutualKerberosConfig NO_MUTUAL_KERBEROS_CONFIG =
69-
MutualKerberosConfig.custom().setRequestMutualAuth(false).build();
70-
static private final MutualSpnegoSchemeFactory NO_MUTUAL_SCHEME_FACTORY =
71-
new MutualSpnegoSchemeFactory(NO_MUTUAL_KERBEROS_CONFIG, SystemDefaultDnsResolver.INSTANCE);
68+
static private final GssConfig NO_MUTUAL_KERBEROS_CONFIG =
69+
GssConfig.custom().setRequestMutualAuth(false).build();
70+
static private final SpnegoSchemeFactory NO_MUTUAL_SCHEME_FACTORY =
71+
new SpnegoSchemeFactory(NO_MUTUAL_KERBEROS_CONFIG, SystemDefaultDnsResolver.INSTANCE);
7272

7373
public static KerberosCredentials createCredentials(final Subject subject) {
7474
return SecurityUtils.callAs(subject, new Callable<KerberosCredentials>() {
@@ -94,7 +94,7 @@ public static Registry<AuthSchemeFactory> getSpnegoSchemeRegistry() {
9494
.register(StandardAuthScheme.BEARER, BearerSchemeFactory.INSTANCE)
9595
.register(StandardAuthScheme.BASIC, BasicSchemeFactory.INSTANCE)
9696
.register(StandardAuthScheme.DIGEST, DigestSchemeFactory.INSTANCE)
97-
.register(StandardAuthScheme.SPNEGO, MutualSpnegoSchemeFactory.DEFAULT)
97+
.register(StandardAuthScheme.SPNEGO, SpnegoSchemeFactory.DEFAULT)
9898
// register other schemes as needed
9999
.build();
100100
}

httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestMutualSpnegoScheme.java renamed to httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/TestSpnegoScheme.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
import org.apache.hc.client5.http.auth.AuthenticationException;
4444
import org.apache.hc.client5.http.auth.Credentials;
4545
import org.apache.hc.client5.http.auth.CredentialsProvider;
46-
import org.apache.hc.client5.http.auth.MutualKerberosConfig;
4746
import org.apache.hc.client5.http.auth.StandardAuthScheme;
47+
import org.apache.hc.client5.http.auth.gss.GssConfig;
4848
import org.apache.hc.client5.http.classic.methods.HttpGet;
4949
import org.apache.hc.client5.http.impl.DefaultAuthenticationStrategy;
5050
import org.apache.hc.client5.http.impl.auth.CredentialsProviderBuilder;
51-
import org.apache.hc.client5.http.impl.auth.MutualSpnegoScheme;
51+
import org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme;
5252
import org.apache.hc.client5.http.protocol.HttpClientContext;
5353
import org.apache.hc.client5.http.utils.Base64;
5454
import org.apache.hc.client5.testing.extension.sync.ClientProtocolLevel;
@@ -77,11 +77,11 @@
7777
import org.mockito.Mockito;
7878

7979
/**
80-
* Tests for {@link SPNegoScheme}.
80+
* Tests for {@link org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme}.
8181
*/
82-
public class TestMutualSpnegoScheme extends AbstractIntegrationTestBase {
82+
public class TestSpnegoScheme extends AbstractIntegrationTestBase {
8383

84-
protected TestMutualSpnegoScheme() {
84+
protected TestSpnegoScheme() {
8585
super(URIScheme.HTTP, ClientProtocolLevel.STANDARD);
8686
}
8787

@@ -103,7 +103,7 @@ protected TestMutualSpnegoScheme() {
103103
private static final byte[] BAD_MUTUAL_AUTH_TOKEN_BYTES = BAD_MUTUAL_AUTH_TOKEN.getBytes(StandardCharsets.UTF_8);
104104
private static final byte[] BAD_MUTUAL_AUTH_TOKEN_B64_BYTES = Base64.encodeBase64(BAD_MUTUAL_AUTH_TOKEN_BYTES);
105105

106-
static MutualKerberosConfig MUTUAL_KERBEROS_CONFIG = MutualKerberosConfig.DEFAULT;
106+
static GssConfig MUTUAL_KERBEROS_CONFIG = GssConfig.DEFAULT;
107107

108108
private static class SpnegoAuthenticationStrategy extends DefaultAuthenticationStrategy {
109109

@@ -146,13 +146,13 @@ public void handle(
146146
/**
147147
* This service implements a normal mutualAuth flow
148148
*/
149-
private static class SPNEGOMutualService implements HttpRequestHandler {
149+
private static class SpnegoService implements HttpRequestHandler {
150150

151151
int callCount = 1;
152152
final boolean sendMutualToken;
153153
final byte[] encodedMutualAuthToken;
154154

155-
SPNEGOMutualService (final boolean sendMutualToken, final byte[] encodedMutualAuthToken) {
155+
SpnegoService (final boolean sendMutualToken, final byte[] encodedMutualAuthToken) {
156156
this.sendMutualToken = sendMutualToken;
157157
this.encodedMutualAuthToken = encodedMutualAuthToken;
158158
}
@@ -190,14 +190,14 @@ public void handle(
190190
* Kerberos configuration.
191191
*
192192
*/
193-
private static class NegotiateSchemeWithMockGssManager extends MutualSpnegoScheme {
193+
private static class NegotiateSchemeWithMockGssManager extends SpnegoScheme {
194194

195195
final GSSManager manager = Mockito.mock(GSSManager.class);
196196
final GSSName name = Mockito.mock(GSSName.class);
197197
final GSSContext context = Mockito.mock(GSSContext.class);
198198

199199
NegotiateSchemeWithMockGssManager() throws Exception {
200-
super(MutualKerberosConfig.DEFAULT, SystemDefaultDnsResolver.INSTANCE);
200+
super(GssConfig.DEFAULT, SystemDefaultDnsResolver.INSTANCE);
201201
Mockito.when(context.initSecContext(
202202
ArgumentMatchers.any(), ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt()))
203203
.thenReturn("12345678".getBytes());
@@ -217,7 +217,7 @@ protected GSSManager getManager() {
217217

218218
}
219219

220-
private static class MutualNegotiateSchemeWithMockGssManager extends MutualSpnegoScheme {
220+
private static class MutualNegotiateSchemeWithMockGssManager extends SpnegoScheme {
221221

222222
final GSSManager manager = Mockito.mock(GSSManager.class);
223223
final GSSName name = Mockito.mock(GSSName.class);
@@ -354,7 +354,7 @@ void testNoTokenGeneratedError() throws Exception {
354354
@Test
355355
void testMutualSuccess() throws Exception {
356356
configureServer(t -> {
357-
t.register("*", new SPNEGOMutualService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
357+
t.register("*", new SpnegoService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
358358
});
359359
final HttpHost target = startServer();
360360

@@ -388,7 +388,7 @@ void testMutualSuccess() throws Exception {
388388
@Test
389389
void testMutualFailureNoToken() throws Exception {
390390
configureServer(t -> {
391-
t.register("*", new SPNEGOMutualService(false, null));
391+
t.register("*", new SpnegoService(false, null));
392392
});
393393

394394
final MutualNegotiateSchemeWithMockGssManager mockAuthScheme = new MutualNegotiateSchemeWithMockGssManager(false, false);
@@ -430,7 +430,7 @@ void testMutualFailureNoToken() throws Exception {
430430
@Test
431431
void testMutualFailureEstablishedStatusFalse() throws Exception {
432432
configureServer(t -> {
433-
t.register("*", new SPNEGOMutualService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
433+
t.register("*", new SpnegoService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
434434
});
435435

436436
final MutualNegotiateSchemeWithMockGssManager mockAuthScheme = new MutualNegotiateSchemeWithMockGssManager(false, false);
@@ -471,7 +471,7 @@ void testMutualFailureEstablishedStatusFalse() throws Exception {
471471
@Test
472472
void testMutualFailureMutualStatusFalse() throws Exception {
473473
configureServer(t -> {
474-
t.register("*", new SPNEGOMutualService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
474+
t.register("*", new SpnegoService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
475475
});
476476

477477
final MutualNegotiateSchemeWithMockGssManager mockAuthScheme = new MutualNegotiateSchemeWithMockGssManager(true, false);
@@ -512,7 +512,7 @@ void testMutualFailureMutualStatusFalse() throws Exception {
512512
@Test
513513
void testMutualFailureBadToken() throws Exception {
514514
configureServer(t -> {
515-
t.register("*", new SPNEGOMutualService(true, BAD_MUTUAL_AUTH_TOKEN_B64_BYTES));
515+
t.register("*", new SpnegoService(true, BAD_MUTUAL_AUTH_TOKEN_B64_BYTES));
516516
});
517517

518518
// We except that the initSecContent throws an exception, so the status is irrelevant

httpclient5/src/main/java/org/apache/hc/client5/http/auth/KerberosConfig.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
*
3838
* @deprecated Do not use. The old GGS based experimental authentication schemes are no longer
3939
* supported.
40-
* Use MutualSpnegoScheme, or consider using Basic or Bearer authentication with TLS instead.
41-
* @see org.apache.hc.client5.http.impl.auth.MutualSpnegoScheme
42-
* @see MutualKerberosConfig
40+
* Use org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme, or consider using Basic or Bearer
41+
* authentication with TLS instead.
42+
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme
43+
* @see org.apache.hc.client5.http.auth.gss.GssConfig
4344
*/
4445
@Deprecated
4546
@Contract(threading = ThreadingBehavior.IMMUTABLE)

httpclient5/src/main/java/org/apache/hc/client5/http/auth/KerberosCredentials.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
* @since 4.4
4040
*
4141
*
42-
* Optionally used both by {@link org.apache.hc.client5.http.impl.auth.MutualSpnegoScheme}
42+
* Optionally used both by {@link org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme}
4343
* and the old deprecated GGS based experimental authentication schemes.
4444
*
45-
* @see org.apache.hc.client5.http.impl.auth.MutualSpnegoScheme
45+
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme
4646
*/
4747
@Contract(threading = ThreadingBehavior.IMMUTABLE)
4848
public class KerberosCredentials implements Credentials, Serializable {

httpclient5/src/main/java/org/apache/hc/client5/http/auth/StandardAuthScheme.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private StandardAuthScheme() {
6767
/**
6868
* SPNEGO authentication scheme as defined in RFC 4559 and RFC 4178.
6969
*
70-
* Use {@link org.apache.hc.client5.http.impl.auth.MutualSpnegoScheme} instead of the old
70+
* Use {@link org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme} instead of the old
7171
* deprecated {@link org.apache.hc.client5.http.impl.auth.SPNegoScheme}
7272
*/
7373
public static final String SPNEGO = "Negotiate";

httpclient5/src/main/java/org/apache/hc/client5/http/auth/MutualKerberosConfig.java renamed to httpclient5/src/main/java/org/apache/hc/client5/http/auth/gss/GssConfig.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
*
2626
*/
2727

28-
package org.apache.hc.client5.http.auth;
28+
package org.apache.hc.client5.http.auth.gss;
2929

3030
import org.apache.hc.core5.annotation.Contract;
3131
import org.apache.hc.core5.annotation.ThreadingBehavior;
3232

3333
/**
34-
* Immutable class encapsulating Kerberos configuration options for MutualSpnegoScheme.
34+
* Immutable class encapsulating Kerberos configuration options for the new mutual auth capable
35+
* SpnegoScheme.
3536
*
3637
* Unlike the deprecated {@link KerberosConfig}, this class uses explicit defaults, and
3738
* primitive booleans.
@@ -43,10 +44,10 @@
4344
*
4445
*/
4546
@Contract(threading = ThreadingBehavior.IMMUTABLE)
46-
public class MutualKerberosConfig implements Cloneable {
47+
public class GssConfig implements Cloneable {
4748

4849

49-
public static final MutualKerberosConfig DEFAULT = new Builder().build();
50+
public static final GssConfig DEFAULT = new Builder().build();
5051

5152
private final boolean addPort;
5253
private final boolean useCanonicalHostname;
@@ -56,11 +57,11 @@ public class MutualKerberosConfig implements Cloneable {
5657
/**
5758
* Intended for CDI compatibility
5859
*/
59-
protected MutualKerberosConfig() {
60+
protected GssConfig() {
6061
this(false, false, true, false);
6162
}
6263

63-
MutualKerberosConfig(
64+
GssConfig(
6465
final boolean stripPort,
6566
final boolean useCanonicalHostname,
6667
final boolean requestMutualAuth,
@@ -89,8 +90,8 @@ public boolean isRequestMutualAuth() {
8990
}
9091

9192
@Override
92-
protected MutualKerberosConfig clone() throws CloneNotSupportedException {
93-
return (MutualKerberosConfig) super.clone();
93+
protected GssConfig clone() throws CloneNotSupportedException {
94+
return (GssConfig) super.clone();
9495
}
9596

9697
@Override
@@ -105,11 +106,11 @@ public String toString() {
105106
return builder.toString();
106107
}
107108

108-
public static MutualKerberosConfig.Builder custom() {
109+
public static GssConfig.Builder custom() {
109110
return new Builder();
110111
}
111112

112-
public static MutualKerberosConfig.Builder copy(final MutualKerberosConfig config) {
113+
public static GssConfig.Builder copy(final GssConfig config) {
113114
return new Builder()
114115
.setAddPort(config.isAddPort())
115116
.setUseCanonicalHostname(config.isUseCanonicalHostname())
@@ -148,8 +149,8 @@ public Builder setRequestDelegCreds(final boolean requuestDelegCreds) {
148149
return this;
149150
}
150151

151-
public MutualKerberosConfig build() {
152-
return new MutualKerberosConfig(
152+
public GssConfig build() {
153+
return new GssConfig(
153154
addPort,
154155
useCanonicalHostname,
155156
requestMutualAuth,

httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/GGSSchemeBase.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
* @since 4.2
6262
*
6363
* @deprecated Do not use. The GGS based experimental authentication schemes are no longer
64-
* supported. Use MutualSpnegoScheme, or consider using Basic or Bearer authentication with TLS
65-
* instead.
66-
* @see MutualSpnegoScheme
64+
* supported. Use org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme, or consider using Basic or
65+
* Bearer authentication with TLS instead.
66+
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme
6767
* @see BasicScheme
6868
* @see BearerScheme
6969
*/

httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/KerberosScheme.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@
4242
* @since 4.2
4343
*
4444
* @deprecated Do not use. The old GGS based experimental authentication schemes are no longer
45-
* supported. Use MutualSpnegoScheme, or consider using Basic or Bearer authentication with TLS
45+
* supported. Use org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme, or consider using Basic or
46+
* Bearer authentication with TLS
4647
* instead.
47-
* @see MutualSpnegoScheme
48+
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme
4849
* @see BasicScheme
4950
* @see BearerScheme
5051
*/

httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/KerberosSchemeFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
* @since 4.2
4747
*
4848
* @deprecated Do not use. The old GGS based experimental authentication schemes are no longer
49-
* supported. Use MutualSpnegoSchemeFactory, or consider using Basic or Bearer authentication
50-
* with TLS instead.
51-
* @see MutualSpnegoSchemeFactory
49+
* supported. Use org.apache.hc.client5.http.impl.auth.gss.SpnegoSchemeFactory, or consider using
50+
* Basic or Bearer authentication with TLS instead.
51+
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoSchemeFactory
5252
* @see BasicSchemeFactory
5353
* @see BearerSchemeFactory
5454
*/

httpclient5/src/main/java/org/apache/hc/client5/http/impl/auth/SPNegoScheme.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@
4343
* @since 4.2
4444
*
4545
* @deprecated Do not use. The old GGS based experimental authentication schemes are no longer
46-
* supported. Use MutualSpnegoScheme, or consider using Basic or Bearer authentication with TLS
47-
* instead.
48-
* @see MutualSpnegoScheme
46+
* supported. Use org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme, or consider using Basic or
47+
* Bearer authentication with TLS instead.
48+
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme
4949
* @see BasicScheme
5050
* @see BearerScheme
5151
*/

0 commit comments

Comments
 (0)