Skip to content

Commit fb3b9d2

Browse files
committed
fixing the samller issues based on the review
1 parent a34a560 commit fb3b9d2

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@
3737
*
3838
* @deprecated Do not use. The old GGS based experimental authentication schemes are no longer
3939
* supported.
40-
* Use org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme, or consider using Basic or Bearer
41-
* authentication with TLS instead.
4240
* @see org.apache.hc.client5.http.impl.auth.gss.SpnegoScheme
4341
* @see org.apache.hc.client5.http.auth.gss.GssConfig
4442
*/

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
* @since 4.4
3838
*
3939
* The original KerberosCredentials class has been renamed to
40-
* org.apache.hc.client5.http.auth.gss.GssCredentials for the new Mutual capable SPNEGO Scheme.
41-
* This is an identical child class with the original name to maintain backwards compatibility.
40+
* org.apache.hc.client5.http.auth.gss.GssCredentials.
4241
*
4342
* @deprecated Do not use. The old GGS based experimental authentication schemes are no longer
4443
* supported.

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
import org.apache.hc.core5.annotation.ThreadingBehavior;
3232

3333
/**
34-
* Immutable class encapsulating Kerberos configuration options for the new mutual auth capable
34+
* Immutable class encapsulating GSS configuration options for the new mutual auth capable
3535
* SpnegoScheme.
3636
*
3737
* Unlike the deprecated {@link KerberosConfig}, this class uses explicit defaults, and
3838
* primitive booleans.
3939
*
40-
* Compared to {@link KerberosConfig} stripPort has been changed toAddPort, and the default is now
40+
* Compared to {@link KerberosConfig} stripPort has been changed to addPort, and the default is now
4141
* false (same effect). The default for useCanonicalHostname has been changed to false from true.
4242
*
4343
* @since 5.5
@@ -62,12 +62,12 @@ protected GssConfig() {
6262
}
6363

6464
GssConfig(
65-
final boolean stripPort,
65+
final boolean addPort,
6666
final boolean useCanonicalHostname,
6767
final boolean requestMutualAuth,
6868
final boolean requestDelegCreds) {
6969
super();
70-
this.addPort = stripPort;
70+
this.addPort = addPort;
7171
this.useCanonicalHostname = useCanonicalHostname;
7272
this.requestMutualAuth = requestMutualAuth;
7373
this.requestDelegCreds = requestDelegCreds;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public void processChallenge(
171171
queuedToken = generateToken(challengeToken, KERBEROS_SCHEME, gssHostname);
172172
switch (state) {
173173
case UNINITIATED:
174-
if (challenge != NO_TOKEN) {
174+
if (challengeToken != null) {
175175
if (LOG.isDebugEnabled()) {
176176
final HttpClientContext clientContext = HttpClientContext.cast(context);
177177
final String exchangeId = clientContext.getExchangeId();

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,15 @@
8282
*/
8383
public class SpnegoScheme extends GssSchemeBase {
8484

85-
private static final String SPNEGO_OID = "1.3.6.1.5.5.2";
85+
private static final String SPNEGO_OID_STRING = "1.3.6.1.5.5.2";
86+
private static final Oid SPNEGO_OID;
87+
static {
88+
try {
89+
SPNEGO_OID = new Oid(SPNEGO_OID_STRING);
90+
} catch (final GSSException e) {
91+
throw new IllegalStateException("Failed to create OID for SPNEGO mechanism", e);
92+
}
93+
}
8694

8795
/**
8896
* @since 5.0
@@ -102,7 +110,7 @@ public String getName() {
102110

103111
@Override
104112
protected byte[] generateToken(final byte[] input, final String gssServiceName, final String gssHostname) throws GSSException {
105-
return generateGSSToken(input, new Oid(SPNEGO_OID), gssServiceName, gssHostname);
113+
return generateGSSToken(input, SPNEGO_OID, gssServiceName, gssHostname);
106114
}
107115

108116
@Override

0 commit comments

Comments
 (0)