Skip to content

Commit de8dd8d

Browse files
committed
checkstyle fixes
1 parent 42d4d82 commit de8dd8d

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private static class SPNEGOMutualService implements HttpRequestHandler {
153153
final boolean sendMutualToken;
154154
final byte[] encodedMutualAuthToken;
155155

156-
SPNEGOMutualService (final boolean sendMutualToken, final byte[] encodedMutualAuthToken){
156+
SPNEGOMutualService (final boolean sendMutualToken, final byte[] encodedMutualAuthToken) {
157157
this.sendMutualToken = sendMutualToken;
158158
this.encodedMutualAuthToken = encodedMutualAuthToken;
159159
}
@@ -170,9 +170,9 @@ public void handle(
170170
response.addHeader(new BasicHeader("WWW-Authenticate", StandardAuthScheme.SPNEGO));
171171
response.addHeader(new BasicHeader("Connection", "Keep-Alive"));
172172
response.setEntity(new StringEntity("auth required "));
173-
} else if(callCount == 2) {
173+
} else if (callCount == 2) {
174174
callCount++;
175-
if(request.getHeader("Authorization").getValue().contains(GOOD_TOKEN_B64)) {
175+
if (request.getHeader("Authorization").getValue().contains(GOOD_TOKEN_B64)) {
176176
response.setCode(HttpStatus.SC_OK);
177177
if (sendMutualToken) {
178178
response.addHeader(new BasicHeader("WWW-Authenticate", StandardAuthScheme.SPNEGO + " " + new String(encodedMutualAuthToken)));
@@ -293,7 +293,7 @@ public AuthScheme create(final HttpContext context) {
293293
* the server still keep asking for a valid ticket.
294294
*/
295295
@Test
296-
public void testDontTryToAuthenticateEndlessly() throws Exception {
296+
void testDontTryToAuthenticateEndlessly() throws Exception {
297297
configureServer(t -> {
298298
t.register("*", new PleaseNegotiateService());
299299
});
@@ -308,7 +308,7 @@ public void testDontTryToAuthenticateEndlessly() throws Exception {
308308
t.setDefaultCredentialsProvider(jaasCredentialsProvider);
309309
});
310310

311-
final HttpHost target = startServer();
311+
final HttpHost target = startServer();
312312
final String s = "/path";
313313
final HttpGet httpget = new HttpGet(s);
314314
client().execute(target, httpget, response -> {
@@ -323,7 +323,7 @@ public void testDontTryToAuthenticateEndlessly() throws Exception {
323323
* if no token is generated. Client should be able to deal with this response.
324324
*/
325325
@Test
326-
public void testNoTokenGeneratedError() throws Exception {
326+
void testNoTokenGeneratedError() throws Exception {
327327
configureServer(t -> {
328328
t.register("*", new PleaseNegotiateService());
329329
});
@@ -339,7 +339,7 @@ public void testNoTokenGeneratedError() throws Exception {
339339
});
340340

341341

342-
final HttpHost target = startServer();
342+
final HttpHost target = startServer();
343343
final String s = "/path";
344344
final HttpGet httpget = new HttpGet(s);
345345
client().execute(target, httpget, response -> {
@@ -354,11 +354,11 @@ public void testNoTokenGeneratedError() throws Exception {
354354
* Test the success case for mutual auth
355355
*/
356356
@Test
357-
public void testMutualSuccess() throws Exception {
357+
void testMutualSuccess() throws Exception {
358358
configureServer(t -> {
359359
t.register("*", new SPNEGOMutualService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
360360
});
361-
final HttpHost target = startServer();
361+
final HttpHost target = startServer();
362362

363363
final MutualNegotiateSchemeWithMockGssManager mockAuthScheme = new MutualNegotiateSchemeWithMockGssManager(true, true);
364364
final AuthSchemeFactory nsf = new TestAuthSchemeFactory(mockAuthScheme);
@@ -388,7 +388,7 @@ public void testMutualSuccess() throws Exception {
388388
* No mutual auth response token sent by server.
389389
*/
390390
@Test
391-
public void testMutualFailureNoToken() throws Exception {
391+
void testMutualFailureNoToken() throws Exception {
392392
configureServer(t -> {
393393
t.register("*", new SPNEGOMutualService(false, null));
394394
});
@@ -407,7 +407,7 @@ public void testMutualFailureNoToken() throws Exception {
407407
final HttpClientContext context = new HttpClientContext();
408408
context.setCredentialsProvider(jaasCredentialsProvider);
409409

410-
final HttpHost target = startServer();
410+
final HttpHost target = startServer();
411411
final String s = "/path";
412412
final HttpGet httpget = new HttpGet(s);
413413
try {
@@ -430,7 +430,7 @@ public void testMutualFailureNoToken() throws Exception {
430430
* Server sends a "valid" token, but we mock the established status to false
431431
*/
432432
@Test
433-
public void testMutualFailureEstablishedStatusFalse() throws Exception {
433+
void testMutualFailureEstablishedStatusFalse() throws Exception {
434434
configureServer(t -> {
435435
t.register("*", new SPNEGOMutualService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
436436
});
@@ -448,7 +448,7 @@ public void testMutualFailureEstablishedStatusFalse() throws Exception {
448448
final HttpClientContext context = new HttpClientContext();
449449
context.setCredentialsProvider(jaasCredentialsProvider);
450450

451-
final HttpHost target = startServer();
451+
final HttpHost target = startServer();
452452
final String s = "/path";
453453
final HttpGet httpget = new HttpGet(s);
454454
try {
@@ -471,7 +471,7 @@ public void testMutualFailureEstablishedStatusFalse() throws Exception {
471471
* Server sends a "valid" token, but we mock the mutual auth status to false
472472
*/
473473
@Test
474-
public void testMutualFailureMutualStatusFalse() throws Exception {
474+
void testMutualFailureMutualStatusFalse() throws Exception {
475475
configureServer(t -> {
476476
t.register("*", new SPNEGOMutualService(true, GOOD_MUTUAL_AUTH_TOKEN_B64_BYTES));
477477
});
@@ -489,7 +489,7 @@ public void testMutualFailureMutualStatusFalse() throws Exception {
489489
final HttpClientContext context = new HttpClientContext();
490490
context.setCredentialsProvider(jaasCredentialsProvider);
491491

492-
final HttpHost target = startServer();
492+
final HttpHost target = startServer();
493493
final String s = "/path";
494494
final HttpGet httpget = new HttpGet(s);
495495
try {
@@ -512,7 +512,7 @@ public void testMutualFailureMutualStatusFalse() throws Exception {
512512
* Server sends a "bad" token, and GSS throws an exception.
513513
*/
514514
@Test
515-
public void testMutualFailureBadToken() throws Exception {
515+
void testMutualFailureBadToken() throws Exception {
516516
configureServer(t -> {
517517
t.register("*", new SPNEGOMutualService(true, BAD_MUTUAL_AUTH_TOKEN_B64_BYTES));
518518
});
@@ -532,7 +532,7 @@ public void testMutualFailureBadToken() throws Exception {
532532
final HttpClientContext context = new HttpClientContext();
533533
context.setCredentialsProvider(jaasCredentialsProvider);
534534

535-
final HttpHost target = startServer();
535+
final HttpHost target = startServer();
536536
final String s = "/path";
537537
final HttpGet httpget = new HttpGet(s);
538538
try {

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ public void processChallenge(
131131
return;
132132
}
133133

134-
final byte[] challengeToken = Base64.decodeBase64(authChallenge== null ? null : authChallenge.getValue());
134+
final byte[] challengeToken = Base64.decodeBase64(authChallenge == null ? null : authChallenge.getValue());
135135

136136
final String gssHostname;
137137
String hostname = host.getHostName();
138-
if (config.getUseCanonicalHostname() != KerberosConfig.Option.DISABLE){
138+
if (config.getUseCanonicalHostname() != KerberosConfig.Option.DISABLE) {
139139
try {
140140
hostname = dnsResolver.resolveCanonicalHostname(host.getHostName());
141-
} catch (final UnknownHostException ignore){
141+
} catch (final UnknownHostException ignore) {
142142
}
143143
}
144144
if (config.getStripPort() != KerberosConfig.Option.DISABLE) {
@@ -170,7 +170,7 @@ public void processChallenge(
170170
case TOKEN_SENT:
171171
if (challenged) {
172172
state = State.TOKEN_READY;
173-
} else if (mutualAuth){
173+
} else if (mutualAuth) {
174174
// We should have received a valid mutualAuth token
175175
if (!gssContext.isEstablished()) {
176176
if (LOG.isDebugEnabled()) {

httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/ProtocolExec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private boolean needAuthentication(
270270
final HttpHost target,
271271
final String pathPrefix,
272272
final HttpResponse response,
273-
final HttpClientContext context) throws AuthenticationException, MalformedChallengeException {
273+
final HttpClientContext context) throws AuthenticationException, MalformedChallengeException {
274274
final RequestConfig config = context.getRequestConfigOrDefault();
275275
if (config.isAuthenticationEnabled()) {
276276
final boolean targetAuthRequested = authenticator.isChallenged(

0 commit comments

Comments
 (0)